class Asciidoctor::DocBook45::BlockDlistTemplate

Constants

LIST_TAGS

Public Instance Methods

template() click to toggle source
# File lib/asciidoctor/backends/docbook45.rb, line 309
  def template
    # TODO may want to refactor ListItem content to hold multiple terms
    # that change would drastically simplify this template
    @template ||= @eruby.new <<-EOF
<%#encoding:UTF-8%><%
if @style == 'horizontal'
%><<%= (tag = title? ? 'table' : 'informaltable') %>#{common_attrs_erb} tabstyle="horizontal" frame="none" colsep="0" rowsep="0">#{title_tag}
<tgroup cols="2">
<colspec colwidth="<%= attr :labelwidth, 15 %>*"/>
<colspec colwidth="<%= attr :labelwidth, 85 %>*"/>
<tbody valign="top"><%
  items.each do |terms, dd| %>
<row>
<entry><%
    [*terms].each do |dt| %>
<simpara><%= dt.text %></simpara><%
    end %>
</entry>
<entry><%
    unless dd.nil?
      if dd.text? %>
<simpara><%= dd.text %></simpara><%
      end
      if dd.blocks? %>
<%= dd.content %><%
      end
    end %>
</entry>
</row><%
  end %>
</tbody>
</tgroup>
</<%= tag %>><%
else
  tags = (template.class::LIST_TAGS[@style] || template.class::LIST_TAGS['labeled'])
  if tags[:list]
%><<%= tags[:list] %>#{common_attrs_erb}>#{title_tag}<%
  end
  items.each do |terms, dd| %>
<<%= tags[:entry] %>><%
    if tags.has_key? :label %>
<<%= tags[:label] %>><%
    end
    [*terms].each do |dt| %>
<<%= tags[:term] %>><%= dt.text %></<%= tags[:term] %>><%
    end
    if tags.has_key? :label %>
</<%= tags[:label] %>><%
    end %>
<<%= tags[:item] %>><%
    unless dd.nil?
      if dd.text? %>
<simpara><%= dd.text %></simpara><%
      end
      if dd.blocks? %>
<%= dd.content %><%
      end
    end %>
</<%= tags[:item] %>>
</<%= tags[:entry] %>><%
  end
  if tags[:list] %>
</<%= tags[:list] %>><%
  end
end %>
    EOF
  end