Module: Metanorma::Standoc::Table

Included in:
Converter
Defined in:
lib/metanorma/standoc/table.rb

Instance Method Summary collapse

Instance Method Details

#table(node) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/metanorma/standoc/table.rb', line 16

def table(node)
  @table_fn_number = "a"
  noko do |xml|
    xml.table **attr_code(table_attrs(node)) do |xml_table|
      colgroup(node, xml_table)
      table_name(node, xml_table)
      %i(head body foot).reject { |tblsec| node.rows[tblsec].empty? }
      table_head_body_and_foot node, xml_table
    end
  end
end

#table_attrs(node) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/metanorma/standoc/table.rb', line 4

def table_attrs(node)
  keep_attrs(node)
    .merge(id: Metanorma::Utils::anchor_or_uuid(node),
           headerrows: node.attr("headerrows"),
           unnumbered: node.option?("unnumbered") ? "true" : nil,
           number: node.attr("number"),
           subsequence: node.attr("subsequence"),
           alt: node.attr("alt"),
           summary: node.attr("summary"),
           width: node.attr("width"))
end