forked from modocache/asciidoc-manning-templates
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathblock_table.docbook45.erb
33 lines (33 loc) · 1.61 KB
/
block_table.docbook45.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<%#encoding:UTF-8%><<%= (tag_name = title? ? 'table' : 'informaltable') %> id="<%= id %>" >
<title><%= title %></title>
<% if attr? :width %>
<?dbhtml table-width="<%= attr :width %>"?>
<?dbfo table-width="<%= attr :width %>"?>
<?dblatex table-width="<%= attr :width %>"?>
<% end %>
<tgroup cols="<%= attr :colcount %>">
<% @columns.each do |col| %>
<% end %>
<% [:head, :foot, :body].select {|tblsec| !rows[tblsec].empty? }.each do |tblsec| %>
<t<%= tblsec %>>
<% @rows[tblsec].each do |row| %>
<row>
<% row.each do |cell| %>
<entry><%
cell_content = ''
if tblsec == :head %><% cell_content = "<para>#{cell.text}</para>" %><%
else %><%
case (cell.attr :style)
when :asciidoc %><% cell_content = cell.content %><%
when :verse %><% cell_content = %(<literallayout>\#{template.preserve_endlines(cell.text, self)}</literallayout>) %><%
when :literal %><% cell_content = %(<literallayout class="monospaced">\#{template.preserve_endlines(cell.text, self)}</literallayout>) %><%
when :header %><% cell.content.each do |text| %><% cell_content = %(\#{cell_content\}<para><emphasis role="strong">\#{text}</emphasis></para>) %><% end %><%
else %><% cell.content.each do |text| %><% cell_content = "#{cell_content}<para>#{text}</para>" %><% end %><%
%><% end %><% end%><%= (@document.attr? 'cellbgcolor') ? %(<?dbfo bgcolor="\#{@document.attr 'cellbgcolor'}"?>) : nil %><%= cell_content %></entry>
<% end %>
</row>
<% end %>
</t<%= tblsec %>>
<% end %>
</tgroup>
</<%= tag_name %>>