Module: Coradoc::Parser::Asciidoc::Content
- Included in:
- Base
- Defined in:
- lib/coradoc/parser/asciidoc/content.rb
Instance Method Summary collapse
- #asciidoc_char ⇒ Object
- #asciidoc_char_with_id ⇒ Object
- #glossaries ⇒ Object
- #glossary ⇒ Object
- #highlight ⇒ Object
- #highlight_text ⇒ Object
- #list_prefix ⇒ Object
- #literal_space ⇒ Object
-
#literal_space? ⇒ Boolean
Override.
- #section_prefix ⇒ Object
- #text_id ⇒ Object
-
#text_line(many_breaks = false) ⇒ Object
Text.
- #underline ⇒ Object
Instance Method Details
#asciidoc_char ⇒ Object
49 50 51 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 49 def asciidoc_char line_start? >> match['*_:+=\-'] end |
#asciidoc_char_with_id ⇒ Object
53 54 55 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 53 def asciidoc_char_with_id asciidoc_char | str('[#') | str('[[') end |
#glossaries ⇒ Object
67 68 69 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 67 def glossaries glossary.repeat(1) end |
#glossary ⇒ Object
62 63 64 65 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 62 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 |
#list_prefix ⇒ Object
28 29 30 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 28 def list_prefix (line_start? >> match('^[*\.]') >> 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 |
#section_prefix ⇒ Object
32 33 34 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 32 def section_prefix (line_start? >> match('^[=]') >> str('=').repeat(0) >> match('[^\n]')) end |
#text_id ⇒ Object
57 58 59 60 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 57 def text_id str("[[") >> str('[').absent? >> keyword.as(:id) >> str("]]") | str("[#") >> keyword.as(:id) >> str("]") end |
#text_line(many_breaks = false) ⇒ Object
Text
37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/coradoc/parser/asciidoc/content.rb', line 37 def text_line(many_breaks = false) #:zero :one :many tl = #section_prefix.absent? >> # list_prefix.absent? >> (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 |