Module: Coradoc::AsciiDoc::Parser::Term
- Defined in:
- lib/coradoc/asciidoc/parser/term.rb
Instance Method Summary collapse
- #footnote ⇒ Object
- #macro_content ⇒ Object
-
#macro_keyword ⇒ Object
Keywords that start macros.
-
#nested_macro ⇒ Object
A nested macro: keyword:.
- #term ⇒ Object
- #term_inline ⇒ Object
- #term_inline2 ⇒ Object
- #term_type ⇒ Object
Instance Method Details
#footnote ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/coradoc/asciidoc/parser/term.rb', line 48 def footnote str('footnote:') >> keyword.as(:id).maybe >> str('[') >> macro_content.as(:footnote) >> str(']') end |
#macro_content ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/coradoc/asciidoc/parser/term.rb', line 23 def macro_content # Match content that is either: # 1. Any character that is not ] # 2. Or a complete nested macro like stem:[...] where the content # itself can contain nested macros ( # Non-bracket character (but not starting a macro keyword) (macro_keyword.absent? >> match('[^\]]')) | # A complete nested macro nested_macro ).repeat(0) end |
#macro_keyword ⇒ Object
Keywords that start macros
37 38 39 40 41 |
# File 'lib/coradoc/asciidoc/parser/term.rb', line 37 def macro_keyword str('stem') | str('term') | str('footnote') | str('latexmath') | str('asciimath') | str('alt') | str('deprecated') | str('domain') end |
#nested_macro ⇒ Object
A nested macro: keyword:
44 45 46 |
# File 'lib/coradoc/asciidoc/parser/term.rb', line 44 def nested_macro macro_keyword >> str(':[') >> macro_content >> str(']') end |
#term ⇒ Object
14 15 16 17 18 19 |
# File 'lib/coradoc/asciidoc/parser/term.rb', line 14 def term line_start? >> term_type >> str(':[') >> match('[^\]]').repeat(1).as(:term) >> str(']') >> str("\n").repeat(1).as(:line_break) end |
#term_inline ⇒ Object
56 57 58 59 60 |
# File 'lib/coradoc/asciidoc/parser/term.rb', line 56 def term_inline term_type >> str(':[') >> match('[^\]]').repeat(1).as(:term) >> str(']') end |
#term_inline2 ⇒ Object
62 63 64 65 66 |
# File 'lib/coradoc/asciidoc/parser/term.rb', line 62 def term_inline2 line_start? >> match('^\[') >> term_type >> str(']#') >> match('[^\#]').repeat(1).as(:term2) >> str('#') end |
#term_type ⇒ Object
7 8 9 10 11 12 |
# File 'lib/coradoc/asciidoc/parser/term.rb', line 7 def term_type (str('term') | str('alt') | str('deprecated') | str('domain')).as(:term_type) end |