dotfiles

My personal dotfiles 💠️

block_table.html.haml (1557B)

      1 %table{:id => @id, :width => (attr :tablewidth)}
      2   - if title?
      3     %caption=captioned_title
      4   - unless (attr :rowcount).zero?
      5     %colgroup
      6       - @columns.each do |col|
      7         %col{:width => "#{col.attr :colpcwidth}%"}
      8     - [:head, :foot, :body].select {|tblsec| !@rows[tblsec].empty? }.each do |tblsec|
      9       - haml_tag "t#{tblsec}" do
     10         - @rows[tblsec].each do |row|
     11           %tr
     12             - row.each do |cell|
     13               -# store reference of content in advance to resolve attribute 
     14               -# assignments in cells
     15               - if tblsec == :head
     16                 - cell_content = cell.text
     17               - else
     18                 - case cell.style
     19                 - when :verse, :literal
     20                   - cell_content = cell.text
     21                 - else
     22                   - cell_content = cell.content
     23               - bg = @document.attr :cellbgcolor, nil
     24               - tag = tblsec == :head || cell.style == :header ? 'th' : 'td'
     25               - cs = cell.colspan
     26               - rs = cell.rowspan
     27               - haml_tag tag, :<, :colspan => cs, :rowspan => rs, :background => bg do
     28                 - if tblsec == :head
     29                   =cell_content
     30                 - else
     31                   - case cell.style
     32                   - when :asciidoc
     33                     =cell_content
     34                   - when :verse
     35                     ~cell_content
     36                   - when :literal
     37                     %pre=cell_content
     38                   - else
     39                     - cell_content.each do |text|
     40                       %p<=text