Module: Coradoc::Parser::Asciidoc::Content
Instance Method Summary collapse
- #asciidoc_char ⇒ Object
- #asciidoc_char_with_id ⇒ Object
- #glossaries ⇒ Object
- #glossary ⇒ Object
- #highlight ⇒ Object
- #highlight_text ⇒ Object
- #literal_space ⇒ Object
-
#literal_space? ⇒ Boolean
Override.
- #text_id ⇒ Object
-
#text_line(many_breaks = false) ⇒ Object
Text.
- #underline ⇒ Object
Instance Method Details
#asciidoc_char ⇒ Object
39 40 41 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 39 def asciidoc_char match('^[*_:=\-+]') end |
#asciidoc_char_with_id ⇒ Object
43 44 45 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 43 def asciidoc_char_with_id asciidoc_char | str('[#') | str('[[') end |
#glossaries ⇒ Object
57 58 59 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 57 def glossaries glossary.repeat(1) end |
#glossary ⇒ Object
52 53 54 55 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 52 def glossary keyword.as(:key) >> str("::") >> (str(" ") | newline) >> text.as(:value) >> line_ending.as(:line_break) end |
#highlight ⇒ Object
6 7 8 9 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 6 def highlight text_id >> newline >> underline >> highlight_text >> newline end |
#highlight_text ⇒ Object
15 16 17 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 15 def highlight_text str("#") >> words.as(:text) >> str("#") end |
#literal_space ⇒ Object
19 20 21 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 19 def literal_space (match[" "] | match[' \t']).repeat(1) end |
#literal_space? ⇒ Boolean
Override
24 25 26 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 24 def literal_space? literal_space.maybe end |
#text_id ⇒ Object
47 48 49 50 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 47 def text_id str("[[") >> str('[').absent? >> keyword.as(:id) >> str("]]") | str("[#") >> keyword.as(:id) >> str("]") end |
#text_line(many_breaks = false) ⇒ Object
Text
29 30 31 32 33 34 35 36 37 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 29 def text_line(many_breaks = false) tl = (asciidoc_char_with_id.absent? | text_id) >> literal_space? >> text.as(:text) if many_breaks tl >> line_ending.repeat(1).as(:line_break) else tl >> line_ending.as(:line_break) end end |
#underline ⇒ Object
11 12 13 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 11 def underline str("[underline]") | str("[.underline]") end |