slaw 2.2.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,7 @@
1
1
  # encoding: UTF-8
2
2
 
3
3
  require 'slaw'
4
+ require 'slaw/grammars/za/act_nodes'
4
5
 
5
6
  describe Slaw::ActGenerator do
6
7
  subject { Slaw::ActGenerator.new('za') }
@@ -27,6 +28,11 @@ describe Slaw::ActGenerator do
27
28
  b.doc.root.to_xml(encoding: 'UTF-8')
28
29
  end
29
30
 
31
+ before(:each) do
32
+ Slaw::Grammars::ZA::Act::Crossheading.counters.clear
33
+ Slaw::Grammars::ZA::Act::BlockElements.counters.clear
34
+ end
35
+
30
36
  describe 'tables' do
31
37
  it 'should parse basic tables' do
32
38
  node = parse :table, <<EOS
@@ -177,10 +183,10 @@ EOS
177
183
  xml.should == '<section id="section-10">
178
184
  <num>10.</num>
179
185
  <heading>A section title</heading>
180
- <paragraph id="section-10.paragraph-0">
186
+ <paragraph id="section-10.paragraph0">
181
187
  <content>
182
188
  <p>Heres a table:</p>
183
- <table id="section-10.paragraph-0.table1">
189
+ <table id="section-10.paragraph0.table1">
184
190
  <tr>
185
191
  <td>
186
192
  <p>r1c1</p>
@@ -250,10 +256,10 @@ EOS
250
256
  <mainBody>
251
257
  <hcontainer id="schedule1" name="schedule">
252
258
  <heading>Schedule 1</heading>
253
- <paragraph id="schedule1.paragraph-0">
259
+ <paragraph id="schedule1.paragraph0">
254
260
  <content>
255
261
  <p>Heres a table:</p>
256
- <table id="schedule1.paragraph-0.table1">
262
+ <table id="schedule1.paragraph0.table1">
257
263
  <tr>
258
264
  <td>
259
265
  <p>r1c1</p>
@@ -280,14 +286,14 @@ EOS
280
286
  end
281
287
 
282
288
  it 'should ignore an escaped table' do
283
- node = parse :block_paragraphs, <<EOS
289
+ node = parse :generic_container, <<EOS
284
290
  \\{|
285
291
  | r1c1
286
292
  | r1c2
287
293
  |}
288
294
  EOS
289
295
 
290
- to_xml(node).should == '<paragraph id="paragraph-0">
296
+ to_xml(node).should == '<paragraph id="paragraph0">
291
297
  <content>
