class Asciidoctor::HTML5::BlockDlistTemplate

Public Instance Methods

template() click to toggle source
# File lib/asciidoctor/backends/html5.rb, line 307
  def template
    @template ||= @eruby.new <<-EOS
<%#encoding:UTF-8%><%
continuing = false
entries = content
last_index = entries.length - 1
if attr? 'style', 'qanda', false
%><div#{id} class="qlist#{style_class}#{role_class}"><%
if title? %>
<div class="title"><%= title %></div><%
end %>
<ol><%
  entries.each_with_index do |(dt, dd), index|
    last = (index == last_index)
    unless continuing %>
<li><%
    end %>
<p><em><%= dt.text %></em></p><%
    if !last && dd.nil?
      continuing = true
      next
    else
      continuing = false
    end
    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', false
%><div#{id} class="hdlist#{role_class}"><%
if title? %>
<div class="title"><%= title %></div><%
end %>
<table><%
if (attr? :labelwidth) || (attr? :itemwidth) %>
<colgroup>
<col<% if attr? :labelwidth %> style="width:<%= (attr :labelwidth).chomp('%') %>%;"<% end %>>
<col<% if attr? :itemwidth %> style="width:<%= (attr :itemwidth).chomp('%') %>%;"<% end %>>
</colgroup><%
end %><%
  entries.each_with_index do |(dt, dd), index|
    last = (index == last_index)
    unless continuing %>
<tr>
<td class="hdlist1<%= (attr? 'strong-option') ? 'strong' : nil %>"><%
    end %>
<%= dt.text %>
<br><%
    if !last && dd.nil?
      continuing = true
      next
    else
      continuing = false
    end %>
</td>
<td class="hdlist2"><%
    unless dd.nil?
      if dd.text? %>
<p><%= 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}"><%
if title? %>
<div class="title"><%= title %></div><%
end %>
<dl><%
  entries.each_with_index do |(dt, dd), index|
    last = (index == last_index) %>
<dt<%= !(attr? 'style', nil, false) ? %( class="hdlist1") : nil %>><%= 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 %>
    EOS
  end