= block_with_caption :top, :class=>'tableblock' | |
table [ | |
class=["tableblock", "frame-#{attr :frame, 'all'}", "grid-#{attr :grid, 'all'}", spread?] | |
style=style_value(width: ("#{attr :tablepcwidth}%" if !autowidth? && !spread? || (local_attr :width)), | |
float: (attr :float)) ] | |
- unless (attr :rowcount).zero? | |
colgroup | |
- if autowidth? | |
- columns.each do | |
col | |
- else | |
- columns.each do |col| | |
col style="width: #{col.attr :colpcwidth}%;" | |
- [:head, :foot, :body].reject { |tblsec| rows[tblsec].empty? }.each do |tblsec| | |
<t#{tblsec}> | |
- rows[tblsec].each do |row| | |
tr | |
- row.each do |cell| | |
= html_tag(tblsec == :head || cell.style == :header ? 'th' : 'td', | |
:class=>["tableblock", "halign-#{cell.attr :halign}", "valign-#{cell.attr :valign}"], | |
:colspan=>cell.colspan, | |
:rowspan=>cell.rowspan, | |
:style=>style_value(background_color: (document.attr :cellbgcolor))) | |
- if tblsec == :head | |
=cell.text | |
- else | |
- case cell.style | |
- when :asciidoc | |
=cell.content | |
- when :verse | |
.verse: pre =cell.text | |
- when :literal | |
.literal: pre =cell.text | |
- else | |
- if cell.content.one? | |
=cell.content.first | |
- else | |
- cell.content.each do |text| | |
p =text |