Module: Coradoc::Parser::Asciidoc::Section
- Includes:
- Base, Content
- Included in:
- Base
- Defined in:
- lib/coradoc/parser/asciidoc/section.rb
Instance Method Summary
collapse
Methods included from Content
#asciidoc_char, #asciidoc_char_with_id, #block_title, #cell_content, #contents, #definition_list, #dlist_item, #empty_cell_content, #example_block, #glossaries, #glossary, #highlight, #highlight_text, #list, #literal_space, #literal_space?, #nlist_item, #numbered_list, #paragraph, #table, #table_row, #text_id, #text_line, #ulist_item, #underline, #unnumbered_list, #word
Methods included from Base
#attribute_name, #attribute_value, #digits, #email, #empty_line, #endline, #keyword, #line_ending, #newline, #space, #space?, #special_character, #text, #word, #words
Instance Method Details
#fifth_level_section ⇒ Object
50
51
52
|
# File 'lib/coradoc/parser/asciidoc/section.rb', line 50
def fifth_level_section
sub_section(6) >> sixth_level_section.repeat.maybe.as(:sections)
end
|
#fourth_level_section ⇒ Object
46
47
48
|
# File 'lib/coradoc/parser/asciidoc/section.rb', line 46
def fourth_level_section
sub_section(5) >> fifth_level_section.repeat.maybe.as(:sections)
end
|
#second_level_section ⇒ Object
38
39
40
|
# File 'lib/coradoc/parser/asciidoc/section.rb', line 38
def second_level_section
sub_section(3) >> third_level_section.repeat.maybe.as(:sections)
end
|
#section ⇒ Object
30
31
32
|
# File 'lib/coradoc/parser/asciidoc/section.rb', line 30
def section
section_block >> second_level_section.repeat.maybe.as(:sections)
end
|
#section_block(level = 2) ⇒ Object
11
12
13
14
15
|
# File 'lib/coradoc/parser/asciidoc/section.rb', line 11
def section_block(level = 2)
section_id.maybe >>
section_title(level).as(:title) >>
contents.as(:contents).maybe
end
|
#section_id ⇒ Object
18
19
20
21
|
# File 'lib/coradoc/parser/asciidoc/section.rb', line 18
def section_id
(str("[[") >> keyword.as(:id) >> str("]]") |
str("[#") >> keyword.as(:id) >> str("]")) >> newline
end
|
#section_title(level = 2, max_level = 8) ⇒ Object
24
25
26
27
|
# File 'lib/coradoc/parser/asciidoc/section.rb', line 24
def section_title(level = 2, max_level = 8)
match("=").repeat(level, max_level).as(:level) >>
space? >> text.as(:text) >> endline.as(:break)
end
|
#sixth_level_section ⇒ Object
54
55
56
|
# File 'lib/coradoc/parser/asciidoc/section.rb', line 54
def sixth_level_section
sub_section(7) >> sub_section(8).repeat.maybe.as(:sections)
end
|
#sub_section(level) ⇒ Object
34
35
36
|
# File 'lib/coradoc/parser/asciidoc/section.rb', line 34
def sub_section(level)
newline.maybe >> section_block(level)
end
|
#third_level_section ⇒ Object
42
43
44
|
# File 'lib/coradoc/parser/asciidoc/section.rb', line 42
def third_level_section
sub_section(4) >> fourth_level_section.repeat.maybe.as(:sections)
end
|