Module: Coradoc::Parser::Asciidoc::Table

Included in:
Base, Base
Defined in:
lib/coradoc/parser/asciidoc/table.rb

Instance Method Summary collapse

Instance Method Details

#cell_contentObject



26
27
28
# File 'lib/coradoc/parser/asciidoc/table.rb', line 26

def cell_content
  str("|").absent? >> literal_space? >> rich_texts.as(:text)
end

#empty_cell_contentObject



22
23
24
# File 'lib/coradoc/parser/asciidoc/table.rb', line 22

def empty_cell_content
  str("|").absent? >> literal_space.as(:text)
end

#tableObject

include Coradoc::Parser::Asciidoc::Base



7
8
9
10
11
12
13
14
15
# File 'lib/coradoc/parser/asciidoc/table.rb', line 7

def table
  block_id.maybe >>
  (attribute_list >> newline).maybe >>
  block_title.maybe >>
  (attribute_list >> newline).maybe >>
    str("|===") >> line_ending >>
    table_row.repeat(1).as(:rows) >>
    str("|===") >> line_ending
end

#table_rowObject



17
18
19
20
# File 'lib/coradoc/parser/asciidoc/table.rb', line 17

def table_row
  (literal_space? >> str("|") >> (cell_content | empty_cell_content))
    .repeat(1).as(:cols) >> line_ending
end