Module: Asciidoctor::Rfc::V3::Table

Included in:
Converter
Defined in:
lib/asciidoctor/rfc/v3/table.rb

Instance Method Summary collapse

Instance Method Details

#table(node) ⇒ Object

Syntax:

[[id]]
.Title
|===
|col | col
|===


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/asciidoctor/rfc/v3/table.rb', line 10

def table(node)
  noko do |xml|
    has_body = false
    # TODO iref belongs here

    table_attributes = {
      anchor: node.id,
    }

    xml.table **attr_code(table_attributes) do |xml_table|
      [:head, :body, :foot].reject { |tblsec| node.rows[tblsec].empty? }.each do |tblsec|
        has_body = true if tblsec == :body
      end
      warn "asciidoctor: WARNING (#{current_location(node)}): tables must have at least one body row" unless has_body

      xml_table.name node.title if node.title?
      table_head_body_and_foot node, xml_table
    end
  end
end