Module: Coradoc::Parser::Asciidoc::Base
- Includes:
- Admonition, AttributeList, Bibliography, Block, Citation, Content, DocumentAttributes, Header, Inline, List, Paragraph, Section, Table, Term
- Included in:
- Base
- Defined in:
- lib/coradoc/parser/asciidoc/base.rb
Instance Method Summary
collapse
Methods included from Term
#term, #term2, #term_type
Methods included from Table
#cell_content, #empty_cell_content, #table, #table_row
Methods included from Section
#contents, #section, #section_block, #section_id, #section_title
Methods included from Paragraph
#paragraph, #paragraph_attributes, #paragraph_text_line
Methods included from List
#definition_list, #dlist_definition, #dlist_delimiter, #dlist_item, #dlist_term, #list, #olist_item, #ordered_list, #ulist_item, #unordered_list
Methods included from Inline
#bold_constrained, #bold_unconstrained, #highlight_constrained, #highlight_unconstrained, #italic_constrained, #italic_unconstrained, #text_formatted, #text_unformatted
Methods included from Header
#author, #header, #header_title, #revision
#attribute_name, #attribute_value, #document_attribute, #document_attributes
Methods included from Content
#asciidoc_char, #asciidoc_char_with_id, #glossaries, #glossary, #highlight, #highlight_text, #literal_space, #literal_space?, #text_id, #text_line, #underline
Methods included from Citation
#citation, #citation_noxref, #citation_xref, #cross_reference, #xref_anchor, #xref_arg, #xref_str
Methods included from Block
#block, #block_content, #block_id, #block_style, #block_title, #block_type, #example_block, #pass_block, #quote_block, #sidebar_block, #source_block
#bib_entry, #bibliography
#attribute_list, #named_attribute, #named_attribute_name, #named_attribute_value, #named_many, #positional_attribute, #positional_many, #positional_many_named_many, #positional_one_named_many, #positional_zero_or_one
Methods included from Admonition
#admonition_line, #admonition_type
Instance Method Details
#attr_name ⇒ Object
108
109
110
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 108
def attr_name
match("[^\t\s]").repeat(1)
end
|
#block_image ⇒ Object
132
133
134
135
136
137
138
139
140
141
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 132
def block_image
(block_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
|
162
163
164
165
166
167
168
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 162
def
( str('////') >> line_ending >>
((line_ending >> str('////')).absent? >> any
).repeat.as(:comment_text) >>
line_ending >> str('////')
).as(:comment_block)
end
|
143
144
145
146
147
148
149
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 143
def
tag.absent? >>
(str('//') >> str("/").absent? >>
space? >>
text.as(:comment_text)
).as(:comment_line)
end
|
#date ⇒ Object
103
104
105
106
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 103
def date
digit.repeat(2, 4) >> str("-") >>
digit.repeat(1, 2) >> str("-") >> digit.repeat(1, 2)
end
|
#digit ⇒ Object
71
72
73
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 71
def digit
match("[0-9]")
end
|
#digits ⇒ Object
75
76
77
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 75
def digits
match("[0-9]").repeat(1)
end
|
#email ⇒ Object
95
96
97
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 95
def email
word >> str("@") >> word >> str(".") >> word
end
|
#empty_line ⇒ Object
67
68
69
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 67
def empty_line
match("^\n")
end
|
#endline ⇒ Object
51
52
53
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 51
def endline
newline | any.absent?
end
|
#file_path ⇒ Object
112
113
114
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 112
def file_path
match('[^\[]').repeat(1)
end
|
#include_directive ⇒ Object
116
117
118
119
120
121
122
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 116
def include_directive
(str("include::") >>
file_path.as(:path) >>
attribute_list >>
(newline | str("")).as(:line_break)
).as(:include)
end
|
#inline_image ⇒ Object
124
125
126
127
128
129
130
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 124
def inline_image
(str("image::") >>
file_path.as(:path) >>
attribute_list >>
(line_ending)
).as(:inline_image)
end
|
#keyword ⇒ Object
63
64
65
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 63
def keyword
(match('[a-zA-Z0-9_\-.,]') | str(".")).repeat(1)
end
|
#line_ending ⇒ Object
47
48
49
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 47
def line_ending
str("\n")
end
|
#newline ⇒ Object
55
56
57
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 55
def newline
(str("\n") | str("\r\n")).repeat(1)
end
|
#newline_single ⇒ Object
59
60
61
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 59
def newline_single
(str("\n") | str("\r\n"))
end
|
#rich_text ⇒ Object
91
92
93
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 91
def rich_text
(match("[a-zA-Z0-9_-]") | str(".") | str("*") | match("@")).repeat(1)
end
|
#rich_texts ⇒ Object
87
88
89
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 87
def rich_texts
rich_text >> (space? >> rich_text).repeat
end
|
#space ⇒ Object
39
40
41
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 39
def space
str(' ').repeat(1)
end
|
#space? ⇒ Boolean
35
36
37
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 35
def space?
space.maybe
end
|
#special_character ⇒ Object
99
100
101
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 99
def special_character
match("^[*:=-]") | str("[#") | str("[[")
end
|
#tag ⇒ Object
151
152
153
154
155
156
157
158
159
160
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 151
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
43
44
45
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 43
def text
match("[^\n]").repeat(1)
end
|
#word ⇒ Object
79
80
81
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 79
def word
match("[a-zA-Z0-9_-]").repeat(1)
end
|
#words ⇒ Object
83
84
85
|
# File 'lib/coradoc/parser/asciidoc/base.rb', line 83
def words
word >> (space? >> word).repeat
end
|