table(id=id
      class=['tableblock', "frame-#{attr :frame, 'all'}", "grid-#{attr :grid, 'all'}", spread?, role]
      style=style_value(width: ("#{attr :tablepcwidth}%" unless autowidth? || spread?), float: (attr :float)))
  - if title?
    caption.title =captioned_title
  - 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|
      *{tag: %(t#{tblsec})}
        - rows[tblsec].each do |row|
          tr
            - row.each do |cell|
              *{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
                    div =cell.content
                  - when :verse
                    .verse =cell.text
                  - when :literal
                    .literal: pre =cell.text
                  - else
                    - cell.content.each do |text|
                      p.tableblock =text
