class Asciidoctor::HTML5::BlockDlistTemplate

Public Instance Methods

template() click to toggle source
# File lib/asciidoctor/backends/html5.rb, line 197
  def template
    @template ||= @eruby.new "<%#encoding:UTF-8%><%
if attr? :style, 'qanda' %>
<div#{id} class="qlist#{style_class}#{role_class}">
  #{title_div}
  <ol>
  <% content.each do |dt, dd| %>
    <li>
      <p><em><%= dt.text %></em></p>
      <% unless dd.nil? %>
      <% if dd.text? %>
      <p><%= dd.text %></p>
      <% end %>
      <% if dd.blocks? %>
<%= dd.content %>
      <% end %>
      <% end %>
    </li>
  <% end %>
  </ol>
</div>
<% elsif attr? :style, 'horizontal' %>
<div#{id} class="hdlist#{role_class}">
  #{title_div}
  <table>
    <colgroup>
      <col<% if attr? :labelwidth %> style="width: <%= attr :labelwidth %>%;"<% end %>>
      <col<% if attr? :itemwidth %> style="width: <%= attr :itemwidth %>%;"<% end %>>
    </colgroup>
    <% content.each do |dt, dd| %>
    <tr>
      <td class="hdlist1<% if attr? 'strong-option' %> strong<% end %>">
        <%= dt.text %>
        <br>
      </td>
      <td class="hdlist2"><% unless dd.nil? %><% if dd.text? %>
        <p style="margin-top: 0"><%= dd.text %></p><% end %><% if dd.blocks? %>
<%= dd.content %><% end %><% end %>
      </td>
    </tr>
    <% end %>
  </table>
</div>
<% else %>
<div#{id} class="dlist#{style_class}#{role_class}">
  #{title_div}
  <dl>
    <% content.each do |dt, dd| %>
    <dt<% if !(attr? :style) %> class="hdlist1"<% end %>>
      <%= dt.text %>
    </dt>
    <% unless dd.nil? %>
    <dd>
      <% if dd.text? %>
      <p><%= dd.text %></p>
      <% end %>
      <% if dd.blocks? %>
<%= dd.content %>
      <% end %>
    </dd>
    <% end %>
    <% end %>
  </dl>
</div>
<% end %>
"
  end