Module: Coradoc::Parser::Asciidoc::Base
- Included in:
- Content, DocumentAttributes, Header, Section
- Defined in:
- lib/coradoc/parser/asciidoc/base.rb
Instance Method Summary collapse
- #attribute_name ⇒ Object
- #attribute_value ⇒ Object
- #date ⇒ Object
- #digit ⇒ Object
- #digits ⇒ Object
- #email ⇒ Object
- #empty_line ⇒ Object
- #endline ⇒ Object
- #keyword ⇒ Object
- #line_ending ⇒ Object
- #newline ⇒ Object
- #rich_text ⇒ Object
- #rich_texts ⇒ Object
- #space ⇒ Object
- #space? ⇒ Boolean
- #special_character ⇒ Object
- #text ⇒ Object
- #word ⇒ Object
- #words ⇒ Object
Instance Method Details
#attribute_name ⇒ Object
65 66 67 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 65 def attribute_name match("[a-zA-Z0-9_-]").repeat(1) end |
#attribute_value ⇒ Object
69 70 71 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 69 def attribute_value text | str("") end |
#date ⇒ Object
77 78 79 80 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 77 def date digit.repeat(2, 4) >> str("-") >> digit.repeat(1, 2) >> str("-") >> digit.repeat(1, 2) end |
#digit ⇒ Object
37 38 39 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 37 def digit match("[0-9]") end |
#digits ⇒ Object
41 42 43 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 41 def digits match("[0-9]").repeat(1) end |
#email ⇒ Object
61 62 63 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 61 def email word >> str("@") >> word >> str(".") >> word end |
#empty_line ⇒ Object
33 34 35 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 33 def empty_line match("^\n") end |
#endline ⇒ Object
21 22 23 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 21 def endline newline | any.absent? end |
#keyword ⇒ Object
29 30 31 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 29 def keyword (match("[a-zA-Z0-9_-]") | str(".")).repeat(1) end |
#line_ending ⇒ Object
17 18 19 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 17 def line_ending match("[\n]") end |
#newline ⇒ Object
25 26 27 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 25 def newline match["\r\n"].repeat(1) end |
#rich_text ⇒ Object
57 58 59 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 57 def rich_text (match("[a-zA-Z0-9_-]") | str(".") | str("*") | match("@")).repeat(1) end |
#rich_texts ⇒ Object
53 54 55 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 53 def rich_texts rich_text >> (space? >> rich_text).repeat end |
#space ⇒ Object
9 10 11 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 9 def space match('\s').repeat(1) end |
#space? ⇒ Boolean
5 6 7 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 5 def space? space.maybe end |
#special_character ⇒ Object
73 74 75 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 73 def special_character match("^[*_:=-]") | str("[#") | str("[[") end |
#text ⇒ Object
13 14 15 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 13 def text match("[^\n]").repeat(1) end |
#word ⇒ Object
45 46 47 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 45 def word match("[a-zA-Z0-9_-]").repeat(1) end |
#words ⇒ Object
49 50 51 |
# File 'lib/coradoc/parser/asciidoc/base.rb', line 49 def words word >> (space? >> word).repeat end |