nora_mark 0.2beta6 → 0.2beta7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +86 -2
- data/example/nora-simple-ja.css +19 -0
- data/example/nora-simple.css +6 -15
- data/example/noramark-reference-ja.nora +23 -1
- data/example/noramark-reference-ja_00001.xhtml +39 -23
- data/lib/nora_mark/html/abstract_node_writer.rb +1 -1
- data/lib/nora_mark/html/context.rb +4 -3
- data/lib/nora_mark/html/generator.rb +58 -27
- data/lib/nora_mark/html/pages.rb +50 -37
- data/lib/nora_mark/html/paragraph_writer.rb +3 -3
- data/lib/nora_mark/html/tag_writer.rb +8 -7
- data/lib/nora_mark/node.rb +258 -2
- data/lib/nora_mark/node_builder.rb +18 -0
- data/lib/nora_mark/node_set.rb +24 -0
- data/lib/nora_mark/node_util.rb +38 -0
- data/lib/nora_mark/parser.kpeg +72 -57
- data/lib/nora_mark/parser.kpeg.rb +766 -246
- data/lib/nora_mark/transformer.rb +43 -0
- data/lib/nora_mark/version.rb +1 -1
- data/lib/nora_mark.rb +28 -11
- data/spec/nokogiri_test_helper.rb +9 -9
- data/spec/nora_mark_spec.rb +236 -9
- metadata +7 -2
@@ -6,262 +6,320 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
6
6
|
module ::NoraMark
|
7
7
|
class Node; end
|
8
8
|
class Block < Node
|
9
|
-
def initialize(name, ids, classes, parameters, content)
|
9
|
+
def initialize(name, ids, classes, parameters, named_parameters, content, line_no)
|
10
10
|
@name = name
|
11
11
|
@ids = ids
|
12
12
|
@classes = classes
|
13
13
|
@parameters = parameters
|
14
|
+
@named_parameters = named_parameters
|
14
15
|
@content = content
|
16
|
+
@line_no = line_no
|
15
17
|
end
|
16
18
|
attr_reader :name
|
17
19
|
attr_reader :ids
|
18
20
|
attr_reader :classes
|
19
21
|
attr_reader :parameters
|
22
|
+
attr_reader :named_parameters
|
20
23
|
attr_reader :content
|
24
|
+
attr_reader :line_no
|
21
25
|
end
|
22
26
|
class Breakline < Node
|
23
|
-
def initialize()
|
27
|
+
def initialize(line_no)
|
28
|
+
@line_no = line_no
|
24
29
|
end
|
30
|
+
attr_reader :line_no
|
25
31
|
end
|
26
32
|
class DefinitionList < Node
|
27
|
-
def initialize(ids, classes, parameters, content)
|
33
|
+
def initialize(ids, classes, parameters, named_parameters, content, line_no)
|
28
34
|
@ids = ids
|
29
35
|
@classes = classes
|
30
36
|
@parameters = parameters
|
37
|
+
@named_parameters = named_parameters
|
31
38
|
@content = content
|
39
|
+
@line_no = line_no
|
32
40
|
end
|
33
41
|
attr_reader :ids
|
34
42
|
attr_reader :classes
|
35
43
|
attr_reader :parameters
|
44
|
+
attr_reader :named_parameters
|
36
45
|
attr_reader :content
|
46
|
+
attr_reader :line_no
|
37
47
|
end
|
38
48
|
class DLItem < Node
|
39
|
-
def initialize(ids, classes, parameters, content)
|
49
|
+
def initialize(ids, classes, parameters, named_parameters, content, line_no)
|
40
50
|
@ids = ids
|
41
51
|
@classes = classes
|
42
52
|
@parameters = parameters
|
53
|
+
@named_parameters = named_parameters
|
43
54
|
@content = content
|
55
|
+
@line_no = line_no
|
44
56
|
end
|
45
57
|
attr_reader :ids
|
46
58
|
attr_reader :classes
|
47
59
|
attr_reader :parameters
|
60
|
+
attr_reader :named_parameters
|
48
61
|
attr_reader :content
|
62
|
+
attr_reader :line_no
|
49
63
|
end
|
50
64
|
class Frontmatter < Node
|
51
|
-
def initialize(content)
|
65
|
+
def initialize(content, line_no)
|
52
66
|
@content = content
|
67
|
+
@line_no = line_no
|
53
68
|
end
|
54
69
|
attr_reader :content
|
70
|
+
attr_reader :line_no
|
55
71
|
end
|
56
72
|
class HeadedSection < Node
|
57
|
-
def initialize(level, heading, content)
|
73
|
+
def initialize(level, heading, content, line_no)
|
58
74
|
@level = level
|
59
75
|
@heading = heading
|
60
76
|
@content = content
|
77
|
+
@line_no = line_no
|
61
78
|
end
|
62
79
|
attr_reader :level
|
63
80
|
attr_reader :heading
|
64
81
|
attr_reader :content
|
82
|
+
attr_reader :line_no
|
65
83
|
end
|
66
84
|
class Inline < Node
|
67
|
-
def initialize(name, ids, classes, parameters, content)
|
68
|
-
@name = name
|
69
|
-
@ids = ids
|
70
|
-
@classes = classes
|
71
|
-
@parameters = parameters
|
72
|
-
@content = content
|
73
|
-
end
|
74
|
-
attr_reader :name
|
75
|
-
attr_reader :ids
|
76
|
-
attr_reader :classes
|
77
|
-
attr_reader :parameters
|
78
|
-
attr_reader :content
|
79
|
-
end
|
80
|
-
class LineCommand < Node
|
81
|
-
def initialize(name, ids, classes, parameters, content)
|
85
|
+
def initialize(name, ids, classes, parameters, named_parameters, content, line_no)
|
82
86
|
@name = name
|
83
87
|
@ids = ids
|
84
88
|
@classes = classes
|
85
89
|
@parameters = parameters
|
90
|
+
@named_parameters = named_parameters
|
86
91
|
@content = content
|
92
|
+
@line_no = line_no
|
87
93
|
end
|
88
94
|
attr_reader :name
|
89
95
|
attr_reader :ids
|
90
96
|
attr_reader :classes
|
91
97
|
attr_reader :parameters
|
98
|
+
attr_reader :named_parameters
|
92
99
|
attr_reader :content
|
100
|
+
attr_reader :line_no
|
93
101
|
end
|
94
102
|
class Newpage < Node
|
95
|
-
def initialize(ids, classes, parameters, content)
|
103
|
+
def initialize(ids, classes, parameters, named_parameters, content, line_no)
|
96
104
|
@ids = ids
|
97
105
|
@classes = classes
|
98
106
|
@parameters = parameters
|
107
|
+
@named_parameters = named_parameters
|
99
108
|
@content = content
|
109
|
+
@line_no = line_no
|
100
110
|
end
|
101
111
|
attr_reader :ids
|
102
112
|
attr_reader :classes
|
103
113
|
attr_reader :parameters
|
114
|
+
attr_reader :named_parameters
|
104
115
|
attr_reader :content
|
116
|
+
attr_reader :line_no
|
105
117
|
end
|
106
118
|
class OlItem < Node
|
107
|
-
def initialize(ids, classes, parameters, content)
|
119
|
+
def initialize(ids, classes, parameters, named_parameters, content, line_no)
|
108
120
|
@ids = ids
|
109
121
|
@classes = classes
|
110
122
|
@parameters = parameters
|
123
|
+
@named_parameters = named_parameters
|
111
124
|
@content = content
|
125
|
+
@line_no = line_no
|
112
126
|
end
|
113
127
|
attr_reader :ids
|
114
128
|
attr_reader :classes
|
115
129
|
attr_reader :parameters
|
130
|
+
attr_reader :named_parameters
|
116
131
|
attr_reader :content
|
132
|
+
attr_reader :line_no
|
117
133
|
end
|
118
134
|
class OrderedList < Node
|
119
|
-
def initialize(ids, classes, parameters, content)
|
135
|
+
def initialize(ids, classes, parameters, named_parameters, content, line_no)
|
120
136
|
@ids = ids
|
121
137
|
@classes = classes
|
122
138
|
@parameters = parameters
|
139
|
+
@named_parameters = named_parameters
|
123
140
|
@content = content
|
141
|
+
@line_no = line_no
|
124
142
|
end
|
125
143
|
attr_reader :ids
|
126
144
|
attr_reader :classes
|
127
145
|
attr_reader :parameters
|
146
|
+
attr_reader :named_parameters
|
128
147
|
attr_reader :content
|
148
|
+
attr_reader :line_no
|
129
149
|
end
|
130
150
|
class Page < Node
|
131
|
-
def initialize(content)
|
151
|
+
def initialize(content, line_no)
|
132
152
|
@content = content
|
153
|
+
@line_no = line_no
|
133
154
|
end
|
134
155
|
attr_reader :content
|
156
|
+
attr_reader :line_no
|
135
157
|
end
|
136
158
|
class Paragraph < Node
|
137
|
-
def initialize(ids, classes, parameters, content)
|
159
|
+
def initialize(ids, classes, parameters, named_parameters, content, line_no)
|
138
160
|
@ids = ids
|
139
161
|
@classes = classes
|
140
162
|
@parameters = parameters
|
163
|
+
@named_parameters = named_parameters
|
141
164
|
@content = content
|
165
|
+
@line_no = line_no
|
142
166
|
end
|
143
167
|
attr_reader :ids
|
144
168
|
attr_reader :classes
|
145
169
|
attr_reader :parameters
|
170
|
+
attr_reader :named_parameters
|
146
171
|
attr_reader :content
|
172
|
+
attr_reader :line_no
|
147
173
|
end
|
148
174
|
class ParagraphGroup < Node
|
149
|
-
def initialize(ids, classes, parameters, content)
|
175
|
+
def initialize(ids, classes, parameters, named_parameters, content, line_no)
|
150
176
|
@ids = ids
|
151
177
|
@classes = classes
|
152
178
|
@parameters = parameters
|
179
|
+
@named_parameters = named_parameters
|
153
180
|
@content = content
|
181
|
+
@line_no = line_no
|
154
182
|
end
|
155
183
|
attr_reader :ids
|
156
184
|
attr_reader :classes
|
157
185
|
attr_reader :parameters
|
186
|
+
attr_reader :named_parameters
|
158
187
|
attr_reader :content
|
188
|
+
attr_reader :line_no
|
159
189
|
end
|
160
190
|
class PreformattedBlock < Node
|
161
|
-
def initialize(name, ids, classes, parameters, codelanguage, content)
|
191
|
+
def initialize(name, ids, classes, parameters, named_parameters, codelanguage, content, line_no)
|
162
192
|
@name = name
|
163
193
|
@ids = ids
|
164
194
|
@classes = classes
|
165
195
|
@parameters = parameters
|
196
|
+
@named_parameters = named_parameters
|
166
197
|
@codelanguage = codelanguage
|
167
198
|
@content = content
|
199
|
+
@line_no = line_no
|
168
200
|
end
|
169
201
|
attr_reader :name
|
170
202
|
attr_reader :ids
|
171
203
|
attr_reader :classes
|
172
204
|
attr_reader :parameters
|
205
|
+
attr_reader :named_parameters
|
173
206
|
attr_reader :codelanguage
|
174
207
|
attr_reader :content
|
208
|
+
attr_reader :line_no
|
175
209
|
end
|
176
|
-
class
|
210
|
+
class Root < Node
|
177
211
|
def initialize(content)
|
178
212
|
@content = content
|
179
213
|
end
|
180
214
|
attr_reader :content
|
181
215
|
end
|
216
|
+
class Text < Node
|
217
|
+
def initialize(content, line_no)
|
218
|
+
@content = content
|
219
|
+
@line_no = line_no
|
220
|
+
end
|
221
|
+
attr_reader :content
|
222
|
+
attr_reader :line_no
|
223
|
+
end
|
182
224
|
class UlItem < Node
|
183
|
-
def initialize(ids, classes, parameters, content)
|
225
|
+
def initialize(ids, classes, parameters, named_parameters, content, line_no)
|
184
226
|
@ids = ids
|
185
227
|
@classes = classes
|
186
228
|
@parameters = parameters
|
229
|
+
@named_parameters = named_parameters
|
187
230
|
@content = content
|
231
|
+
@line_no = line_no
|
188
232
|
end
|
189
233
|
attr_reader :ids
|
190
234
|
attr_reader :classes
|
191
235
|
attr_reader :parameters
|
236
|
+
attr_reader :named_parameters
|
192
237
|
attr_reader :content
|
238
|
+
attr_reader :line_no
|
193
239
|
end
|
194
240
|
class UnorderedList < Node
|
195
|
-
def initialize(ids, classes, parameters, content)
|
241
|
+
def initialize(ids, classes, parameters, named_parameters, content, line_no)
|
196
242
|
@ids = ids
|
197
243
|
@classes = classes
|
198
244
|
@parameters = parameters
|
245
|
+
@named_parameters = named_parameters
|
199
246
|
@content = content
|
247
|
+
@line_no = line_no
|
200
248
|
end
|
201
249
|
attr_reader :ids
|
202
250
|
attr_reader :classes
|
203
251
|
attr_reader :parameters
|
252
|
+
attr_reader :named_parameters
|
204
253
|
attr_reader :content
|
254
|
+
attr_reader :line_no
|
205
255
|
end
|
206
256
|
end
|
207
257
|
module ::NoraMarkConstruction
|
208
|
-
def block(name, ids, classes, parameters, content)
|
209
|
-
::NoraMark::Block.new(name, ids, classes, parameters, content)
|
258
|
+
def block(name, ids, classes, parameters, named_parameters, content, line_no)
|
259
|
+
::NoraMark::Block.new(name, ids, classes, parameters, named_parameters, content, line_no)
|
210
260
|
end
|
211
|
-
def br()
|
212
|
-
::NoraMark::Breakline.new()
|
261
|
+
def br(line_no)
|
262
|
+
::NoraMark::Breakline.new(line_no)
|
213
263
|
end
|
214
|
-
def definition_list(ids, classes, parameters, content)
|
215
|
-
::NoraMark::DefinitionList.new(ids, classes, parameters, content)
|
264
|
+
def definition_list(ids, classes, parameters, named_parameters, content, line_no)
|
265
|
+
::NoraMark::DefinitionList.new(ids, classes, parameters, named_parameters, content, line_no)
|
216
266
|
end
|
217
|
-
def dl_item(ids, classes, parameters, content)
|
218
|
-
::NoraMark::DLItem.new(ids, classes, parameters, content)
|
267
|
+
def dl_item(ids, classes, parameters, named_parameters, content, line_no)
|
268
|
+
::NoraMark::DLItem.new(ids, classes, parameters, named_parameters, content, line_no)
|
219
269
|
end
|
220
|
-
def frontmatter(content)
|
221
|
-
::NoraMark::Frontmatter.new(content)
|
270
|
+
def frontmatter(content, line_no)
|
271
|
+
::NoraMark::Frontmatter.new(content, line_no)
|
222
272
|
end
|
223
|
-
def h_section(level, heading, content)
|
224
|
-
::NoraMark::HeadedSection.new(level, heading, content)
|
273
|
+
def h_section(level, heading, content, line_no)
|
274
|
+
::NoraMark::HeadedSection.new(level, heading, content, line_no)
|
225
275
|
end
|
226
|
-
def inline(name, ids, classes, parameters, content)
|
227
|
-
::NoraMark::Inline.new(name, ids, classes, parameters, content)
|
276
|
+
def inline(name, ids, classes, parameters, named_parameters, content, line_no)
|
277
|
+
::NoraMark::Inline.new(name, ids, classes, parameters, named_parameters, content, line_no)
|
228
278
|
end
|
229
|
-
def
|
230
|
-
::NoraMark::
|
279
|
+
def newpage(ids, classes, parameters, named_parameters, content, line_no)
|
280
|
+
::NoraMark::Newpage.new(ids, classes, parameters, named_parameters, content, line_no)
|
231
281
|
end
|
232
|
-
def
|
233
|
-
::NoraMark::
|
282
|
+
def ol_item(ids, classes, parameters, named_parameters, content, line_no)
|
283
|
+
::NoraMark::OlItem.new(ids, classes, parameters, named_parameters, content, line_no)
|
234
284
|
end
|
235
|
-
def
|
236
|
-
::NoraMark::
|
285
|
+
def ordered_list(ids, classes, parameters, named_parameters, content, line_no)
|
286
|
+
::NoraMark::OrderedList.new(ids, classes, parameters, named_parameters, content, line_no)
|
237
287
|
end
|
238
|
-
def
|
239
|
-
::NoraMark::
|
288
|
+
def page(content, line_no)
|
289
|
+
::NoraMark::Page.new(content, line_no)
|
240
290
|
end
|
241
|
-
def
|
242
|
-
::NoraMark::
|
291
|
+
def paragraph(ids, classes, parameters, named_parameters, content, line_no)
|
292
|
+
::NoraMark::Paragraph.new(ids, classes, parameters, named_parameters, content, line_no)
|
243
293
|
end
|
244
|
-
def
|
245
|
-
::NoraMark::
|
294
|
+
def paragraph_group(ids, classes, parameters, named_parameters, content, line_no)
|
295
|
+
::NoraMark::ParagraphGroup.new(ids, classes, parameters, named_parameters, content, line_no)
|
246
296
|
end
|
247
|
-
def
|
248
|
-
::NoraMark::
|
297
|
+
def preformatted_block(name, ids, classes, parameters, named_parameters, codelanguage, content, line_no)
|
298
|
+
::NoraMark::PreformattedBlock.new(name, ids, classes, parameters, named_parameters, codelanguage, content, line_no)
|
249
299
|
end
|
250
|
-
def
|
251
|
-
::NoraMark::
|
300
|
+
def root(content)
|
301
|
+
::NoraMark::Root.new(content)
|
252
302
|
end
|
253
|
-
def text(content)
|
254
|
-
::NoraMark::Text.new(content)
|
303
|
+
def text(content, line_no)
|
304
|
+
::NoraMark::Text.new(content, line_no)
|
255
305
|
end
|
256
|
-
def ul_item(ids, classes, parameters, content)
|
257
|
-
::NoraMark::UlItem.new(ids, classes, parameters, content)
|
306
|
+
def ul_item(ids, classes, parameters, named_parameters, content, line_no)
|
307
|
+
::NoraMark::UlItem.new(ids, classes, parameters, named_parameters, content, line_no)
|
258
308
|
end
|
259
|
-
def unordered_list(ids, classes, parameters, content)
|
260
|
-
::NoraMark::UnorderedList.new(ids, classes, parameters, content)
|
309
|
+
def unordered_list(ids, classes, parameters, named_parameters, content, line_no)
|
310
|
+
::NoraMark::UnorderedList.new(ids, classes, parameters, named_parameters, content, line_no)
|
261
311
|
end
|
262
312
|
end
|
263
313
|
include ::NoraMarkConstruction
|
264
314
|
|
315
|
+
# ln = { current_line }
|
316
|
+
def _ln
|
317
|
+
@result = begin; current_line ; end
|
318
|
+
_tmp = true
|
319
|
+
set_failed_rule :_ln unless _tmp
|
320
|
+
return _tmp
|
321
|
+
end
|
322
|
+
|
265
323
|
# BOM = /\uFEFF/
|
266
324
|
def _BOM
|
267
325
|
_tmp = scan(/\A(?-mix:\uFEFF)/)
|
@@ -710,7 +768,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
710
768
|
return _tmp
|
711
769
|
end
|
712
770
|
|
713
|
-
# CommandName = Word:name IdNames?:idnames ClassNames?:classes { {name: name, ids: idnames, classes: classes} }
|
771
|
+
# CommandName = Word:name IdNames?:idnames ClassNames?:classes ln:ln { {name: name, ids: idnames, classes: classes, ln:ln } }
|
714
772
|
def _CommandName
|
715
773
|
|
716
774
|
_save = self.pos
|
@@ -745,7 +803,13 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
745
803
|
self.pos = _save
|
746
804
|
break
|
747
805
|
end
|
748
|
-
|
806
|
+
_tmp = apply(:_ln)
|
807
|
+
ln = @result
|
808
|
+
unless _tmp
|
809
|
+
self.pos = _save
|
810
|
+
break
|
811
|
+
end
|
812
|
+
@result = begin; {name: name, ids: idnames, classes: classes, ln:ln } ; end
|
749
813
|
_tmp = true
|
750
814
|
unless _tmp
|
751
815
|
self.pos = _save
|
@@ -928,6 +992,177 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
928
992
|
return _tmp
|
929
993
|
end
|
930
994
|
|
995
|
+
# NParameterNormal = < /[^,\]]/* > { text }
|
996
|
+
def _NParameterNormal
|
997
|
+
|
998
|
+
_save = self.pos
|
999
|
+
while true # sequence
|
1000
|
+
_text_start = self.pos
|
1001
|
+
while true
|
1002
|
+
_tmp = scan(/\A(?-mix:[^,\]])/)
|
1003
|
+
break unless _tmp
|
1004
|
+
end
|
1005
|
+
_tmp = true
|
1006
|
+
if _tmp
|
1007
|
+
text = get_text(_text_start)
|
1008
|
+
end
|
1009
|
+
unless _tmp
|
1010
|
+
self.pos = _save
|
1011
|
+
break
|
1012
|
+
end
|
1013
|
+
@result = begin; text ; end
|
1014
|
+
_tmp = true
|
1015
|
+
unless _tmp
|
1016
|
+
self.pos = _save
|
1017
|
+
end
|
1018
|
+
break
|
1019
|
+
end # end sequence
|
1020
|
+
|
1021
|
+
set_failed_rule :_NParameterNormal unless _tmp
|
1022
|
+
return _tmp
|
1023
|
+
end
|
1024
|
+
|
1025
|
+
# NParameterQuoted = "\"" < /[^"]/* > "\"" - &/[,\]]/ { text }
|
1026
|
+
def _NParameterQuoted
|
1027
|
+
|
1028
|
+
_save = self.pos
|
1029
|
+
while true # sequence
|
1030
|
+
_tmp = match_string("\"")
|
1031
|
+
unless _tmp
|
1032
|
+
self.pos = _save
|
1033
|
+
break
|
1034
|
+
end
|
1035
|
+
_text_start = self.pos
|
1036
|
+
while true
|
1037
|
+
_tmp = scan(/\A(?-mix:[^"])/)
|
1038
|
+
break unless _tmp
|
1039
|
+
end
|
1040
|
+
_tmp = true
|
1041
|
+
if _tmp
|
1042
|
+
text = get_text(_text_start)
|
1043
|
+
end
|
1044
|
+
unless _tmp
|
1045
|
+
self.pos = _save
|
1046
|
+
break
|
1047
|
+
end
|
1048
|
+
_tmp = match_string("\"")
|
1049
|
+
unless _tmp
|
1050
|
+
self.pos = _save
|
1051
|
+
break
|
1052
|
+
end
|
1053
|
+
_tmp = apply(:__hyphen_)
|
1054
|
+
unless _tmp
|
1055
|
+
self.pos = _save
|
1056
|
+
break
|
1057
|
+
end
|
1058
|
+
_save2 = self.pos
|
1059
|
+
_tmp = scan(/\A(?-mix:[,\]])/)
|
1060
|
+
self.pos = _save2
|
1061
|
+
unless _tmp
|
1062
|
+
self.pos = _save
|
1063
|
+
break
|
1064
|
+
end
|
1065
|
+
@result = begin; text ; end
|
1066
|
+
_tmp = true
|
1067
|
+
unless _tmp
|
1068
|
+
self.pos = _save
|
1069
|
+
end
|
1070
|
+
break
|
1071
|
+
end # end sequence
|
1072
|
+
|
1073
|
+
set_failed_rule :_NParameterQuoted unless _tmp
|
1074
|
+
return _tmp
|
1075
|
+
end
|
1076
|
+
|
1077
|
+
# NParameterSingleQuoted = "'" < /[^']/* > "'" - &/[,\]]/ { text }
|
1078
|
+
def _NParameterSingleQuoted
|
1079
|
+
|
1080
|
+
_save = self.pos
|
1081
|
+
while true # sequence
|
1082
|
+
_tmp = match_string("'")
|
1083
|
+
unless _tmp
|
1084
|
+
self.pos = _save
|
1085
|
+
break
|
1086
|
+
end
|
1087
|
+
_text_start = self.pos
|
1088
|
+
while true
|
1089
|
+
_tmp = scan(/\A(?-mix:[^'])/)
|
1090
|
+
break unless _tmp
|
1091
|
+
end
|
1092
|
+
_tmp = true
|
1093
|
+
if _tmp
|
1094
|
+
text = get_text(_text_start)
|
1095
|
+
end
|
1096
|
+
unless _tmp
|
1097
|
+
self.pos = _save
|
1098
|
+
break
|
1099
|
+
end
|
1100
|
+
_tmp = match_string("'")
|
1101
|
+
unless _tmp
|
1102
|
+
self.pos = _save
|
1103
|
+
break
|
1104
|
+
end
|
1105
|
+
_tmp = apply(:__hyphen_)
|
1106
|
+
unless _tmp
|
1107
|
+
self.pos = _save
|
1108
|
+
break
|
1109
|
+
end
|
1110
|
+
_save2 = self.pos
|
1111
|
+
_tmp = scan(/\A(?-mix:[,\]])/)
|
1112
|
+
self.pos = _save2
|
1113
|
+
unless _tmp
|
1114
|
+
self.pos = _save
|
1115
|
+
break
|
1116
|
+
end
|
1117
|
+
@result = begin; text ; end
|
1118
|
+
_tmp = true
|
1119
|
+
unless _tmp
|
1120
|
+
self.pos = _save
|
1121
|
+
end
|
1122
|
+
break
|
1123
|
+
end # end sequence
|
1124
|
+
|
1125
|
+
set_failed_rule :_NParameterSingleQuoted unless _tmp
|
1126
|
+
return _tmp
|
1127
|
+
end
|
1128
|
+
|
1129
|
+
# NParameter = (NParameterQuoted | NParameterSingleQuoted | NParameterNormal):value { value }
|
1130
|
+
def _NParameter
|
1131
|
+
|
1132
|
+
_save = self.pos
|
1133
|
+
while true # sequence
|
1134
|
+
|
1135
|
+
_save1 = self.pos
|
1136
|
+
while true # choice
|
1137
|
+
_tmp = apply(:_NParameterQuoted)
|
1138
|
+
break if _tmp
|
1139
|
+
self.pos = _save1
|
1140
|
+
_tmp = apply(:_NParameterSingleQuoted)
|
1141
|
+
break if _tmp
|
1142
|
+
self.pos = _save1
|
1143
|
+
_tmp = apply(:_NParameterNormal)
|
1144
|
+
break if _tmp
|
1145
|
+
self.pos = _save1
|
1146
|
+
break
|
1147
|
+
end # end choice
|
1148
|
+
|
1149
|
+
value = @result
|
1150
|
+
unless _tmp
|
1151
|
+
self.pos = _save
|
1152
|
+
break
|
1153
|
+
end
|
1154
|
+
@result = begin; value ; end
|
1155
|
+
_tmp = true
|
1156
|
+
unless _tmp
|
1157
|
+
self.pos = _save
|
1158
|
+
end
|
1159
|
+
break
|
1160
|
+
end # end sequence
|
1161
|
+
|
1162
|
+
set_failed_rule :_NParameter unless _tmp
|
1163
|
+
return _tmp
|
1164
|
+
end
|
1165
|
+
|
931
1166
|
# Parameters = (Parameter:parameter "," - Parameters:parameters { [ parameter ] + parameters } | Parameter:parameter { [ parameter ] })
|
932
1167
|
def _Parameters
|
933
1168
|
|
@@ -994,7 +1229,122 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
994
1229
|
return _tmp
|
995
1230
|
end
|
996
1231
|
|
997
|
-
#
|
1232
|
+
# NamedParameter = Word:key - ":" - NParameter:parameter { { key.to_sym => parameter } }
|
1233
|
+
def _NamedParameter
|
1234
|
+
|
1235
|
+
_save = self.pos
|
1236
|
+
while true # sequence
|
1237
|
+
_tmp = apply(:_Word)
|
1238
|
+
key = @result
|
1239
|
+
unless _tmp
|
1240
|
+
self.pos = _save
|
1241
|
+
break
|
1242
|
+
end
|
1243
|
+
_tmp = apply(:__hyphen_)
|
1244
|
+
unless _tmp
|
1245
|
+
self.pos = _save
|
1246
|
+
break
|
1247
|
+
end
|
1248
|
+
_tmp = match_string(":")
|
1249
|
+
unless _tmp
|
1250
|
+
self.pos = _save
|
1251
|
+
break
|
1252
|
+
end
|
1253
|
+
_tmp = apply(:__hyphen_)
|
1254
|
+
unless _tmp
|
1255
|
+
self.pos = _save
|
1256
|
+
break
|
1257
|
+
end
|
1258
|
+
_tmp = apply(:_NParameter)
|
1259
|
+
parameter = @result
|
1260
|
+
unless _tmp
|
1261
|
+
self.pos = _save
|
1262
|
+
break
|
1263
|
+
end
|
1264
|
+
@result = begin; { key.to_sym => parameter } ; end
|
1265
|
+
_tmp = true
|
1266
|
+
unless _tmp
|
1267
|
+
self.pos = _save
|
1268
|
+
end
|
1269
|
+
break
|
1270
|
+
end # end sequence
|
1271
|
+
|
1272
|
+
set_failed_rule :_NamedParameter unless _tmp
|
1273
|
+
return _tmp
|
1274
|
+
end
|
1275
|
+
|
1276
|
+
# NamedParameters = (NamedParameter:parameter - "," - NamedParameters:parameters { parameter.merge parameters } | NamedParameter:parameter { parameter })
|
1277
|
+
def _NamedParameters
|
1278
|
+
|
1279
|
+
_save = self.pos
|
1280
|
+
while true # choice
|
1281
|
+
|
1282
|
+
_save1 = self.pos
|
1283
|
+
while true # sequence
|
1284
|
+
_tmp = apply(:_NamedParameter)
|
1285
|
+
parameter = @result
|
1286
|
+
unless _tmp
|
1287
|
+
self.pos = _save1
|
1288
|
+
break
|
1289
|
+
end
|
1290
|
+
_tmp = apply(:__hyphen_)
|
1291
|
+
unless _tmp
|
1292
|
+
self.pos = _save1
|
1293
|
+
break
|
1294
|
+
end
|
1295
|
+
_tmp = match_string(",")
|
1296
|
+
unless _tmp
|
1297
|
+
self.pos = _save1
|
1298
|
+
break
|
1299
|
+
end
|
1300
|
+
_tmp = apply(:__hyphen_)
|
1301
|
+
unless _tmp
|
1302
|
+
self.pos = _save1
|
1303
|
+
break
|
1304
|
+
end
|
1305
|
+
_tmp = apply(:_NamedParameters)
|
1306
|
+
parameters = @result
|
1307
|
+
unless _tmp
|
1308
|
+
self.pos = _save1
|
1309
|
+
break
|
1310
|
+
end
|
1311
|
+
@result = begin; parameter.merge parameters ; end
|
1312
|
+
_tmp = true
|
1313
|
+
unless _tmp
|
1314
|
+
self.pos = _save1
|
1315
|
+
end
|
1316
|
+
break
|
1317
|
+
end # end sequence
|
1318
|
+
|
1319
|
+
break if _tmp
|
1320
|
+
self.pos = _save
|
1321
|
+
|
1322
|
+
_save2 = self.pos
|
1323
|
+
while true # sequence
|
1324
|
+
_tmp = apply(:_NamedParameter)
|
1325
|
+
parameter = @result
|
1326
|
+
unless _tmp
|
1327
|
+
self.pos = _save2
|
1328
|
+
break
|
1329
|
+
end
|
1330
|
+
@result = begin; parameter ; end
|
1331
|
+
_tmp = true
|
1332
|
+
unless _tmp
|
1333
|
+
self.pos = _save2
|
1334
|
+
end
|
1335
|
+
break
|
1336
|
+
end # end sequence
|
1337
|
+
|
1338
|
+
break if _tmp
|
1339
|
+
self.pos = _save
|
1340
|
+
break
|
1341
|
+
end # end choice
|
1342
|
+
|
1343
|
+
set_failed_rule :_NamedParameters unless _tmp
|
1344
|
+
return _tmp
|
1345
|
+
end
|
1346
|
+
|
1347
|
+
# Command = CommandName:cn ("(" - Parameters:args - ")")? ("[" - NamedParameters:named_args - "]")? { cn.merge({ args: args || [] , named_args: named_args || {}}) }
|
998
1348
|
def _Command
|
999
1349
|
|
1000
1350
|
_save = self.pos
|
@@ -1005,47 +1355,87 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1005
1355
|
self.pos = _save
|
1006
1356
|
break
|
1007
1357
|
end
|
1008
|
-
_save1 = self.pos
|
1358
|
+
_save1 = self.pos
|
1359
|
+
|
1360
|
+
_save2 = self.pos
|
1361
|
+
while true # sequence
|
1362
|
+
_tmp = match_string("(")
|
1363
|
+
unless _tmp
|
1364
|
+
self.pos = _save2
|
1365
|
+
break
|
1366
|
+
end
|
1367
|
+
_tmp = apply(:__hyphen_)
|
1368
|
+
unless _tmp
|
1369
|
+
self.pos = _save2
|
1370
|
+
break
|
1371
|
+
end
|
1372
|
+
_tmp = apply(:_Parameters)
|
1373
|
+
args = @result
|
1374
|
+
unless _tmp
|
1375
|
+
self.pos = _save2
|
1376
|
+
break
|
1377
|
+
end
|
1378
|
+
_tmp = apply(:__hyphen_)
|
1379
|
+
unless _tmp
|
1380
|
+
self.pos = _save2
|
1381
|
+
break
|
1382
|
+
end
|
1383
|
+
_tmp = match_string(")")
|
1384
|
+
unless _tmp
|
1385
|
+
self.pos = _save2
|
1386
|
+
end
|
1387
|
+
break
|
1388
|
+
end # end sequence
|
1389
|
+
|
1390
|
+
unless _tmp
|
1391
|
+
_tmp = true
|
1392
|
+
self.pos = _save1
|
1393
|
+
end
|
1394
|
+
unless _tmp
|
1395
|
+
self.pos = _save
|
1396
|
+
break
|
1397
|
+
end
|
1398
|
+
_save3 = self.pos
|
1009
1399
|
|
1010
|
-
|
1400
|
+
_save4 = self.pos
|
1011
1401
|
while true # sequence
|
1012
|
-
_tmp = match_string("
|
1402
|
+
_tmp = match_string("[")
|
1013
1403
|
unless _tmp
|
1014
|
-
self.pos =
|
1404
|
+
self.pos = _save4
|
1015
1405
|
break
|
1016
1406
|
end
|
1017
1407
|
_tmp = apply(:__hyphen_)
|
1018
1408
|
unless _tmp
|
1019
|
-
self.pos =
|
1409
|
+
self.pos = _save4
|
1020
1410
|
break
|
1021
1411
|
end
|
1022
|
-
_tmp = apply(:
|
1023
|
-
|
1412
|
+
_tmp = apply(:_NamedParameters)
|
1413
|
+
named_args = @result
|
1024
1414
|
unless _tmp
|
1025
|
-
self.pos =
|
1415
|
+
self.pos = _save4
|
1026
1416
|
break
|
1027
1417
|
end
|
1028
1418
|
_tmp = apply(:__hyphen_)
|
1029
1419
|
unless _tmp
|
1030
|
-
self.pos =
|
1420
|
+
self.pos = _save4
|
1031
1421
|
break
|
1032
1422
|
end
|
1033
|
-
_tmp = match_string("
|
1423
|
+
_tmp = match_string("]")
|
1034
1424
|
unless _tmp
|
1035
|
-
self.pos =
|
1425
|
+
self.pos = _save4
|
1036
1426
|
end
|
1037
1427
|
break
|
1038
1428
|
end # end sequence
|
1039
1429
|
|
1040
1430
|
unless _tmp
|
1041
1431
|
_tmp = true
|
1042
|
-
self.pos =
|
1432
|
+
self.pos = _save3
|
1043
1433
|
end
|
1044
1434
|
unless _tmp
|
1045
1435
|
self.pos = _save
|
1046
1436
|
break
|
1047
1437
|
end
|
1048
|
-
@result = begin;
|
1438
|
+
@result = begin; cn.merge({ args: args || [] , named_args: named_args || {}}) ; end
|
1049
1439
|
_tmp = true
|
1050
1440
|
unless _tmp
|
1051
1441
|
self.pos = _save
|
@@ -1057,7 +1447,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1057
1447
|
return _tmp
|
1058
1448
|
end
|
1059
1449
|
|
1060
|
-
# ImplicitParagraph = - !ParagraphDelimiter Comment* DocumentLine:content Comment* EofComment? {paragraph([],[], [], content)}
|
1450
|
+
# ImplicitParagraph = - !ParagraphDelimiter Comment* DocumentLine:content ln:ln Comment* EofComment? {paragraph([],[], [], [], content, ln)}
|
1061
1451
|
def _ImplicitParagraph
|
1062
1452
|
|
1063
1453
|
_save = self.pos
|
@@ -1090,6 +1480,12 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1090
1480
|
self.pos = _save
|
1091
1481
|
break
|
1092
1482
|
end
|
1483
|
+
_tmp = apply(:_ln)
|
1484
|
+
ln = @result
|
1485
|
+
unless _tmp
|
1486
|
+
self.pos = _save
|
1487
|
+
break
|
1488
|
+
end
|
1093
1489
|
while true
|
1094
1490
|
_tmp = apply(:_Comment)
|
1095
1491
|
break unless _tmp
|
@@ -1109,7 +1505,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1109
1505
|
self.pos = _save
|
1110
1506
|
break
|
1111
1507
|
end
|
1112
|
-
@result = begin; paragraph([],[], [], content); end
|
1508
|
+
@result = begin; paragraph([],[], [], [], content, ln); end
|
1113
1509
|
_tmp = true
|
1114
1510
|
unless _tmp
|
1115
1511
|
self.pos = _save
|
@@ -1145,7 +1541,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1145
1541
|
return _tmp
|
1146
1542
|
end
|
1147
1543
|
|
1148
|
-
# ExplicitParagraph = - ExplicitParagraphCommand:c ":" - DocumentContent?:content Le EmptyLine* {paragraph(c[:ids], c[:classes], c[:args], content)}
|
1544
|
+
# ExplicitParagraph = - ExplicitParagraphCommand:c ":" - DocumentContent?:content Le EmptyLine* {paragraph(c[:ids], c[:classes], c[:args], c[:named_args], content, c[:ln])}
|
1149
1545
|
def _ExplicitParagraph
|
1150
1546
|
|
1151
1547
|
_save = self.pos
|
@@ -1197,7 +1593,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1197
1593
|
self.pos = _save
|
1198
1594
|
break
|
1199
1595
|
end
|
1200
|
-
@result = begin; paragraph(c[:ids], c[:classes], c[:args], content); end
|
1596
|
+
@result = begin; paragraph(c[:ids], c[:classes], c[:args], c[:named_args], content, c[:ln]); end
|
1201
1597
|
_tmp = true
|
1202
1598
|
unless _tmp
|
1203
1599
|
self.pos = _save
|
@@ -1227,11 +1623,17 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1227
1623
|
return _tmp
|
1228
1624
|
end
|
1229
1625
|
|
1230
|
-
# ParagraphGroup = Paragraph+:p EmptyLine* {paragraph_group([],[],[],p)}
|
1626
|
+
# ParagraphGroup = ln:ln Paragraph+:p EmptyLine* {paragraph_group([],[],[],[],p, ln)}
|
1231
1627
|
def _ParagraphGroup
|
1232
1628
|
|
1233
1629
|
_save = self.pos
|
1234
1630
|
while true # sequence
|
1631
|
+
_tmp = apply(:_ln)
|
1632
|
+
ln = @result
|
1633
|
+
unless _tmp
|
1634
|
+
self.pos = _save
|
1635
|
+
break
|
1636
|
+
end
|
1235
1637
|
_save1 = self.pos
|
1236
1638
|
_ary = []
|
1237
1639
|
_tmp = apply(:_Paragraph)
|
@@ -1261,7 +1663,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1261
1663
|
self.pos = _save
|
1262
1664
|
break
|
1263
1665
|
end
|
1264
|
-
@result = begin; paragraph_group([],[],[],p); end
|
1666
|
+
@result = begin; paragraph_group([],[],[],[],p, ln); end
|
1265
1667
|
_tmp = true
|
1266
1668
|
unless _tmp
|
1267
1669
|
self.pos = _save
|
@@ -1273,16 +1675,11 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1273
1675
|
return _tmp
|
1274
1676
|
end
|
1275
1677
|
|
1276
|
-
# BlockHead =
|
1678
|
+
# BlockHead = Command:command - "{" - Nl EmptyLine* { command }
|
1277
1679
|
def _BlockHead
|
1278
1680
|
|
1279
1681
|
_save = self.pos
|
1280
1682
|
while true # sequence
|
1281
|
-
_tmp = apply(:__hyphen_)
|
1282
|
-
unless _tmp
|
1283
|
-
self.pos = _save
|
1284
|
-
break
|
1285
|
-
end
|
1286
1683
|
_tmp = apply(:_Command)
|
1287
1684
|
command = @result
|
1288
1685
|
unless _tmp
|
@@ -1441,11 +1838,16 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1441
1838
|
return _tmp
|
1442
1839
|
end
|
1443
1840
|
|
1444
|
-
# ExplicitBlock = BlockHead:c - BlockBody:content - BlockEnd {block(c[:name], c[:ids], c[:classes], c[:args], content)}
|
1841
|
+
# ExplicitBlock = - BlockHead:c - BlockBody:content - BlockEnd {block(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], content, c[:ln])}
|
1445
1842
|
def _ExplicitBlock
|
1446
1843
|
|
1447
1844
|
_save = self.pos
|
1448
1845
|
while true # sequence
|
1846
|
+
_tmp = apply(:__hyphen_)
|
1847
|
+
unless _tmp
|
1848
|
+
self.pos = _save
|
1849
|
+
break
|
1850
|
+
end
|
1449
1851
|
_tmp = apply(:_BlockHead)
|
1450
1852
|
c = @result
|
1451
1853
|
unless _tmp
|
@@ -1473,7 +1875,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1473
1875
|
self.pos = _save
|
1474
1876
|
break
|
1475
1877
|
end
|
1476
|
-
@result = begin; block(c[:name], c[:ids], c[:classes], c[:args], content); end
|
1878
|
+
@result = begin; block(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], content, c[:ln]); end
|
1477
1879
|
_tmp = true
|
1478
1880
|
unless _tmp
|
1479
1881
|
self.pos = _save
|
@@ -1509,16 +1911,11 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1509
1911
|
return _tmp
|
1510
1912
|
end
|
1511
1913
|
|
1512
|
-
# PreformattedCommandHeadSimple =
|
1914
|
+
# PreformattedCommandHeadSimple = PreformattedCommand:command - "{" - Nl { command }
|
1513
1915
|
def _PreformattedCommandHeadSimple
|
1514
1916
|
|
1515
1917
|
_save = self.pos
|
1516
1918
|
while true # sequence
|
1517
|
-
_tmp = apply(:__hyphen_)
|
1518
|
-
unless _tmp
|
1519
|
-
self.pos = _save
|
1520
|
-
break
|
1521
|
-
end
|
1522
1919
|
_tmp = apply(:_PreformattedCommand)
|
1523
1920
|
command = @result
|
1524
1921
|
unless _tmp
|
@@ -1557,16 +1954,11 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1557
1954
|
return _tmp
|
1558
1955
|
end
|
1559
1956
|
|
1560
|
-
# PreformattedCommandHeadComplex =
|
1957
|
+
# PreformattedCommandHeadComplex = PreformattedCommand:command - "{//" Word?:codelanguage - Nl { command.merge({codelanguage: codelanguage}) }
|
1561
1958
|
def _PreformattedCommandHeadComplex
|
1562
1959
|
|
1563
1960
|
_save = self.pos
|
1564
1961
|
while true # sequence
|
1565
|
-
_tmp = apply(:__hyphen_)
|
1566
|
-
unless _tmp
|
1567
|
-
self.pos = _save
|
1568
|
-
break
|
1569
|
-
end
|
1570
1962
|
_tmp = apply(:_PreformattedCommand)
|
1571
1963
|
command = @result
|
1572
1964
|
unless _tmp
|
@@ -1715,11 +2107,16 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1715
2107
|
return _tmp
|
1716
2108
|
end
|
1717
2109
|
|
1718
|
-
# PreformattedBlockSimple = PreformattedCommandHeadSimple:c (!PreformatEndSimple CharString Nl)+:content PreformatEndSimple {preformatted_block(c[:name], c[:ids], c[:classes], c[:args], c[:codelanguage], content)}
|
2110
|
+
# PreformattedBlockSimple = - PreformattedCommandHeadSimple:c (!PreformatEndSimple CharString Nl)+:content PreformatEndSimple {preformatted_block(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], c[:codelanguage], content, c[:ln])}
|
1719
2111
|
def _PreformattedBlockSimple
|
1720
2112
|
|
1721
2113
|
_save = self.pos
|
1722
2114
|
while true # sequence
|
2115
|
+
_tmp = apply(:__hyphen_)
|
2116
|
+
unless _tmp
|
2117
|
+
self.pos = _save
|
2118
|
+
break
|
2119
|
+
end
|
1723
2120
|
_tmp = apply(:_PreformattedCommandHeadSimple)
|
1724
2121
|
c = @result
|
1725
2122
|
unless _tmp
|
@@ -1795,7 +2192,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1795
2192
|
self.pos = _save
|
1796
2193
|
break
|
1797
2194
|
end
|
1798
|
-
@result = begin; preformatted_block(c[:name], c[:ids], c[:classes], c[:args], c[:codelanguage], content); end
|
2195
|
+
@result = begin; preformatted_block(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], c[:codelanguage], content, c[:ln]); end
|
1799
2196
|
_tmp = true
|
1800
2197
|
unless _tmp
|
1801
2198
|
self.pos = _save
|
@@ -1807,11 +2204,16 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1807
2204
|
return _tmp
|
1808
2205
|
end
|
1809
2206
|
|
1810
|
-
# PreformattedBlockComplex = PreformattedCommandHeadComplex:c (!PreformatEndComplex CharString Nl)+:content PreformatEndComplex {preformatted_block(c[:name], c[:ids], c[:classes], c[:args], c[:codelanguage], content)}
|
2207
|
+
# PreformattedBlockComplex = - PreformattedCommandHeadComplex:c (!PreformatEndComplex CharString Nl)+:content PreformatEndComplex {preformatted_block(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], c[:codelanguage], content, c[:ln])}
|
1811
2208
|
def _PreformattedBlockComplex
|
1812
2209
|
|
1813
2210
|
_save = self.pos
|
1814
2211
|
while true # sequence
|
2212
|
+
_tmp = apply(:__hyphen_)
|
2213
|
+
unless _tmp
|
2214
|
+
self.pos = _save
|
2215
|
+
break
|
2216
|
+
end
|
1815
2217
|
_tmp = apply(:_PreformattedCommandHeadComplex)
|
1816
2218
|
c = @result
|
1817
2219
|
unless _tmp
|
@@ -1887,7 +2289,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1887
2289
|
self.pos = _save
|
1888
2290
|
break
|
1889
2291
|
end
|
1890
|
-
@result = begin; preformatted_block(c[:name], c[:ids], c[:classes], c[:args], c[:codelanguage], content); end
|
2292
|
+
@result = begin; preformatted_block(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], c[:codelanguage], content, c[:ln]); end
|
1891
2293
|
_tmp = true
|
1892
2294
|
unless _tmp
|
1893
2295
|
self.pos = _save
|
@@ -1935,7 +2337,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1935
2337
|
return _tmp
|
1936
2338
|
end
|
1937
2339
|
|
1938
|
-
# CommonInline = "[" Command:c "{" - DocumentContentExcept('}'):content "}" "]" {inline(c[:name], c[:ids], c[:classes], c[:args], content)}
|
2340
|
+
# CommonInline = "[" Command:c "{" - DocumentContentExcept('}'):content "}" "]" {inline(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], content, c[:ln])}
|
1939
2341
|
def _CommonInline
|
1940
2342
|
|
1941
2343
|
_save = self.pos
|
@@ -1977,7 +2379,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
1977
2379
|
self.pos = _save
|
1978
2380
|
break
|
1979
2381
|
end
|
1980
|
-
@result = begin; inline(c[:name], c[:ids], c[:classes], c[:args], content); end
|
2382
|
+
@result = begin; inline(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], content, c[:ln]); end
|
1981
2383
|
_tmp = true
|
1982
2384
|
unless _tmp
|
1983
2385
|
self.pos = _save
|
@@ -2013,7 +2415,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2013
2415
|
return _tmp
|
2014
2416
|
end
|
2015
2417
|
|
2016
|
-
# ImgInline = "[" ImgCommand:c "]" {inline(c[:name], c[:ids], c[:classes], c[:args], nil)}
|
2418
|
+
# ImgInline = "[" ImgCommand:c "]" {inline(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], nil, c[:ln])}
|
2017
2419
|
def _ImgInline
|
2018
2420
|
|
2019
2421
|
_save = self.pos
|
@@ -2034,7 +2436,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2034
2436
|
self.pos = _save
|
2035
2437
|
break
|
2036
2438
|
end
|
2037
|
-
@result = begin; inline(c[:name], c[:ids], c[:classes], c[:args], nil); end
|
2439
|
+
@result = begin; inline(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], nil, c[:ln]); end
|
2038
2440
|
_tmp = true
|
2039
2441
|
unless _tmp
|
2040
2442
|
self.pos = _save
|
@@ -2088,7 +2490,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2088
2490
|
return _tmp
|
2089
2491
|
end
|
2090
2492
|
|
2091
|
-
# Newpage = - NewpageCommand:c ":" - DocumentContent?:content - Nl {newpage(c[:ids],c[:classes],c[:args], content)}
|
2493
|
+
# Newpage = - NewpageCommand:c ":" - DocumentContent?:content - Nl {newpage(c[:ids],c[:classes],c[:args], c[:named_args], content, c[:ln])}
|
2092
2494
|
def _Newpage
|
2093
2495
|
|
2094
2496
|
_save = self.pos
|
@@ -2136,7 +2538,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2136
2538
|
self.pos = _save
|
2137
2539
|
break
|
2138
2540
|
end
|
2139
|
-
@result = begin; newpage(c[:ids],c[:classes],c[:args], content); end
|
2541
|
+
@result = begin; newpage(c[:ids],c[:classes],c[:args], c[:named_args], content, c[:ln]); end
|
2140
2542
|
_tmp = true
|
2141
2543
|
unless _tmp
|
2142
2544
|
self.pos = _save
|
@@ -2148,11 +2550,17 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2148
2550
|
return _tmp
|
2149
2551
|
end
|
2150
2552
|
|
2151
|
-
# UnorderedList = UnorderedItem+:items {unordered_list([],[],[], items)}
|
2553
|
+
# UnorderedList = ln:ln UnorderedItem+:items {unordered_list([],[],[],[], items, ln)}
|
2152
2554
|
def _UnorderedList
|
2153
2555
|
|
2154
2556
|
_save = self.pos
|
2155
2557
|
while true # sequence
|
2558
|
+
_tmp = apply(:_ln)
|
2559
|
+
ln = @result
|
2560
|
+
unless _tmp
|
2561
|
+
self.pos = _save
|
2562
|
+
break
|
2563
|
+
end
|
2156
2564
|
_save1 = self.pos
|
2157
2565
|
_ary = []
|
2158
2566
|
_tmp = apply(:_UnorderedItem)
|
@@ -2173,7 +2581,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2173
2581
|
self.pos = _save
|
2174
2582
|
break
|
2175
2583
|
end
|
2176
|
-
@result = begin; unordered_list([],[],[], items); end
|
2584
|
+
@result = begin; unordered_list([],[],[],[], items, ln); end
|
2177
2585
|
_tmp = true
|
2178
2586
|
unless _tmp
|
2179
2587
|
self.pos = _save
|
@@ -2185,11 +2593,17 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2185
2593
|
return _tmp
|
2186
2594
|
end
|
2187
2595
|
|
2188
|
-
# UnorderedItem = "*:" - DocumentContent:content Le {ul_item([], [], [], content)}
|
2596
|
+
# UnorderedItem = ln:ln "*:" - DocumentContent:content Le {ul_item([], [], [], [], content, ln)}
|
2189
2597
|
def _UnorderedItem
|
2190
2598
|
|
2191
2599
|
_save = self.pos
|
2192
2600
|
while true # sequence
|
2601
|
+
_tmp = apply(:_ln)
|
2602
|
+
ln = @result
|
2603
|
+
unless _tmp
|
2604
|
+
self.pos = _save
|
2605
|
+
break
|
2606
|
+
end
|
2193
2607
|
_tmp = match_string("*:")
|
2194
2608
|
unless _tmp
|
2195
2609
|
self.pos = _save
|
@@ -2211,7 +2625,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2211
2625
|
self.pos = _save
|
2212
2626
|
break
|
2213
2627
|
end
|
2214
|
-
@result = begin; ul_item([], [], [], content); end
|
2628
|
+
@result = begin; ul_item([], [], [], [], content, ln); end
|
2215
2629
|
_tmp = true
|
2216
2630
|
unless _tmp
|
2217
2631
|
self.pos = _save
|
@@ -2223,11 +2637,17 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2223
2637
|
return _tmp
|
2224
2638
|
end
|
2225
2639
|
|
2226
|
-
# OrderedList = OrderedItem+:items {ordered_list([],[],[], items)}
|
2640
|
+
# OrderedList = ln:ln OrderedItem+:items {ordered_list([],[],[], [], items, ln)}
|
2227
2641
|
def _OrderedList
|
2228
2642
|
|
2229
2643
|
_save = self.pos
|
2230
2644
|
while true # sequence
|
2645
|
+
_tmp = apply(:_ln)
|
2646
|
+
ln = @result
|
2647
|
+
unless _tmp
|
2648
|
+
self.pos = _save
|
2649
|
+
break
|
2650
|
+
end
|
2231
2651
|
_save1 = self.pos
|
2232
2652
|
_ary = []
|
2233
2653
|
_tmp = apply(:_OrderedItem)
|
@@ -2248,7 +2668,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2248
2668
|
self.pos = _save
|
2249
2669
|
break
|
2250
2670
|
end
|
2251
|
-
@result = begin; ordered_list([],[],[], items); end
|
2671
|
+
@result = begin; ordered_list([],[],[], [], items, ln); end
|
2252
2672
|
_tmp = true
|
2253
2673
|
unless _tmp
|
2254
2674
|
self.pos = _save
|
@@ -2260,11 +2680,17 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2260
2680
|
return _tmp
|
2261
2681
|
end
|
2262
2682
|
|
2263
|
-
# OrderedItem = Num ":" - DocumentContent:content Le {ol_item([], [], [], content)}
|
2683
|
+
# OrderedItem = ln:ln Num ":" - DocumentContent:content Le {ol_item([], [], [], [], content, ln)}
|
2264
2684
|
def _OrderedItem
|
2265
2685
|
|
2266
2686
|
_save = self.pos
|
2267
2687
|
while true # sequence
|
2688
|
+
_tmp = apply(:_ln)
|
2689
|
+
ln = @result
|
2690
|
+
unless _tmp
|
2691
|
+
self.pos = _save
|
2692
|
+
break
|
2693
|
+
end
|
2268
2694
|
_tmp = apply(:_Num)
|
2269
2695
|
unless _tmp
|
2270
2696
|
self.pos = _save
|
@@ -2291,7 +2717,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2291
2717
|
self.pos = _save
|
2292
2718
|
break
|
2293
2719
|
end
|
2294
|
-
@result = begin; ol_item([], [], [], content); end
|
2720
|
+
@result = begin; ol_item([], [], [], [], content, ln); end
|
2295
2721
|
_tmp = true
|
2296
2722
|
unless _tmp
|
2297
2723
|
self.pos = _save
|
@@ -2303,11 +2729,17 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2303
2729
|
return _tmp
|
2304
2730
|
end
|
2305
2731
|
|
2306
|
-
# DefinitionList = DefinitionItem+:items {definition_list([], [], [], items)}
|
2732
|
+
# DefinitionList = ln:ln DefinitionItem+:items {definition_list([], [], [], [], items, ln)}
|
2307
2733
|
def _DefinitionList
|
2308
2734
|
|
2309
2735
|
_save = self.pos
|
2310
2736
|
while true # sequence
|
2737
|
+
_tmp = apply(:_ln)
|
2738
|
+
ln = @result
|
2739
|
+
unless _tmp
|
2740
|
+
self.pos = _save
|
2741
|
+
break
|
2742
|
+
end
|
2311
2743
|
_save1 = self.pos
|
2312
2744
|
_ary = []
|
2313
2745
|
_tmp = apply(:_DefinitionItem)
|
@@ -2328,7 +2760,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2328
2760
|
self.pos = _save
|
2329
2761
|
break
|
2330
2762
|
end
|
2331
|
-
@result = begin; definition_list([], [], [], items); end
|
2763
|
+
@result = begin; definition_list([], [], [], [], items, ln); end
|
2332
2764
|
_tmp = true
|
2333
2765
|
unless _tmp
|
2334
2766
|
self.pos = _save
|
@@ -2340,7 +2772,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2340
2772
|
return _tmp
|
2341
2773
|
end
|
2342
2774
|
|
2343
|
-
# DefinitionItem = - ";:" - DocumentContentExcept(':'):term ":" - DocumentContent:definition Le {dl_item([], [], [term], definition)}
|
2775
|
+
# DefinitionItem = - ln:ln ";:" - DocumentContentExcept(':'):term ":" - DocumentContent:definition Le {dl_item([], [], [term], [], definition, ln)}
|
2344
2776
|
def _DefinitionItem
|
2345
2777
|
|
2346
2778
|
_save = self.pos
|
@@ -2350,6 +2782,12 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2350
2782
|
self.pos = _save
|
2351
2783
|
break
|
2352
2784
|
end
|
2785
|
+
_tmp = apply(:_ln)
|
2786
|
+
ln = @result
|
2787
|
+
unless _tmp
|
2788
|
+
self.pos = _save
|
2789
|
+
break
|
2790
|
+
end
|
2353
2791
|
_tmp = match_string(";:")
|
2354
2792
|
unless _tmp
|
2355
2793
|
self.pos = _save
|
@@ -2387,7 +2825,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2387
2825
|
self.pos = _save
|
2388
2826
|
break
|
2389
2827
|
end
|
2390
|
-
@result = begin; dl_item([], [], [term], definition); end
|
2828
|
+
@result = begin; dl_item([], [], [term], [], definition, ln); end
|
2391
2829
|
_tmp = true
|
2392
2830
|
unless _tmp
|
2393
2831
|
self.pos = _save
|
@@ -2399,11 +2837,17 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2399
2837
|
return _tmp
|
2400
2838
|
end
|
2401
2839
|
|
2402
|
-
# LongDefinitionList = LongDefinitionItem+:items {definition_list([], [], [], items)}
|
2840
|
+
# LongDefinitionList = ln:ln LongDefinitionItem+:items {definition_list([], [], [], [], items, ln)}
|
2403
2841
|
def _LongDefinitionList
|
2404
2842
|
|
2405
2843
|
_save = self.pos
|
2406
2844
|
while true # sequence
|
2845
|
+
_tmp = apply(:_ln)
|
2846
|
+
ln = @result
|
2847
|
+
unless _tmp
|
2848
|
+
self.pos = _save
|
2849
|
+
break
|
2850
|
+
end
|
2407
2851
|
_save1 = self.pos
|
2408
2852
|
_ary = []
|
2409
2853
|
_tmp = apply(:_LongDefinitionItem)
|
@@ -2424,7 +2868,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2424
2868
|
self.pos = _save
|
2425
2869
|
break
|
2426
2870
|
end
|
2427
|
-
@result = begin; definition_list([], [], [], items); end
|
2871
|
+
@result = begin; definition_list([], [], [], [], items, ln); end
|
2428
2872
|
_tmp = true
|
2429
2873
|
unless _tmp
|
2430
2874
|
self.pos = _save
|
@@ -2436,7 +2880,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2436
2880
|
return _tmp
|
2437
2881
|
end
|
2438
2882
|
|
2439
|
-
# LongDefinitionItem = - ";:" - DocumentContentExcept('{'):term "{" - Nl - BlockBody:definition - BlockEnd {dl_item([], [], [term], definition)}
|
2883
|
+
# LongDefinitionItem = - ln:ln ";:" - DocumentContentExcept('{'):term "{" - Nl - BlockBody:definition - BlockEnd {dl_item([], [], [term], [], definition, ln)}
|
2440
2884
|
def _LongDefinitionItem
|
2441
2885
|
|
2442
2886
|
_save = self.pos
|
@@ -2446,6 +2890,12 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2446
2890
|
self.pos = _save
|
2447
2891
|
break
|
2448
2892
|
end
|
2893
|
+
_tmp = apply(:_ln)
|
2894
|
+
ln = @result
|
2895
|
+
unless _tmp
|
2896
|
+
self.pos = _save
|
2897
|
+
break
|
2898
|
+
end
|
2449
2899
|
_tmp = match_string(";:")
|
2450
2900
|
unless _tmp
|
2451
2901
|
self.pos = _save
|
@@ -2498,7 +2948,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2498
2948
|
self.pos = _save
|
2499
2949
|
break
|
2500
2950
|
end
|
2501
|
-
@result = begin; dl_item([], [], [term], definition); end
|
2951
|
+
@result = begin; dl_item([], [], [term], [], definition, ln); end
|
2502
2952
|
_tmp = true
|
2503
2953
|
unless _tmp
|
2504
2954
|
self.pos = _save
|
@@ -2534,7 +2984,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2534
2984
|
return _tmp
|
2535
2985
|
end
|
2536
2986
|
|
2537
|
-
# LineCommand = - !CommandNameForSpecialLineCommand Command:c ":" - DocumentContent?:content - Le EmptyLine* {
|
2987
|
+
# LineCommand = - !CommandNameForSpecialLineCommand Command:c ":" - DocumentContent?:content - Le EmptyLine* {block(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], content, c[:ln])}
|
2538
2988
|
def _LineCommand
|
2539
2989
|
|
2540
2990
|
_save = self.pos
|
@@ -2599,7 +3049,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2599
3049
|
self.pos = _save
|
2600
3050
|
break
|
2601
3051
|
end
|
2602
|
-
@result = begin;
|
3052
|
+
@result = begin; block(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], content, c[:ln]); end
|
2603
3053
|
_tmp = true
|
2604
3054
|
unless _tmp
|
2605
3055
|
self.pos = _save
|
@@ -2629,38 +3079,29 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2629
3079
|
return _tmp
|
2630
3080
|
end
|
2631
3081
|
|
2632
|
-
# Block =
|
3082
|
+
# Block = (PreformattedBlock | HeadedSection | LineBlock | ExplicitBlock | ParagraphGroup):block EmptyLine* {block}
|
2633
3083
|
def _Block
|
2634
3084
|
|
2635
3085
|
_save = self.pos
|
2636
3086
|
while true # sequence
|
2637
|
-
while true
|
2638
|
-
_tmp = apply(:_EmptyLine)
|
2639
|
-
break unless _tmp
|
2640
|
-
end
|
2641
|
-
_tmp = true
|
2642
|
-
unless _tmp
|
2643
|
-
self.pos = _save
|
2644
|
-
break
|
2645
|
-
end
|
2646
3087
|
|
2647
|
-
|
3088
|
+
_save1 = self.pos
|
2648
3089
|
while true # choice
|
2649
3090
|
_tmp = apply(:_PreformattedBlock)
|
2650
3091
|
break if _tmp
|
2651
|
-
self.pos =
|
3092
|
+
self.pos = _save1
|
2652
3093
|
_tmp = apply(:_HeadedSection)
|
2653
3094
|
break if _tmp
|
2654
|
-
self.pos =
|
3095
|
+
self.pos = _save1
|
2655
3096
|
_tmp = apply(:_LineBlock)
|
2656
3097
|
break if _tmp
|
2657
|
-
self.pos =
|
3098
|
+
self.pos = _save1
|
2658
3099
|
_tmp = apply(:_ExplicitBlock)
|
2659
3100
|
break if _tmp
|
2660
|
-
self.pos =
|
3101
|
+
self.pos = _save1
|
2661
3102
|
_tmp = apply(:_ParagraphGroup)
|
2662
3103
|
break if _tmp
|
2663
|
-
self.pos =
|
3104
|
+
self.pos = _save1
|
2664
3105
|
break
|
2665
3106
|
end # end choice
|
2666
3107
|
|
@@ -2786,63 +3227,88 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2786
3227
|
return _tmp
|
2787
3228
|
end
|
2788
3229
|
|
2789
|
-
# HMarkupTerminator = - < "="+ ":" > &{ text.length - 1 <= n }
|
3230
|
+
# HMarkupTerminator = (- < "="+ ":" > &{ text.length - 1 <= n } | - Eof)
|
2790
3231
|
def _HMarkupTerminator(n)
|
2791
3232
|
|
2792
3233
|
_save = self.pos
|
2793
|
-
while true #
|
2794
|
-
_tmp = apply(:__hyphen_)
|
2795
|
-
unless _tmp
|
2796
|
-
self.pos = _save
|
2797
|
-
break
|
2798
|
-
end
|
2799
|
-
_text_start = self.pos
|
3234
|
+
while true # choice
|
2800
3235
|
|
2801
3236
|
_save1 = self.pos
|
2802
3237
|
while true # sequence
|
3238
|
+
_tmp = apply(:__hyphen_)
|
3239
|
+
unless _tmp
|
3240
|
+
self.pos = _save1
|
3241
|
+
break
|
3242
|
+
end
|
3243
|
+
_text_start = self.pos
|
3244
|
+
|
2803
3245
|
_save2 = self.pos
|
2804
|
-
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
|
3246
|
+
while true # sequence
|
3247
|
+
_save3 = self.pos
|
3248
|
+
_tmp = match_string("=")
|
3249
|
+
if _tmp
|
3250
|
+
while true
|
3251
|
+
_tmp = match_string("=")
|
3252
|
+
break unless _tmp
|
3253
|
+
end
|
3254
|
+
_tmp = true
|
3255
|
+
else
|
3256
|
+
self.pos = _save3
|
2809
3257
|
end
|
2810
|
-
_tmp
|
2811
|
-
|
2812
|
-
|
3258
|
+
unless _tmp
|
3259
|
+
self.pos = _save2
|
3260
|
+
break
|
3261
|
+
end
|
3262
|
+
_tmp = match_string(":")
|
3263
|
+
unless _tmp
|
3264
|
+
self.pos = _save2
|
3265
|
+
end
|
3266
|
+
break
|
3267
|
+
end # end sequence
|
3268
|
+
|
3269
|
+
if _tmp
|
3270
|
+
text = get_text(_text_start)
|
2813
3271
|
end
|
2814
3272
|
unless _tmp
|
2815
3273
|
self.pos = _save1
|
2816
3274
|
break
|
2817
3275
|
end
|
2818
|
-
|
3276
|
+
_save4 = self.pos
|
3277
|
+
_tmp = begin; text.length - 1 <= n ; end
|
3278
|
+
self.pos = _save4
|
2819
3279
|
unless _tmp
|
2820
3280
|
self.pos = _save1
|
2821
3281
|
end
|
2822
3282
|
break
|
2823
3283
|
end # end sequence
|
2824
3284
|
|
2825
|
-
if _tmp
|
2826
|
-
|
2827
|
-
|
2828
|
-
|
2829
|
-
|
3285
|
+
break if _tmp
|
3286
|
+
self.pos = _save
|
3287
|
+
|
3288
|
+
_save5 = self.pos
|
3289
|
+
while true # sequence
|
3290
|
+
_tmp = apply(:__hyphen_)
|
3291
|
+
unless _tmp
|
3292
|
+
self.pos = _save5
|
3293
|
+
break
|
3294
|
+
end
|
3295
|
+
_tmp = apply(:_Eof)
|
3296
|
+
unless _tmp
|
3297
|
+
self.pos = _save5
|
3298
|
+
end
|
2830
3299
|
break
|
2831
|
-
end
|
2832
|
-
|
2833
|
-
|
2834
|
-
self.pos =
|
2835
|
-
unless _tmp
|
2836
|
-
self.pos = _save
|
2837
|
-
end
|
3300
|
+
end # end sequence
|
3301
|
+
|
3302
|
+
break if _tmp
|
3303
|
+
self.pos = _save
|
2838
3304
|
break
|
2839
|
-
end # end
|
3305
|
+
end # end choice
|
2840
3306
|
|
2841
3307
|
set_failed_rule :_HMarkupTerminator unless _tmp
|
2842
3308
|
return _tmp
|
2843
3309
|
end
|
2844
3310
|
|
2845
|
-
# HStart = - HStartMark(n) - DocumentContent:s Le { { level: n, heading: s } }
|
3311
|
+
# HStart = - HStartMark(n) ln:ln - DocumentContent:s Le { { level: n, heading: s, ln: ln} }
|
2846
3312
|
def _HStart(n)
|
2847
3313
|
|
2848
3314
|
_save = self.pos
|
@@ -2857,6 +3323,12 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2857
3323
|
self.pos = _save
|
2858
3324
|
break
|
2859
3325
|
end
|
3326
|
+
_tmp = apply(:_ln)
|
3327
|
+
ln = @result
|
3328
|
+
unless _tmp
|
3329
|
+
self.pos = _save
|
3330
|
+
break
|
3331
|
+
end
|
2860
3332
|
_tmp = apply(:__hyphen_)
|
2861
3333
|
unless _tmp
|
2862
3334
|
self.pos = _save
|
@@ -2873,7 +3345,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2873
3345
|
self.pos = _save
|
2874
3346
|
break
|
2875
3347
|
end
|
2876
|
-
@result = begin; { level: n, heading: s } ; end
|
3348
|
+
@result = begin; { level: n, heading: s, ln: ln} ; end
|
2877
3349
|
_tmp = true
|
2878
3350
|
unless _tmp
|
2879
3351
|
self.pos = _save
|
@@ -2885,7 +3357,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2885
3357
|
return _tmp
|
2886
3358
|
end
|
2887
3359
|
|
2888
|
-
# HSection = HStart(n):h (!HMarkupTerminator(n)
|
3360
|
+
# HSection = HStart(n):h EmptyLine* (!HMarkupTerminator(n) Block)*:content EmptyLine* {h_section(h[:level], h[:heading], content, h[:ln])}
|
2889
3361
|
def _HSection(n)
|
2890
3362
|
|
2891
3363
|
_save = self.pos
|
@@ -2896,30 +3368,31 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2896
3368
|
self.pos = _save
|
2897
3369
|
break
|
2898
3370
|
end
|
3371
|
+
while true
|
3372
|
+
_tmp = apply(:_EmptyLine)
|
3373
|
+
break unless _tmp
|
3374
|
+
end
|
3375
|
+
_tmp = true
|
3376
|
+
unless _tmp
|
3377
|
+
self.pos = _save
|
3378
|
+
break
|
3379
|
+
end
|
2899
3380
|
_ary = []
|
2900
3381
|
while true
|
2901
3382
|
|
2902
|
-
|
3383
|
+
_save3 = self.pos
|
2903
3384
|
while true # sequence
|
2904
|
-
_save3 = self.pos
|
2905
|
-
_tmp = apply_with_args(:_HMarkupTerminator, n)
|
2906
|
-
_tmp = _tmp ? nil : true
|
2907
|
-
self.pos = _save3
|
2908
|
-
unless _tmp
|
2909
|
-
self.pos = _save2
|
2910
|
-
break
|
2911
|
-
end
|
2912
3385
|
_save4 = self.pos
|
2913
|
-
_tmp =
|
3386
|
+
_tmp = apply_with_args(:_HMarkupTerminator, n)
|
2914
3387
|
_tmp = _tmp ? nil : true
|
2915
3388
|
self.pos = _save4
|
2916
3389
|
unless _tmp
|
2917
|
-
self.pos =
|
3390
|
+
self.pos = _save3
|
2918
3391
|
break
|
2919
3392
|
end
|
2920
3393
|
_tmp = apply(:_Block)
|
2921
3394
|
unless _tmp
|
2922
|
-
self.pos =
|
3395
|
+
self.pos = _save3
|
2923
3396
|
end
|
2924
3397
|
break
|
2925
3398
|
end # end sequence
|
@@ -2934,7 +3407,16 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
2934
3407
|
self.pos = _save
|
2935
3408
|
break
|
2936
3409
|
end
|
2937
|
-
|
3410
|
+
while true
|
3411
|
+
_tmp = apply(:_EmptyLine)
|
3412
|
+
break unless _tmp
|
3413
|
+
end
|
3414
|
+
_tmp = true
|
3415
|
+
unless _tmp
|
3416
|
+
self.pos = _save
|
3417
|
+
break
|
3418
|
+
end
|
3419
|
+
@result = begin; h_section(h[:level], h[:heading], content, h[:ln]); end
|
2938
3420
|
_tmp = true
|
2939
3421
|
unless _tmp
|
2940
3422
|
self.pos = _save
|
@@ -3037,7 +3519,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
3037
3519
|
return _tmp
|
3038
3520
|
end
|
3039
3521
|
|
3040
|
-
# Frontmatter = FrontmatterSeparator (!FrontmatterSeparator CharString Nl)+:yaml FrontmatterSeparator EmptyLine* {frontmatter(yaml)}
|
3522
|
+
# Frontmatter = FrontmatterSeparator ln:ln (!FrontmatterSeparator CharString Nl)+:yaml FrontmatterSeparator EmptyLine* {frontmatter(yaml, ln)}
|
3041
3523
|
def _Frontmatter
|
3042
3524
|
|
3043
3525
|
_save = self.pos
|
@@ -3047,6 +3529,12 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
3047
3529
|
self.pos = _save
|
3048
3530
|
break
|
3049
3531
|
end
|
3532
|
+
_tmp = apply(:_ln)
|
3533
|
+
ln = @result
|
3534
|
+
unless _tmp
|
3535
|
+
self.pos = _save
|
3536
|
+
break
|
3537
|
+
end
|
3050
3538
|
_save1 = self.pos
|
3051
3539
|
_ary = []
|
3052
3540
|
|
@@ -3125,7 +3613,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
3125
3613
|
self.pos = _save
|
3126
3614
|
break
|
3127
3615
|
end
|
3128
|
-
@result = begin; frontmatter(yaml); end
|
3616
|
+
@result = begin; frontmatter(yaml, ln); end
|
3129
3617
|
_tmp = true
|
3130
3618
|
unless _tmp
|
3131
3619
|
self.pos = _save
|
@@ -3217,7 +3705,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
3217
3705
|
return _tmp
|
3218
3706
|
end
|
3219
3707
|
|
3220
|
-
# DocumentTextExcept = < (!Inline CharExcept(e))+ > {text(text)}
|
3708
|
+
# DocumentTextExcept = < (!Inline CharExcept(e))+ > ln:ln {text(text, ln)}
|
3221
3709
|
def _DocumentTextExcept(e)
|
3222
3710
|
|
3223
3711
|
_save = self.pos
|
@@ -3275,7 +3763,13 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
3275
3763
|
self.pos = _save
|
3276
3764
|
break
|
3277
3765
|
end
|
3278
|
-
|
3766
|
+
_tmp = apply(:_ln)
|
3767
|
+
ln = @result
|
3768
|
+
unless _tmp
|
3769
|
+
self.pos = _save
|
3770
|
+
break
|
3771
|
+
end
|
3772
|
+
@result = begin; text(text, ln); end
|
3279
3773
|
_tmp = true
|
3280
3774
|
unless _tmp
|
3281
3775
|
self.pos = _save
|
@@ -3346,7 +3840,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
3346
3840
|
return _tmp
|
3347
3841
|
end
|
3348
3842
|
|
3349
|
-
# DocumentText = < (!Inline Char)+ > {text(text)}
|
3843
|
+
# DocumentText = < (!Inline Char)+ > ln:ln {text(text, ln)}
|
3350
3844
|
def _DocumentText
|
3351
3845
|
|
3352
3846
|
_save = self.pos
|
@@ -3404,7 +3898,13 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
3404
3898
|
self.pos = _save
|
3405
3899
|
break
|
3406
3900
|
end
|
3407
|
-
|
3901
|
+
_tmp = apply(:_ln)
|
3902
|
+
ln = @result
|
3903
|
+
unless _tmp
|
3904
|
+
self.pos = _save
|
3905
|
+
break
|
3906
|
+
end
|
3907
|
+
@result = begin; text(text, ln); end
|
3408
3908
|
_tmp = true
|
3409
3909
|
unless _tmp
|
3410
3910
|
self.pos = _save
|
@@ -3503,7 +4003,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
3503
4003
|
return _tmp
|
3504
4004
|
end
|
3505
4005
|
|
3506
|
-
# Page = Frontmatter?:frontmatter - (!Newpage Block)*:blocks {page(([frontmatter] + blocks).select{ |x| !x.nil?})}
|
4006
|
+
# Page = Frontmatter?:frontmatter - (!Newpage Block)*:blocks EmptyLine* {page(([frontmatter] + blocks).select{ |x| !x.nil?}, 1)}
|
3507
4007
|
def _Page
|
3508
4008
|
|
3509
4009
|
_save = self.pos
|
@@ -3555,7 +4055,16 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
3555
4055
|
self.pos = _save
|
3556
4056
|
break
|
3557
4057
|
end
|
3558
|
-
|
4058
|
+
while true
|
4059
|
+
_tmp = apply(:_EmptyLine)
|
4060
|
+
break unless _tmp
|
4061
|
+
end
|
4062
|
+
_tmp = true
|
4063
|
+
unless _tmp
|
4064
|
+
self.pos = _save
|
4065
|
+
break
|
4066
|
+
end
|
4067
|
+
@result = begin; page(([frontmatter] + blocks).select{ |x| !x.nil?}, 1); end
|
3559
4068
|
_tmp = true
|
3560
4069
|
unless _tmp
|
3561
4070
|
self.pos = _save
|
@@ -3629,7 +4138,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
3629
4138
|
return _tmp
|
3630
4139
|
end
|
3631
4140
|
|
3632
|
-
# root = BOM? Pages:pages
|
4141
|
+
# root = BOM? EmptyLine* Pages:pages EofComment? Eof {root(pages)}
|
3633
4142
|
def _root
|
3634
4143
|
|
3635
4144
|
_save = self.pos
|
@@ -3644,22 +4153,26 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
3644
4153
|
self.pos = _save
|
3645
4154
|
break
|
3646
4155
|
end
|
3647
|
-
|
3648
|
-
|
4156
|
+
while true
|
4157
|
+
_tmp = apply(:_EmptyLine)
|
4158
|
+
break unless _tmp
|
4159
|
+
end
|
4160
|
+
_tmp = true
|
3649
4161
|
unless _tmp
|
3650
4162
|
self.pos = _save
|
3651
4163
|
break
|
3652
4164
|
end
|
3653
|
-
_tmp = apply(:
|
4165
|
+
_tmp = apply(:_Pages)
|
4166
|
+
pages = @result
|
3654
4167
|
unless _tmp
|
3655
4168
|
self.pos = _save
|
3656
4169
|
break
|
3657
4170
|
end
|
3658
|
-
|
4171
|
+
_save3 = self.pos
|
3659
4172
|
_tmp = apply(:_EofComment)
|
3660
4173
|
unless _tmp
|
3661
4174
|
_tmp = true
|
3662
|
-
self.pos =
|
4175
|
+
self.pos = _save3
|
3663
4176
|
end
|
3664
4177
|
unless _tmp
|
3665
4178
|
self.pos = _save
|
@@ -3670,7 +4183,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
3670
4183
|
self.pos = _save
|
3671
4184
|
break
|
3672
4185
|
end
|
3673
|
-
@result = begin;
|
4186
|
+
@result = begin; root(pages); end
|
3674
4187
|
_tmp = true
|
3675
4188
|
unless _tmp
|
3676
4189
|
self.pos = _save
|
@@ -3683,6 +4196,7 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
3683
4196
|
end
|
3684
4197
|
|
3685
4198
|
Rules = {}
|
4199
|
+
Rules[:_ln] = rule_info("ln", "{ current_line }")
|
3686
4200
|
Rules[:_BOM] = rule_info("BOM", "/\\uFEFF/")
|
3687
4201
|
Rules[:_Eof] = rule_info("Eof", "!.")
|
3688
4202
|
Rules[:_Space] = rule_info("Space", "(\" \" | \"\\\\t\")")
|
@@ -3698,70 +4212,76 @@ class NoraMark::Parser < KPeg::CompiledParser
|
|
3698
4212
|
Rules[:_ClassNames] = rule_info("ClassNames", "ClassName*:classnames { classnames }")
|
3699
4213
|
Rules[:_IdName] = rule_info("IdName", "\"\#\" Word:idname { idname }")
|
3700
4214
|
Rules[:_IdNames] = rule_info("IdNames", "IdName*:idnames { idnames }")
|
3701
|
-
Rules[:_CommandName] = rule_info("CommandName", "Word:name IdNames?:idnames ClassNames?:classes { {name: name, ids: idnames, classes: classes} }")
|
4215
|
+
Rules[:_CommandName] = rule_info("CommandName", "Word:name IdNames?:idnames ClassNames?:classes ln:ln { {name: name, ids: idnames, classes: classes, ln:ln } }")
|
3702
4216
|
Rules[:_ParameterNormal] = rule_info("ParameterNormal", "< /[^,)]/* > { text }")
|
3703
4217
|
Rules[:_ParameterQuoted] = rule_info("ParameterQuoted", "\"\\\"\" < /[^\"]/* > \"\\\"\" - &/[,)]/ { text }")
|
3704
4218
|
Rules[:_ParameterSingleQuoted] = rule_info("ParameterSingleQuoted", "\"'\" < /[^']/* > \"'\" - &/[,)]/ { text }")
|
3705
4219
|
Rules[:_Parameter] = rule_info("Parameter", "(ParameterQuoted | ParameterSingleQuoted | ParameterNormal):value { value }")
|
4220
|
+
Rules[:_NParameterNormal] = rule_info("NParameterNormal", "< /[^,\\]]/* > { text }")
|
4221
|
+
Rules[:_NParameterQuoted] = rule_info("NParameterQuoted", "\"\\\"\" < /[^\"]/* > \"\\\"\" - &/[,\\]]/ { text }")
|
4222
|
+
Rules[:_NParameterSingleQuoted] = rule_info("NParameterSingleQuoted", "\"'\" < /[^']/* > \"'\" - &/[,\\]]/ { text }")
|
4223
|
+
Rules[:_NParameter] = rule_info("NParameter", "(NParameterQuoted | NParameterSingleQuoted | NParameterNormal):value { value }")
|
3706
4224
|
Rules[:_Parameters] = rule_info("Parameters", "(Parameter:parameter \",\" - Parameters:parameters { [ parameter ] + parameters } | Parameter:parameter { [ parameter ] })")
|
3707
|
-
Rules[:
|
3708
|
-
Rules[:
|
4225
|
+
Rules[:_NamedParameter] = rule_info("NamedParameter", "Word:key - \":\" - NParameter:parameter { { key.to_sym => parameter } }")
|
4226
|
+
Rules[:_NamedParameters] = rule_info("NamedParameters", "(NamedParameter:parameter - \",\" - NamedParameters:parameters { parameter.merge parameters } | NamedParameter:parameter { parameter })")
|
4227
|
+
Rules[:_Command] = rule_info("Command", "CommandName:cn (\"(\" - Parameters:args - \")\")? (\"[\" - NamedParameters:named_args - \"]\")? { cn.merge({ args: args || [] , named_args: named_args || {}}) }")
|
4228
|
+
Rules[:_ImplicitParagraph] = rule_info("ImplicitParagraph", "- !ParagraphDelimiter Comment* DocumentLine:content ln:ln Comment* EofComment? {paragraph([],[], [], [], content, ln)}")
|
3709
4229
|
Rules[:_ExplicitParagraphCommand] = rule_info("ExplicitParagraphCommand", "Command:c &{ c[:name] == 'p' }")
|
3710
|
-
Rules[:_ExplicitParagraph] = rule_info("ExplicitParagraph", "- ExplicitParagraphCommand:c \":\" - DocumentContent?:content Le EmptyLine* {paragraph(c[:ids], c[:classes], c[:args], content)}")
|
4230
|
+
Rules[:_ExplicitParagraph] = rule_info("ExplicitParagraph", "- ExplicitParagraphCommand:c \":\" - DocumentContent?:content Le EmptyLine* {paragraph(c[:ids], c[:classes], c[:args], c[:named_args], content, c[:ln])}")
|
3711
4231
|
Rules[:_Paragraph] = rule_info("Paragraph", "(ExplicitParagraph | ImplicitParagraph)")
|
3712
|
-
Rules[:_ParagraphGroup] = rule_info("ParagraphGroup", "Paragraph+:p EmptyLine* {paragraph_group([],[],[],p)}")
|
3713
|
-
Rules[:_BlockHead] = rule_info("BlockHead", "
|
4232
|
+
Rules[:_ParagraphGroup] = rule_info("ParagraphGroup", "ln:ln Paragraph+:p EmptyLine* {paragraph_group([],[],[],[],p, ln)}")
|
4233
|
+
Rules[:_BlockHead] = rule_info("BlockHead", "Command:command - \"{\" - Nl EmptyLine* { command }")
|
3714
4234
|
Rules[:_BlockEnd] = rule_info("BlockEnd", "- \"}\" - Le EmptyLine*")
|
3715
4235
|
Rules[:_BlockBody] = rule_info("BlockBody", "(!BlockEnd Block)+:body { body }")
|
3716
|
-
Rules[:_ExplicitBlock] = rule_info("ExplicitBlock", "BlockHead:c - BlockBody:content - BlockEnd {block(c[:name], c[:ids], c[:classes], c[:args], content)}")
|
4236
|
+
Rules[:_ExplicitBlock] = rule_info("ExplicitBlock", "- BlockHead:c - BlockBody:content - BlockEnd {block(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], content, c[:ln])}")
|
3717
4237
|
Rules[:_PreformattedCommand] = rule_info("PreformattedCommand", "Command:command &{ ['pre', 'code'].include? command[:name] }")
|
3718
|
-
Rules[:_PreformattedCommandHeadSimple] = rule_info("PreformattedCommandHeadSimple", "
|
3719
|
-
Rules[:_PreformattedCommandHeadComplex] = rule_info("PreformattedCommandHeadComplex", "
|
4238
|
+
Rules[:_PreformattedCommandHeadSimple] = rule_info("PreformattedCommandHeadSimple", "PreformattedCommand:command - \"{\" - Nl { command }")
|
4239
|
+
Rules[:_PreformattedCommandHeadComplex] = rule_info("PreformattedCommandHeadComplex", "PreformattedCommand:command - \"{//\" Word?:codelanguage - Nl { command.merge({codelanguage: codelanguage}) }")
|
3720
4240
|
Rules[:_PreformattedCommandHead] = rule_info("PreformattedCommandHead", "(PreformattedCommandHeadComplex | PreformattedCommandHeadSimple)")
|
3721
4241
|
Rules[:_PreformatEndSimple] = rule_info("PreformatEndSimple", "- \"}\" - Le EmptyLine*")
|
3722
4242
|
Rules[:_PreformatEndComplex] = rule_info("PreformatEndComplex", "- \"//}\" - Le EmptyLine*")
|
3723
|
-
Rules[:_PreformattedBlockSimple] = rule_info("PreformattedBlockSimple", "PreformattedCommandHeadSimple:c (!PreformatEndSimple CharString Nl)+:content PreformatEndSimple {preformatted_block(c[:name], c[:ids], c[:classes], c[:args], c[:codelanguage], content)}")
|
3724
|
-
Rules[:_PreformattedBlockComplex] = rule_info("PreformattedBlockComplex", "PreformattedCommandHeadComplex:c (!PreformatEndComplex CharString Nl)+:content PreformatEndComplex {preformatted_block(c[:name], c[:ids], c[:classes], c[:args], c[:codelanguage], content)}")
|
4243
|
+
Rules[:_PreformattedBlockSimple] = rule_info("PreformattedBlockSimple", "- PreformattedCommandHeadSimple:c (!PreformatEndSimple CharString Nl)+:content PreformatEndSimple {preformatted_block(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], c[:codelanguage], content, c[:ln])}")
|
4244
|
+
Rules[:_PreformattedBlockComplex] = rule_info("PreformattedBlockComplex", "- PreformattedCommandHeadComplex:c (!PreformatEndComplex CharString Nl)+:content PreformatEndComplex {preformatted_block(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], c[:codelanguage], content, c[:ln])}")
|
3725
4245
|
Rules[:_PreformattedBlock] = rule_info("PreformattedBlock", "(PreformattedBlockComplex | PreformattedBlockSimple)")
|
3726
4246
|
Rules[:_Inline] = rule_info("Inline", "(ImgInline | CommonInline)")
|
3727
|
-
Rules[:_CommonInline] = rule_info("CommonInline", "\"[\" Command:c \"{\" - DocumentContentExcept('}'):content \"}\" \"]\" {inline(c[:name], c[:ids], c[:classes], c[:args], content)}")
|
4247
|
+
Rules[:_CommonInline] = rule_info("CommonInline", "\"[\" Command:c \"{\" - DocumentContentExcept('}'):content \"}\" \"]\" {inline(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], content, c[:ln])}")
|
3728
4248
|
Rules[:_ImgCommand] = rule_info("ImgCommand", "Command:c &{ c[:name] == 'img' && c[:args].size == 2}")
|
3729
|
-
Rules[:_ImgInline] = rule_info("ImgInline", "\"[\" ImgCommand:c \"]\" {inline(c[:name], c[:ids], c[:classes], c[:args], nil)}")
|
4249
|
+
Rules[:_ImgInline] = rule_info("ImgInline", "\"[\" ImgCommand:c \"]\" {inline(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], nil, c[:ln])}")
|
3730
4250
|
Rules[:_CommandNameForSpecialLineCommand] = rule_info("CommandNameForSpecialLineCommand", "(NewpageCommand | ExplicitParagraphCommand)")
|
3731
4251
|
Rules[:_NewpageCommand] = rule_info("NewpageCommand", "Command:command &{ command[:name] == 'newpage' }")
|
3732
|
-
Rules[:_Newpage] = rule_info("Newpage", "- NewpageCommand:c \":\" - DocumentContent?:content - Nl {newpage(c[:ids],c[:classes],c[:args], content)}")
|
3733
|
-
Rules[:_UnorderedList] = rule_info("UnorderedList", "UnorderedItem+:items {unordered_list([],[],[], items)}")
|
3734
|
-
Rules[:_UnorderedItem] = rule_info("UnorderedItem", "\"*:\" - DocumentContent:content Le {ul_item([], [], [], content)}")
|
3735
|
-
Rules[:_OrderedList] = rule_info("OrderedList", "OrderedItem+:items {ordered_list([],[],[], items)}")
|
3736
|
-
Rules[:_OrderedItem] = rule_info("OrderedItem", "Num \":\" - DocumentContent:content Le {ol_item([], [], [], content)}")
|
3737
|
-
Rules[:_DefinitionList] = rule_info("DefinitionList", "DefinitionItem+:items {definition_list([], [], [], items)}")
|
3738
|
-
Rules[:_DefinitionItem] = rule_info("DefinitionItem", "- \";:\" - DocumentContentExcept(':'):term \":\" - DocumentContent:definition Le {dl_item([], [], [term], definition)}")
|
3739
|
-
Rules[:_LongDefinitionList] = rule_info("LongDefinitionList", "LongDefinitionItem+:items {definition_list([], [], [], items)}")
|
3740
|
-
Rules[:_LongDefinitionItem] = rule_info("LongDefinitionItem", "- \";:\" - DocumentContentExcept('{'):term \"{\" - Nl - BlockBody:definition - BlockEnd {dl_item([], [], [term], definition)}")
|
4252
|
+
Rules[:_Newpage] = rule_info("Newpage", "- NewpageCommand:c \":\" - DocumentContent?:content - Nl {newpage(c[:ids],c[:classes],c[:args], c[:named_args], content, c[:ln])}")
|
4253
|
+
Rules[:_UnorderedList] = rule_info("UnorderedList", "ln:ln UnorderedItem+:items {unordered_list([],[],[],[], items, ln)}")
|
4254
|
+
Rules[:_UnorderedItem] = rule_info("UnorderedItem", "ln:ln \"*:\" - DocumentContent:content Le {ul_item([], [], [], [], content, ln)}")
|
4255
|
+
Rules[:_OrderedList] = rule_info("OrderedList", "ln:ln OrderedItem+:items {ordered_list([],[],[], [], items, ln)}")
|
4256
|
+
Rules[:_OrderedItem] = rule_info("OrderedItem", "ln:ln Num \":\" - DocumentContent:content Le {ol_item([], [], [], [], content, ln)}")
|
4257
|
+
Rules[:_DefinitionList] = rule_info("DefinitionList", "ln:ln DefinitionItem+:items {definition_list([], [], [], [], items, ln)}")
|
4258
|
+
Rules[:_DefinitionItem] = rule_info("DefinitionItem", "- ln:ln \";:\" - DocumentContentExcept(':'):term \":\" - DocumentContent:definition Le {dl_item([], [], [term], [], definition, ln)}")
|
4259
|
+
Rules[:_LongDefinitionList] = rule_info("LongDefinitionList", "ln:ln LongDefinitionItem+:items {definition_list([], [], [], [], items, ln)}")
|
4260
|
+
Rules[:_LongDefinitionItem] = rule_info("LongDefinitionItem", "- ln:ln \";:\" - DocumentContentExcept('{'):term \"{\" - Nl - BlockBody:definition - BlockEnd {dl_item([], [], [term], [], definition, ln)}")
|
3741
4261
|
Rules[:_ItemsList] = rule_info("ItemsList", "(UnorderedList | OrderedList | DefinitionList | LongDefinitionList)")
|
3742
|
-
Rules[:_LineCommand] = rule_info("LineCommand", "- !CommandNameForSpecialLineCommand Command:c \":\" - DocumentContent?:content - Le EmptyLine* {
|
4262
|
+
Rules[:_LineCommand] = rule_info("LineCommand", "- !CommandNameForSpecialLineCommand Command:c \":\" - DocumentContent?:content - Le EmptyLine* {block(c[:name], c[:ids], c[:classes], c[:args], c[:named_args], content, c[:ln])}")
|
3743
4263
|
Rules[:_LineBlock] = rule_info("LineBlock", "(ItemsList | LineCommand)")
|
3744
|
-
Rules[:_Block] = rule_info("Block", "
|
4264
|
+
Rules[:_Block] = rule_info("Block", "(PreformattedBlock | HeadedSection | LineBlock | ExplicitBlock | ParagraphGroup):block EmptyLine* {block}")
|
3745
4265
|
Rules[:_BlockDelimiter] = rule_info("BlockDelimiter", "(BlockHead | BlockEnd)")
|
3746
4266
|
Rules[:_ParagraphDelimiter] = rule_info("ParagraphDelimiter", "(BlockDelimiter | PreformattedCommandHead | LineBlock | Newpage | HeadedStart)")
|
3747
4267
|
Rules[:_HStartMark] = rule_info("HStartMark", "< \"=\"+ \":\" > &{ text.length - 1 == n }")
|
3748
|
-
Rules[:_HMarkupTerminator] = rule_info("HMarkupTerminator", "- < \"=\"+ \":\" > &{ text.length - 1 <= n }")
|
3749
|
-
Rules[:_HStart] = rule_info("HStart", "- HStartMark(n) - DocumentContent:s Le { { level: n, heading: s } }")
|
3750
|
-
Rules[:_HSection] = rule_info("HSection", "HStart(n):h (!HMarkupTerminator(n)
|
4268
|
+
Rules[:_HMarkupTerminator] = rule_info("HMarkupTerminator", "(- < \"=\"+ \":\" > &{ text.length - 1 <= n } | - Eof)")
|
4269
|
+
Rules[:_HStart] = rule_info("HStart", "- HStartMark(n) ln:ln - DocumentContent:s Le { { level: n, heading: s, ln: ln} }")
|
4270
|
+
Rules[:_HSection] = rule_info("HSection", "HStart(n):h EmptyLine* (!HMarkupTerminator(n) Block)*:content EmptyLine* {h_section(h[:level], h[:heading], content, h[:ln])}")
|
3751
4271
|
Rules[:_HeadedStart] = rule_info("HeadedStart", "(HStart(1) | HStart(2) | HStart(3) | HStart(4) | HStart(5) | HStart(6))")
|
3752
4272
|
Rules[:_HeadedSection] = rule_info("HeadedSection", "(HSection(1) | HSection(2) | HSection(3) | HSection(4) | HSection(5) | HSection(6))")
|
3753
4273
|
Rules[:_FrontmatterSeparator] = rule_info("FrontmatterSeparator", "- \"---\" - Nl")
|
3754
|
-
Rules[:_Frontmatter] = rule_info("Frontmatter", "FrontmatterSeparator (!FrontmatterSeparator CharString Nl)+:yaml FrontmatterSeparator EmptyLine* {frontmatter(yaml)}")
|
4274
|
+
Rules[:_Frontmatter] = rule_info("Frontmatter", "FrontmatterSeparator ln:ln (!FrontmatterSeparator CharString Nl)+:yaml FrontmatterSeparator EmptyLine* {frontmatter(yaml, ln)}")
|
3755
4275
|
Rules[:_Char] = rule_info("Char", "< /[[:print:]]/ > { text }")
|
3756
4276
|
Rules[:_CharString] = rule_info("CharString", "< Char* > { text }")
|
3757
4277
|
Rules[:_CharExcept] = rule_info("CharExcept", "Char:c &{ c != e }")
|
3758
|
-
Rules[:_DocumentTextExcept] = rule_info("DocumentTextExcept", "< (!Inline CharExcept(e))+ > {text(text)}")
|
4278
|
+
Rules[:_DocumentTextExcept] = rule_info("DocumentTextExcept", "< (!Inline CharExcept(e))+ > ln:ln {text(text, ln)}")
|
3759
4279
|
Rules[:_DocumentContentExcept] = rule_info("DocumentContentExcept", "(Inline | DocumentTextExcept(e))+:content { content }")
|
3760
|
-
Rules[:_DocumentText] = rule_info("DocumentText", "< (!Inline Char)+ > {text(text)}")
|
4280
|
+
Rules[:_DocumentText] = rule_info("DocumentText", "< (!Inline Char)+ > ln:ln {text(text, ln)}")
|
3761
4281
|
Rules[:_DocumentContent] = rule_info("DocumentContent", "(Inline | DocumentText)+:content { content }")
|
3762
4282
|
Rules[:_DocumentLine] = rule_info("DocumentLine", "DocumentContent:content Le { content }")
|
3763
|
-
Rules[:_Page] = rule_info("Page", "Frontmatter?:frontmatter - (!Newpage Block)*:blocks {page(([frontmatter] + blocks).select{ |x| !x.nil?})}")
|
4283
|
+
Rules[:_Page] = rule_info("Page", "Frontmatter?:frontmatter - (!Newpage Block)*:blocks EmptyLine* {page(([frontmatter] + blocks).select{ |x| !x.nil?}, 1)}")
|
3764
4284
|
Rules[:_Pages] = rule_info("Pages", "(Page:page Newpage:newpage Pages:pages { [ page, newpage ] + pages } | Page:page { [ page ] })")
|
3765
|
-
Rules[:_root] = rule_info("root", "BOM? Pages:pages
|
4285
|
+
Rules[:_root] = rule_info("root", "BOM? EmptyLine* Pages:pages EofComment? Eof {root(pages)}")
|
3766
4286
|
# :startdoc:
|
3767
4287
|
end
|