Module: Coradoc::Parser::Asciidoc::Text
- Included in:
- Base
- Defined in:
- lib/coradoc/parser/asciidoc/text.rb
Instance Method Summary collapse
- #attr_name ⇒ Object
- #block_image ⇒ Object
- #comment_block ⇒ Object
- #comment_line ⇒ Object
- #date ⇒ Object
- #digit ⇒ Object
- #digits ⇒ Object
- #email ⇒ Object
- #empty_line ⇒ Object
- #endline ⇒ Object
- #eof? ⇒ Boolean
- #file_path ⇒ Object
- #include_directive ⇒ Object
- #inline_image ⇒ Object
- #keyword ⇒ Object
- #line_end ⇒ Object
- #line_ending ⇒ Object
- #line_start? ⇒ Boolean
-
#newline ⇒ Object
def endline_single newline_single | any.absent? end.
- #newline_single ⇒ Object
- #rich_text ⇒ Object
- #rich_texts ⇒ Object
- #space ⇒ Object
- #space? ⇒ Boolean
- #special_character ⇒ Object
- #tag ⇒ Object
- #text ⇒ Object
- #word ⇒ Object
- #words ⇒ Object
Instance Method Details
#attr_name ⇒ Object
94 95 96 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 94 def attr_name match("[^\t\s]").repeat(1) end |
#block_image ⇒ Object
118 119 120 121 122 123 124 125 126 127 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 118 def block_image (element_id.maybe >> block_title.maybe >> (attribute_list >> newline).maybe >> match("^i") >> str("mage::") >> file_path.as(:path) >> attribute_list(:attribute_list_macro) >> newline.as(:line_break) ).as(:block_image) end |
#comment_block ⇒ Object
148 149 150 151 152 153 154 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 148 def comment_block (str("////") >> line_ending >> ((line_ending >> str("////")).absent? >> any ).repeat.as(:comment_text) >> line_ending >> str("////") ).as(:comment_block) end |
#comment_line ⇒ Object
129 130 131 132 133 134 135 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 129 def comment_line tag.absent? >> (str("//") >> str("/").absent? >> space? >> text.as(:comment_text) ).as(:comment_line) end |
#date ⇒ Object
89 90 91 92 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 89 def date digit.repeat(2, 4) >> str("-") >> digit.repeat(1, 2) >> str("-") >> digit.repeat(1, 2) end |
#digit ⇒ Object
57 58 59 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 57 def digit match("[0-9]") end |
#digits ⇒ Object
61 62 63 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 61 def digits match("[0-9]").repeat(1) end |
#email ⇒ Object
81 82 83 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 81 def email word >> str("@") >> word >> str(".") >> word end |
#empty_line ⇒ Object
53 54 55 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 53 def empty_line match("^\n") end |
#endline ⇒ Object
33 34 35 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 33 def endline newline | any.absent? end |
#eof? ⇒ Boolean
25 26 27 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 25 def eof? any.absent? end |
#file_path ⇒ Object
98 99 100 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 98 def file_path match('[^\[]').repeat(1) end |
#include_directive ⇒ Object
102 103 104 105 106 107 108 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 102 def include_directive (str("include::") >> file_path.as(:path) >> attribute_list >> (newline | str("")).as(:line_break) ).as(:include) end |
#inline_image ⇒ Object
110 111 112 113 114 115 116 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 110 def inline_image (str("image::") >> file_path.as(:path) >> attribute_list >> (line_ending) ).as(:inline_image) end |
#keyword ⇒ Object
49 50 51 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 49 def keyword (match('[a-zA-Z0-9_\-.,]') | str(".")).repeat(1) end |
#line_end ⇒ Object
29 30 31 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 29 def line_end str("\n") | str("\r\n") | eof? end |
#line_ending ⇒ Object
21 22 23 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 21 def line_ending str("\n") # | match('[\z]')# | match('$') end |
#line_start? ⇒ Boolean
17 18 19 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 17 def line_start? match('^[^\n]').present? end |
#newline ⇒ Object
def endline_single
newline_single | any.absent?
end
41 42 43 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 41 def newline (str("\n") | str("\r\n")).repeat(1) end |
#newline_single ⇒ Object
45 46 47 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 45 def newline_single (str("\n") | str("\r\n")) end |
#rich_text ⇒ Object
77 78 79 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 77 def rich_text (match("[a-zA-Z0-9_-]") | str(".") | str("*") | match("@")).repeat(1) end |
#rich_texts ⇒ Object
73 74 75 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 73 def rich_texts rich_text >> (space? >> rich_text).repeat end |
#space ⇒ Object
9 10 11 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 9 def space str(" ").repeat(1) end |
#space? ⇒ Boolean
5 6 7 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 5 def space? space.maybe end |
#special_character ⇒ Object
85 86 87 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 85 def special_character match("^[*:=-]") | str("[#") | str("[[") end |
#tag ⇒ Object
137 138 139 140 141 142 143 144 145 146 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 137 def tag (str("//") >> str("/").absent? >> space? >> (str("tag") | str("end")).as(:prefix) >> str("::") >> str(":").absent? >> match('[^\[]').repeat(1).as(:name) >> attribute_list >> line_ending.maybe.as(:line_break) ).as(:tag) end |
#text ⇒ Object
13 14 15 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 13 def text match("[^\n]").repeat(1) end |
#word ⇒ Object
65 66 67 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 65 def word match("[a-zA-Z0-9_-]").repeat(1) end |
#words ⇒ Object
69 70 71 |
# File 'lib/coradoc/parser/asciidoc/text.rb', line 69 def words word >> (space? >> word).repeat end |