292
298
  <p>{|</p>
293
299
  <p>| r1c1</p>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slaw
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Kempe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-20 00:00:00.000000000 Z
11
+ date: 2019-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -131,9 +131,6 @@ files:
131
131
  - lib/slaw/grammars/core_nodes.rb
132
132
  - lib/slaw/grammars/inlines.treetop
133
133
  - lib/slaw/grammars/inlines_nodes.rb
134
- - lib/slaw/grammars/pl/act.treetop
135
- - lib/slaw/grammars/pl/act_nodes.rb
136
- - lib/slaw/grammars/pl/act_text.xsl
137
134
  - lib/slaw/grammars/schedules.treetop
138
135
  - lib/slaw/grammars/schedules_nodes.rb
139
136
  - lib/slaw/grammars/tables.treetop
@@ -159,7 +156,6 @@ files:
159
156
  - spec/generator_spec.rb
160
157
  - spec/parse/builder_spec.rb
161
158
  - spec/parse/cleanser_spec.rb
162
- - spec/pl/act_block_spec.rb
163
159
  - spec/spec_helper.rb
164
160
  - spec/xml_helpers.rb
165
161
  - spec/za/act_block_spec.rb
@@ -196,7 +192,6 @@ test_files:
196
192
  - spec/generator_spec.rb
197
193
  - spec/parse/builder_spec.rb
198
194
  - spec/parse/cleanser_spec.rb
199
- - spec/pl/act_block_spec.rb
200
195
  - spec/spec_helper.rb
201
196
  - spec/xml_helpers.rb
202
197
  - spec/za/act_block_spec.rb
@@ -1,240 +0,0 @@
1
- # encoding: UTF-8
2
-
3
- require 'slaw/parse/grammar_helpers'
4
- require 'slaw/grammars/pl/act_nodes'
5
-
6
- require 'slaw/grammars/terminals'
7
- require 'slaw/grammars/tables'
8
- require 'slaw/grammars/schedules'
9
- require 'slaw/grammars/inlines'
10
-
11
- module Slaw
12
- module Grammars
13
- module PL
14
- grammar Act
15
- include Slaw::Parse::GrammarHelpers
16
-
17
- ########
18
- # major containers
19
-
20
- rule act
21
- empty_line*
22
- preface:preface?
23
- preamble:preamble?
24
- body
25
- schedules:schedules_container? <Act>
26
- end
27
-
28
- rule preface
29
- !'PREAMBLE'
30
- ('PREFACE'i space? eol)?
31
- statements:(!'PREAMBLE' pre_body_statement)* <Preface>
32
- end
33
-
34
- rule preamble
35
- 'PREAMBLE'i space? eol
36
- statements:pre_body_statement* <Preamble>
37
- end
38
-
39
- rule body
40
- children:(division / subdivision / chapter / article / section / paragraph / point / litera / indents / block_paragraphs)+ <Body>
41
- end
42
-
43
- rule division
44
- heading:division_heading
45
- children:(subdivision / chapter / article / section / paragraph / point / litera / indents / block_paragraphs)*
46
- <Division>
47
- end
48
-
49
- rule subdivision
50
- heading:subdivision_heading
51
- children:(chapter / article / section / paragraph / point / litera / indents / block_paragraphs)*
52
- <Subdivision>
53
- end
54
-
55
- rule chapter
56
- heading:chapter_heading
57
- children:(article / section / paragraph / point / litera / indents / block_paragraphs)*
58
- <Chapter>
59
- end
60
-
61
- rule article
62
- # Art. 55. some optional text
63
- # 1. first paragraph etc.
64
- article_prefix intro
65
- children:(section / paragraph / point / litera / indents / block_paragraphs)* <Article>
66
- end
67
-
68
- rule section
69
- # § 55. foo
70
- section_prefix intro
71
- children:(paragraph / point / litera / indents / block_paragraphs)* <Section>
72
- end
73
-
74
- rule paragraph
75
- # ustęp:
76
- # 34. ...
77
- paragraph_prefix intro
78
- children:(point / litera / indents / block_paragraphs)* <Paragraph>
79
- end
80
-
81
- rule point
82
- # 12) aoeuaoeu
83
- # 12a) aoeuaoeu
84
- point_prefix intro
85
- children:(litera / indents / block_paragraphs)* <Point>
86
- end
87
-
88
- rule litera
89
- # a) aoeuaoeu
90
- litera_prefix intro
91
- children:(indents / block_paragraphs)* <Litera>
92
- end
93
-
94
- rule indents
95
- # - foo
96
- # - bar
97
- children:indent_item+ <Indents>
98
- end
99
-
100
- rule indent_item
101
- indent_prefix item_content:inline_block_element? eol? <IndentItem>
102
- end
103
-
104
- rule intro
105
- (intro_inline:inline_block_element / (eol intro_block:block_element))? eol?
106
- end
107
-
108
- ##########
109
- # group elements
110
- #
111
- # these are used externally and provide support when parsing just
112
- # a particular portion of a document
113
-
114
- rule articles
115
- children:article+ <GroupNode>
116
- end
117
-
118
- rule chapters
119
- children:chapter+ <GroupNode>
120
- end
121
-
122
- rule divisions
123
- children:division+ <GroupNode>
124
- end
125
-
126
- rule paragraphs
127
- children:paragraph+ <GroupNode>
128
- end
129
-
130
- rule sections
131
- children:section+ <GroupNode>
132
- end
133
-
134
- rule subdivisions
135
- children:subdivision+ <GroupNode>
136
- end
137
-
138
- ##########
139
- # headings
140
-
141
- rule division_heading
142
- space? prefix:division_heading_prefix heading:(newline? content)? eol
143
- <GenericHeading>
144
- end
145
-
146
- rule subdivision_heading
147
- space? prefix:subdivision_heading_prefix heading:(newline? content)? eol
148
- <GenericHeading>
149
- end
150
-
151
- rule chapter_heading
152
- space? prefix:chapter_heading_prefix heading:(newline? content)? eol
153
- <GenericHeading>
154
- end
155
-
156
- ##########
157
- # blocks of content inside containers
158
-
159
- rule block_paragraphs
160
- block_element+ <BlockParagraph>
161
- end
162
-
163
- rule block_element
164
- table / naked_statement
165
- end
166
-
167
- # Block elements that don't have to appear at the start of a line.
168
- # ie. we don't need to guard against the start of a chapter, section, etc.
169
- rule inline_block_element
170
- table / inline_statement
171
- end
172
-
173
- ##########
174
- # statements - single lines of content
175
- #
176
- # If a statement starts with a backslash, it's considered to have escaped the subsequent word,
177
- # and is ignored. This allows escaping of section headings, etc.
178
-
179
- rule naked_statement
180
- space? !(division_heading / subdivision_heading / chapter_heading / article_prefix / section_prefix / schedule_title / paragraph_prefix / point_prefix / litera_prefix / indent_prefix) '\\'? clauses eol
181
- <NakedStatement>
182
- end
183
-
184
- rule pre_body_statement
185
- space? !(division_heading / subdivision_heading / chapter_heading / article_prefix / section_prefix / schedule_title) '\\'? clauses eol
186
- <NakedStatement>
187
- end
188
-
189
- ##########
190
- # prefixes
191
-
192
- rule division_heading_prefix
193
- 'dzia'i ('ł'/'Ł') space alphanums [ :-]*
194
- end
195
-
196
- rule subdivision_heading_prefix
197
- 'oddzia'i ('ł'/'Ł') space alphanums [ :.-]*
198
- end
199
-
200
- rule chapter_heading_prefix
201
- 'rozdzia'i ('ł'/'Ł') space alphanums [ :.-]*
202
- end
203
-
204
- rule article_prefix
205
- ('Art.'i / ('Artyku'i 'ł'/'Ł')) space number_letter '.'?
206
- end
207
-
208
- rule section_prefix
209
- '§' space alphanums '.'?
210
- end
211
-
212
- rule paragraph_prefix
213
- number_letter '.'
214
- end
215
-
216
- rule point_prefix
217
- # 1) foo
218
- # 2A) foo
219
- number_letter ')'
220
- end
221
-
222
- rule litera_prefix
223
- # a) foo
224
- # bb) foo
225
- letters:letter+ ')'
226
- end
227
-
228
- rule indent_prefix
229
- # these are two different dash characters
230
- '–' / '-' space
231
- end
232
-
233
- include Slaw::Grammars::Inlines
234
- include Slaw::Grammars::Tables
235
- include Slaw::Grammars::Schedules
236
- include Slaw::Grammars::Terminals
237
- end
238
- end
239
- end
240
- end
@@ -1,441 +0,0 @@
1
- require 'slaw/grammars/core_nodes'
2
-
3
- module Slaw
4
- module Grammars
5
- module PL
6
- module Act
7
- class Act < Treetop::Runtime::SyntaxNode
8
- FRBR_URI = '/pl/act/1980/01'
9
- WORK_URI = FRBR_URI
10
- EXPRESSION_URI = "#{FRBR_URI}/pol@"
11
- MANIFESTATION_URI = EXPRESSION_URI
12
-
13
- def to_xml(b, idprefix=nil, i=0)
14
- b.act(contains: "originalVersion") { |b|
15
- write_meta(b)
16
- write_preface(b)
17
- write_preamble(b)
18
- write_body(b)
19
- }
20
- write_schedules(b)
21
- end
22
-
23
- def write_meta(b)
24
- b.meta { |b|
25
- write_identification(b)
26
-
27
- b.references(source: "#this") {
28
- b.TLCOrganization(id: 'slaw', href: 'https://github.com/longhotsummer/slaw', showAs: "Slaw")
29
- b.TLCOrganization(id: 'council', href: '/ontology/organization/za/council', showAs: "Council")
30
- }
31
- }
32
- end
33
-
34
- def write_identification(b)
35
- b.identification(source: "#slaw") { |b|
36
- # use stub values so that we can generate a validating document
37
- b.FRBRWork { |b|
38
- b.FRBRthis(value: "#{WORK_URI}/main")
39
- b.FRBRuri(value: WORK_URI)
40
- b.FRBRalias(value: 'Short Title')
41
- b.FRBRdate(date: '1980-01-01', name: 'Generation')
42
- b.FRBRauthor(href: '#council')
43
- b.FRBRcountry(value: 'za')
44
- }
45
- b.FRBRExpression { |b|
46
- b.FRBRthis(value: "#{EXPRESSION_URI}/main")
47
- b.FRBRuri(value: EXPRESSION_URI)
48
- b.FRBRdate(date: '1980-01-01', name: 'Generation')
49
- b.FRBRauthor(href: '#council')
50
- b.FRBRlanguage(language: 'eng')
51
- }
52
- b.FRBRManifestation { |b|
53
- b.FRBRthis(value: "#{MANIFESTATION_URI}/main")
54
- b.FRBRuri(value: MANIFESTATION_URI)
55
- b.FRBRdate(date: Time.now.strftime('%Y-%m-%d'), name: 'Generation')
56
- b.FRBRauthor(href: '#slaw')
57
- }
58
- }
59
- end
60
-
61
- def write_preface(b)
62
- preface.to_xml(b) if preface.respond_to? :to_xml
63
- end
64
-
65
- def write_preamble(b)
66
- preamble.to_xml(b) if preamble.respond_to? :to_xml
67
- end
68
-
69
- def write_body(b)
70
- body.to_xml(b)
71
- end
72
-
73
- def write_schedules(b)
74
- if schedules.text_value != ""
75
- schedules.to_xml(b)
76
- end
77
- end
78
- end
79
-
80
- class Preface < Treetop::Runtime::SyntaxNode
81
- def to_xml(b, *args)
82
- if text_value != ""
83
- b.preface { |b|
84
- statements.elements.each { |element|
85
- for e in element.elements
86
- e.to_xml(b, "") if e.is_a? Slaw::Grammars::Inlines::NakedStatement
87
- end
88
- }
89
- }
90
- end
91
- end
92
- end
93
-
94
- class Preamble < Treetop::Runtime::SyntaxNode
95
- def to_xml(b, *args)
96
- if text_value != ""
97
- b.preamble { |b|
98
- statements.elements.each { |e|
99
- e.to_xml(b, "")
100
- }
101
- }
102
- end
103
- end
104
- end
105
-
106
- class Part < Treetop::Runtime::SyntaxNode
107
- def num
108
- heading.num
109
- end
110
-
111
- def to_xml(b, *args)
112
- id = "part-#{num}"
113
-
114
- # include a chapter number in the id if our parent has one
115
- if parent and parent.parent.is_a?(Chapter) and parent.parent.num
116
- id = "chapter-#{parent.parent.num}.#{id}"
117
- end
118
-
119
- b.part(id: id) { |b|
120
- heading.to_xml(b)
121
- children.elements.each_with_index { |e, i| e.to_xml(b, id + '.', i) }
122
- }
123
- end
124
- end
125
-
126
- class GenericHeading < Treetop::Runtime::SyntaxNode
127
- def num
128
- prefix.alphanums.text_value
129
- end
130
-
131
- def title
132
- if heading.text_value and heading.respond_to? :content
133
- heading.content.text_value.strip
134
- end
135
- end
136
-
137
- def to_xml(b)
138
- b.num(num)
139
- b.heading(title) if title
140
- end
141
- end
142
-
143
- class Division < Treetop::Runtime::SyntaxNode
144
- def num
145
- heading.num
146
- end
147
-
148
- def to_xml(b, *args)
149
- id = "division-#{num}"
150
-
151
- b.division(id: id) { |b|
152
- heading.to_xml(b)
153
- children.elements.each_with_index { |e, i| e.to_xml(b, id + '.', i) }
154
- }
155
- end
156
- end
157
-
158
- class Subdivision < Treetop::Runtime::SyntaxNode
159
- def num
160
- heading.num
161
- end
162
-
163
- def to_xml(b, *args)
164
- id = "subdivision-#{num}"
165
-
166
- b.subdivision(id: id) { |b|
167
- heading.to_xml(b)
168
- children.elements.each_with_index { |e, i| e.to_xml(b, id + '.', i) }
169
- }
170
- end
171
- end
172
-
173
- class Chapter < Treetop::Runtime::SyntaxNode
174
- def num
175
- heading.num
176
- end
177
-
178
- def to_xml(b, *args)
179
- id = "chapter-#{num}"
180
-
181
- # TODO: do this for the oddzial and zial
182
- # include a part number in the id if our parent has one
183
- if parent and parent.parent.is_a?(Part) and parent.parent.num
184
- id = "part-#{parent.parent.num}.#{id}"
185
- end
186
-
187
- b.chapter(id: id) { |b|
188
- heading.to_xml(b)
189
- children.elements.each_with_index { |e, i| e.to_xml(b, id + '.', i) }
190
- }
191
- end
192
- end
193
-
194
- class BlockWithIntroAndChildren < Treetop::Runtime::SyntaxNode
195
- def intro_node
196
- if intro.elements.length >= 1
197
- el = intro.elements[0]
198
-
199
- if el.respond_to? :intro_inline
200
- el.intro_inline
201
- elsif el.respond_to? :intro_block
202
- el.intro_block
203
- end
204
- end
205
- end
206
-
207
- def intro_and_children_xml(b, idprefix)
208
- if intro_node and !intro_node.empty?
209
- if not children.empty?
210
- b.intro { |b| intro_node.to_xml(b, idprefix) }
211
- else
212
- b.content { |b| intro_node.to_xml(b, idprefix) }
213
- end
214
- elsif children.empty?
215
- b.content { |b| b.p }
216
- end
217
-
218
- children.elements.each_with_index { |e, i| e.to_xml(b, idprefix, i) }
219
- end
220
- end
221
-
222
- class Article < BlockWithIntroAndChildren
223
- def num
224
- article_prefix.number_letter.text_value
225
- end
226
-
227
- def to_xml(b, *args)
228
- id = "article-#{num}"
229
- idprefix = "#{id}."
230
-
231
- b.article(id: id) { |b|
232
- b.num("#{num}.")
233
- intro_and_children_xml(b, idprefix)
234
- }
235
- end
236
- end
237
-
238
- class Section < BlockWithIntroAndChildren
239
- def num
240
- section_prefix.alphanums.text_value
241
- end
242
-
243
- def to_xml(b, *args)
244
- id = "section-#{num}"
245
- idprefix = "#{id}."
246
-
247
- b.section(id: id) { |b|
248
- b.num("#{num}.")
249
- intro_and_children_xml(b, idprefix)
250
- }
251
- end
252
- end
253
-
254
- class Paragraph < BlockWithIntroAndChildren
255
- def num
256
- paragraph_prefix.number_letter.text_value
257
- end
258
-
259
- def to_xml(b, idprefix='', *args)
260
- id = "#{idprefix}paragraph-#{num}"
261
- idprefix = id + "."
262
-
263
- b.paragraph(id: id) { |b|
264
- b.num(paragraph_prefix.text_value)
265
- intro_and_children_xml(b, idprefix)
266
- }
267
- end
268
- end
269
-
270
- class Point < BlockWithIntroAndChildren
271
- def num
272
- point_prefix.number_letter.text_value
273
- end
274
-
275
- def to_xml(b, idprefix='', i)
276
- id = "#{idprefix}point-#{num}"
277
- idprefix = id + "."
278
-
279
- b.point(id: id) { |b|
280
- b.num(point_prefix.text_value)
281
- intro_and_children_xml(b, idprefix)
282
- }
283
- end
284
- end
285
-
286
- class Litera < BlockWithIntroAndChildren
287
- def num
288
- litera_prefix.letters.text_value
289
- end
290
-
291
- def to_xml(b, idprefix='', i)
292
- id = "#{idprefix}alinea-#{num}"
293
- idprefix = id + "."
294
-
295
- b.alinea(id: id) { |b|
296
- b.num(litera_prefix.text_value)
297
- intro_and_children_xml(b, idprefix)
298
- }
299
- end
300
- end
301
-
302
- class BlockParagraph < Treetop::Runtime::SyntaxNode
303
- def to_xml(b, idprefix='', i=0)
304
- id = "#{idprefix}subparagraph-0"
305
- idprefix = id + "."
306
-
307
- b.subparagraph(id: id) { |b|
308
- b.content { |b|
309
- elements.each_with_index { |e, i| e.to_xml(b, idprefix, i) }
310
- }
311
- }
312
- end
313
- end
314
-
315
- class Indents < Treetop::Runtime::SyntaxNode
316
- # Render a list of indent items.
317
- def to_xml(b, idprefix, i=0)
318
- id = idprefix + "list-#{i}"
319
- idprefix = id + '.'
320
-
321
- b.list(id: id) { |b|
322
- children.elements.each_with_index { |e, i| e.to_xml(b, idprefix, i) }
323
- }
324
- end
325
- end
326
-
327
- class IndentItem < Treetop::Runtime::SyntaxNode
328
- def to_xml(b, idprefix, i)
329
- id = idprefix + "indent-#{i}"
330
- idprefix = id + '.'
331
-
332
- b.indent(id: id) { |b|
333
- b.content { |b|
334
- if not item_content.empty?
335
- item_content.to_xml(b, idprefix)
336
- else
337
- b.p
338
- end
339
- }
340
- }
341
- end
342
- end
343
-
344
- class ScheduleContainer < Treetop::Runtime::SyntaxNode
345
- def to_xml(b)
346
- b.components { |b|
347
- schedules.children.elements.each_with_index { |e, i|
348
- e.to_xml(b, "", i+1)
349
- }
350
- }
351
- end
352
- end
353
-
354
- class Schedule < Treetop::Runtime::SyntaxNode
355
- def num
356
- n = schedule_title.num.text_value
357
- return (n && !n.empty?) ? n : nil
358
- end
359
-
360
- def alias
361
- if not schedule_title.title.text_value.blank?
362
- schedule_title.title.text_value
363
- elsif num
364
- "Schedule #{num}"
365
- else
366
- "Schedule"
367
- end
368
- end
369
-
370
- def heading
371
- if schedule_title.heading.respond_to? :content
372
- schedule_title.heading.content.text_value
373
- else
374
- nil
375
- end
376
- end
377
-
378
- def to_xml(b, idprefix=nil, i=1)
379
- if num
380
- n = num
381
- component = "schedule#{n}"
382
- else
383
- n = i
384
- # make a component name from the schedule title
385
- component = self.alias.downcase().strip().gsub(/[^a-z0-9]/i, '').gsub(/ +/, '')
386
- end
387
-
388
- id = "#{idprefix}#{component}"
389
-
390
- b.component(id: "component-#{id}") { |b|
391
- b.doc_(name: component) { |b|
392
- b.meta { |b|
393
- b.identification(source: "#slaw") { |b|
394
- b.FRBRWork { |b|
395
- b.FRBRthis(value: "#{Act::WORK_URI}/#{component}")
396
- b.FRBRuri(value: Act::WORK_URI)
397
- b.FRBRalias(value: self.alias)
398
- b.FRBRdate(date: '1980-01-01', name: 'Generation')
399
- b.FRBRauthor(href: '#council')
400
- b.FRBRcountry(value: 'za')
401
- }
402
- b.FRBRExpression { |b|
403
- b.FRBRthis(value: "#{Act::EXPRESSION_URI}/#{component}")
404
- b.FRBRuri(value: Act::EXPRESSION_URI)
405
- b.FRBRdate(date: '1980-01-01', name: 'Generation')
406
- b.FRBRauthor(href: '#council')
407
- b.FRBRlanguage(language: 'eng')
408
- }
409
- b.FRBRManifestation { |b|
410
- b.FRBRthis(value: "#{Act::MANIFESTATION_URI}/#{component}")
411
- b.FRBRuri(value: Act::MANIFESTATION_URI)
412
- b.FRBRdate(date: Time.now.strftime('%Y-%m-%d'), name: 'Generation')
413
- b.FRBRauthor(href: '#slaw')
414
- }
415
- }
416
- }
417
-
418
- b.mainBody { |b|
419
- idprefix = "#{id}."
420
-
421
- # there is no good AKN hierarchy container for schedules, so we
422
- # just use article because we don't use it anywhere else.
423
- b.article(id: id) { |b|
424
- b.heading(heading) if heading
425
- body.children.elements.each_with_index { |e| e.to_xml(b, idprefix, i) } if body.is_a? Body
426
- }
427
- }
428
- }
429
- }
430
- end
431
- end
432
-
433
- class ScheduleStatement < Treetop::Runtime::SyntaxNode
434
- def to_xml(b, idprefix)
435
- b.p { |b| clauses.to_xml(b, idprefix) } if clauses
436
- end
437
- end
438
- end
439
- end
440
- end
441
- end