slaw 9.0.0 → 10.2.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.
- checksums.yaml +4 -4
- data/README.md +32 -1
- data/bin/slaw +7 -1
- data/lib/slaw/grammars/counters.rb +22 -5
- data/lib/slaw/grammars/inlines.treetop +13 -1
- data/lib/slaw/grammars/inlines_nodes.rb +20 -0
- data/lib/slaw/grammars/schedules_nodes.rb +11 -14
- data/lib/slaw/grammars/tables_nodes.rb +3 -1
- data/lib/slaw/grammars/terminals.treetop +5 -1
- data/lib/slaw/grammars/za/act.treetop +1 -1
- data/lib/slaw/grammars/za/act_nodes.rb +41 -34
- data/lib/slaw/grammars/za/act_text.xsl +18 -23
- data/lib/slaw/namespace.rb +9 -3
- data/lib/slaw/parse/blocklists.rb +10 -9
- data/lib/slaw/parse/builder.rb +1 -4
- data/lib/slaw/schemas/akomantoso30.xsd +6862 -0
- data/lib/slaw/version.rb +1 -1
- data/lib/slaw/xml_support.rb +1 -67
- data/spec/fixtures/community-fire-safety.xml +15 -15
- data/spec/generator_spec.rb +1 -1
- data/spec/parse/blocklists_spec.rb +169 -169
- data/spec/xml_helpers.rb +2 -2
- data/spec/za/act_block_spec.rb +305 -262
- data/spec/za/act_inline_spec.rb +93 -69
- data/spec/za/act_schedules_spec.rb +312 -348
- data/spec/za/act_table_spec.rb +45 -47
- data/spec/za/postprocess_spec.rb +2 -2
- metadata +3 -2
data/spec/xml_helpers.rb
CHANGED
@@ -5,7 +5,7 @@ end
|
|
5
5
|
def subsection(xml)
|
6
6
|
pre = <<XML
|
7
7
|
<?xml version="1.0" encoding="UTF-8"?>
|
8
|
-
<akomaNtoso xmlns
|
8
|
+
<akomaNtoso xmlns="http://docs.oasis-open.org/legaldocml/ns/akn/3.0">
|
9
9
|
<act contains="singleVersion">
|
10
10
|
<body>
|
11
11
|
<section id="section-10">
|
@@ -30,7 +30,7 @@ end
|
|
30
30
|
def section(xml)
|
31
31
|
pre = <<XML
|
32
32
|
<?xml version="1.0" encoding="UTF-8"?>
|
33
|
-
<akomaNtoso xmlns
|
33
|
+
<akomaNtoso xmlns="http://docs.oasis-open.org/legaldocml/ns/akn/3.0">
|
34
34
|
<act contains="singleVersion">
|
35
35
|
<body>
|
36
36
|
<section id="section-10">
|
data/spec/za/act_block_spec.rb
CHANGED
@@ -46,20 +46,20 @@ Hello there
|
|
46
46
|
CROSSHEADING crossheading
|
47
47
|
EOS
|
48
48
|
to_xml(node).should == '<body>
|
49
|
-
<
|
49
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
50
50
|
<content>
|
51
51
|
<p>Some content before the section</p>
|
52
52
|
</content>
|
53
|
-
</
|
54
|
-
<section
|
53
|
+
</hcontainer>
|
54
|
+
<section eId="sec_1">
|
55
55
|
<num>1.</num>
|
56
56
|
<heading>Section</heading>
|
57
|
-
<
|
57
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
58
58
|
<content>
|
59
59
|
<p>Hello there</p>
|
60
60
|
</content>
|
61
|
-
</
|
62
|
-
<hcontainer
|
61
|
+
</hcontainer>
|
62
|
+
<hcontainer eId="sec_1__hcontainer_2" name="crossheading">
|
63
63
|
<heading>crossheading</heading>
|
64
64
|
</hcontainer>
|
65
65
|
</section>
|
@@ -81,33 +81,33 @@ Hello there
|
|
81
81
|
CROSSHEADING crossheading
|
82
82
|
EOS
|
83
83
|
to_xml(node).should == '<body>
|
84
|
-
<
|
84
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
85
85
|
<content>
|
86
86
|
<p>Some content before the section</p>
|
87
|
-
<blockList
|
88
|
-
<item
|
87
|
+
<blockList eId="hcontainer_1__list_1" renest="true">
|
88
|
+
<item eId="hcontainer_1__list_1__item_a">
|
89
89
|
<num>(a)</num>
|
90
90
|
<p>foo</p>
|
91
91
|
</item>
|
92
|
-
<item
|
92
|
+
<item eId="hcontainer_1__list_1__item_b">
|
93
93
|
<num>(b)</num>
|
94
94
|
<p>bar</p>
|
95
95
|
</item>
|
96
96
|
</blockList>
|
97
97
|
</content>
|
98
|
-
</
|
99
|
-
<hcontainer
|
98
|
+
</hcontainer>
|
99
|
+
<hcontainer eId="hcontainer_2" name="crossheading">
|
100
100
|
<heading>crossheading</heading>
|
101
101
|
</hcontainer>
|
102
|
-
<section
|
102
|
+
<section eId="sec_1">
|
103
103
|
<num>1.</num>
|
104
104
|
<heading>Section</heading>
|
105
|
-
<
|
105
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
106
106
|
<content>
|
107
107
|
<p>Hello there</p>
|
108
108
|
</content>
|
109
|
-
</
|
110
|
-
<hcontainer
|
109
|
+
</hcontainer>
|
110
|
+
<hcontainer eId="sec_1__hcontainer_2" name="crossheading">
|
111
111
|
<heading>crossheading</heading>
|
112
112
|
</hcontainer>
|
113
113
|
</section>
|
@@ -124,20 +124,20 @@ EOS
|
|
124
124
|
\\Chapter 2 ignored
|
125
125
|
EOS
|
126
126
|
to_xml(node).should == '<body>
|
127
|
-
<
|
127
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
128
128
|
<content>
|
129
129
|
<p>1. ignored</p>
|
130
130
|
<p>CROSSHEADING crossheading</p>
|
131
131
|
</content>
|
132
|
-
</
|
133
|
-
<section
|
132
|
+
</hcontainer>
|
133
|
+
<section eId="sec_1">
|
134
134
|
<num>1.</num>
|
135
135
|
<heading>Section</heading>
|
136
|
-
<
|
136
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
137
137
|
<content>
|
138
138
|
<p>Chapter 2 ignored</p>
|
139
139
|
</content>
|
140
|
-
</
|
140
|
+
</hcontainer>
|
141
141
|
</section>
|
142
142
|
</body>'
|
143
143
|
end
|
@@ -152,19 +152,19 @@ Some content before the section
|
|
152
152
|
Hello there
|
153
153
|
EOS
|
154
154
|
to_xml(node).should == '<body>
|
155
|
-
<
|
155
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
156
156
|
<content>
|
157
157
|
<p>Some content before the section</p>
|
158
158
|
</content>
|
159
|
-
</
|
160
|
-
<section
|
159
|
+
</hcontainer>
|
160
|
+
<section eId="sec_1">
|
161
161
|
<num>1.</num>
|
162
162
|
<heading>Section</heading>
|
163
|
-
<
|
163
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
164
164
|
<content>
|
165
165
|
<p>Hello there</p>
|
166
166
|
</content>
|
167
|
-
</
|
167
|
+
</hcontainer>
|
168
168
|
</section>
|
169
169
|
</body>'
|
170
170
|
end
|
@@ -206,17 +206,17 @@ The Chapter Heading
|
|
206
206
|
1. Section
|
207
207
|
Hello there
|
208
208
|
EOS
|
209
|
-
to_xml(node).should == '<chapter
|
209
|
+
to_xml(node).should == '<chapter eId="chp_2">
|
210
210
|
<num>2</num>
|
211
211
|
<heading>The Chapter Heading</heading>
|
212
|
-
<section
|
212
|
+
<section eId="sec_1">
|
213
213
|
<num>1.</num>
|
214
214
|
<heading>Section</heading>
|
215
|
-
<
|
215
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
216
216
|
<content>
|
217
217
|
<p>Hello there</p>
|
218
218
|
</content>
|
219
|
-
</
|
219
|
+
</hcontainer>
|
220
220
|
</section>
|
221
221
|
</chapter>'
|
222
222
|
end
|
@@ -228,16 +228,16 @@ ChaPTEr 2:
|
|
228
228
|
1. Section
|
229
229
|
Hello there
|
230
230
|
EOS
|
231
|
-
to_xml(node).should == '<chapter
|
231
|
+
to_xml(node).should == '<chapter eId="chp_2">
|
232
232
|
<num>2</num>
|
233
|
-
<section
|
233
|
+
<section eId="sec_1">
|
234
234
|
<num>1.</num>
|
235
235
|
<heading>Section</heading>
|
236
|
-
<
|
236
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
237
237
|
<content>
|
238
238
|
<p>Hello there</p>
|
239
239
|
</content>
|
240
|
-
</
|
240
|
+
</hcontainer>
|
241
241
|
</section>
|
242
242
|
</chapter>'
|
243
243
|
end
|
@@ -253,17 +253,17 @@ Some lines at the start of the chapter.
|
|
253
253
|
EOS
|
254
254
|
node.num.should == "2"
|
255
255
|
node.heading.heading.text_value.should == "\nThe Chapter Heading"
|
256
|
-
to_xml(node).should == '<chapter
|
256
|
+
to_xml(node).should == '<chapter eId="chp_2">
|
257
257
|
<num>2</num>
|
258
258
|
<heading>The Chapter Heading</heading>
|
259
|
-
<hcontainer
|
259
|
+
<hcontainer eId="chp_2__hcontainer_1" name="crossheading">
|
260
260
|
<heading>crossheading</heading>
|
261
261
|
</hcontainer>
|
262
|
-
<
|
262
|
+
<hcontainer eId="chp_2__hcontainer_2" name="hcontainer">
|
263
263
|
<content>
|
264
264
|
<p>Some lines at the start of the chapter.</p>
|
265
265
|
</content>
|
266
|
-
</
|
266
|
+
</hcontainer>
|
267
267
|
</chapter>'
|
268
268
|
end
|
269
269
|
|
@@ -279,22 +279,22 @@ Section text.
|
|
279
279
|
EOS
|
280
280
|
node.num.should == "2"
|
281
281
|
node.heading.heading.text_value.should == 'The Chapter Heading'
|
282
|
-
to_xml(node).should == '<chapter
|
282
|
+
to_xml(node).should == '<chapter eId="chp_2">
|
283
283
|
<num>2</num>
|
284
284
|
<heading>The Chapter Heading</heading>
|
285
|
-
<
|
285
|
+
<hcontainer eId="chp_2__hcontainer_1" name="hcontainer">
|
286
286
|
<content>
|
287
287
|
<p>Some lines at the start of the chapter.</p>
|
288
288
|
</content>
|
289
|
-
</
|
290
|
-
<section
|
289
|
+
</hcontainer>
|
290
|
+
<section eId="sec_1">
|
291
291
|
<num>1.</num>
|
292
292
|
<heading>Section 1</heading>
|
293
|
-
<
|
293
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
294
294
|
<content>
|
295
295
|
<p>Section text.</p>
|
296
296
|
</content>
|
297
|
-
</
|
297
|
+
</hcontainer>
|
298
298
|
</section>
|
299
299
|
</chapter>'
|
300
300
|
end
|
@@ -306,17 +306,17 @@ Chapter 2
|
|
306
306
|
1. Section
|
307
307
|
Hello there
|
308
308
|
EOS
|
309
|
-
to_xml(node).should == '<chapter
|
309
|
+
to_xml(node).should == '<chapter eId="chp_2">
|
310
310
|
<num>2</num>
|
311
311
|
<heading>The Chapter Heading</heading>
|
312
|
-
<section
|
312
|
+
<section eId="sec_1">
|
313
313
|
<num>1.</num>
|
314
314
|
<heading>Section</heading>
|
315
|
-
<
|
315
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
316
316
|
<content>
|
317
317
|
<p>Hello there</p>
|
318
318
|
</content>
|
319
|
-
</
|
319
|
+
</hcontainer>
|
320
320
|
</section>
|
321
321
|
</chapter>'
|
322
322
|
end
|
@@ -329,17 +329,17 @@ Chapter 2
|
|
329
329
|
1. Section
|
330
330
|
Hello there
|
331
331
|
EOS
|
332
|
-
to_xml(node).should == '<chapter
|
332
|
+
to_xml(node).should == '<chapter eId="chp_2">
|
333
333
|
<num>2</num>
|
334
334
|
<heading>The <b>Chapter</b> <ref href="/za/act/1990/1">Heading</ref> <remark status="editorial">[remark]</remark></heading>
|
335
|
-
<section
|
335
|
+
<section eId="sec_1">
|
336
336
|
<num>1.</num>
|
337
337
|
<heading>Section</heading>
|
338
|
-
<
|
338
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
339
339
|
<content>
|
340
340
|
<p>Hello there</p>
|
341
341
|
</content>
|
342
|
-
</
|
342
|
+
</hcontainer>
|
343
343
|
</section>
|
344
344
|
</chapter>'
|
345
345
|
end
|
@@ -351,17 +351,17 @@ Chapter 2 - The **Chapter** [Heading](/za/act/1990/1) [[remark]]
|
|
351
351
|
1. Section
|
352
352
|
Hello there
|
353
353
|
EOS
|
354
|
-
to_xml(node).should == '<chapter
|
354
|
+
to_xml(node).should == '<chapter eId="chp_2">
|
355
355
|
<num>2</num>
|
356
356
|
<heading>The <b>Chapter</b> <ref href="/za/act/1990/1">Heading</ref> <remark status="editorial">[remark]</remark></heading>
|
357
|
-
<section
|
357
|
+
<section eId="sec_1">
|
358
358
|
<num>1.</num>
|
359
359
|
<heading>Section</heading>
|
360
|
-
<
|
360
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
361
361
|
<content>
|
362
362
|
<p>Hello there</p>
|
363
363
|
</content>
|
364
|
-
</
|
364
|
+
</hcontainer>
|
365
365
|
</section>
|
366
366
|
</chapter>'
|
367
367
|
end
|
@@ -372,11 +372,11 @@ Chapter 2 The Chapter Heading
|
|
372
372
|
Chapter 3 The Other Heading
|
373
373
|
EOS
|
374
374
|
to_xml(node).should == '<body>
|
375
|
-
<chapter
|
375
|
+
<chapter eId="chp_2">
|
376
376
|
<num>2</num>
|
377
377
|
<heading>The Chapter Heading</heading>
|
378
378
|
</chapter>
|
379
|
-
<chapter
|
379
|
+
<chapter eId="chp_3">
|
380
380
|
<num>3</num>
|
381
381
|
<heading>The Other Heading</heading>
|
382
382
|
</chapter>
|
@@ -391,12 +391,12 @@ Chapter 2 The Chapter
|
|
391
391
|
| foo
|
392
392
|
|}
|
393
393
|
EOS
|
394
|
-
to_xml(node).should == '<chapter
|
394
|
+
to_xml(node).should == '<chapter eId="chp_2">
|
395
395
|
<num>2</num>
|
396
396
|
<heading>The Chapter</heading>
|
397
|
-
<
|
397
|
+
<hcontainer eId="chp_2__hcontainer_1" name="hcontainer">
|
398
398
|
<content>
|
399
|
-
<table
|
399
|
+
<table eId="chp_2__hcontainer_1__table_1">
|
400
400
|
<tr>
|
401
401
|
<td>
|
402
402
|
<p>foo</p>
|
@@ -404,7 +404,7 @@ EOS
|
|
404
404
|
</tr>
|
405
405
|
</table>
|
406
406
|
</content>
|
407
|
-
</
|
407
|
+
</hcontainer>
|
408
408
|
</chapter>'
|
409
409
|
end
|
410
410
|
|
@@ -418,16 +418,16 @@ Stuff
|
|
418
418
|
|
419
419
|
More stuff
|
420
420
|
EOS
|
421
|
-
to_xml(node).should == '<chapter
|
421
|
+
to_xml(node).should == '<chapter eId="chp_1">
|
422
422
|
<num>1</num>
|
423
423
|
<heading>The Chapter</heading>
|
424
|
-
<
|
424
|
+
<hcontainer eId="chp_1__hcontainer_1" name="hcontainer">
|
425
425
|
<content>
|
426
426
|
<p>Stuff</p>
|
427
427
|
<p>Chapter 2 - Ignored</p>
|
428
428
|
<p>More stuff</p>
|
429
429
|
</content>
|
430
|
-
</
|
430
|
+
</hcontainer>
|
431
431
|
</chapter>'
|
432
432
|
end
|
433
433
|
|
@@ -443,26 +443,26 @@ Part 2 - Chapter One Part Two
|
|
443
443
|
|
444
444
|
one-two
|
445
445
|
EOS
|
446
|
-
to_xml(node).should == '<chapter
|
446
|
+
to_xml(node).should == '<chapter eId="chp_1">
|
447
447
|
<num>1</num>
|
448
448
|
<heading>Chapter One</heading>
|
449
|
-
<part
|
449
|
+
<part eId="chp_1__part_1">
|
450
450
|
<num>1</num>
|
451
451
|
<heading>Chapter One Part One</heading>
|
452
|
-
<
|
452
|
+
<hcontainer eId="chp_1__part_1__hcontainer_1" name="hcontainer">
|
453
453
|
<content>
|
454
454
|
<p>one-one</p>
|
455
455
|
</content>
|
456
|
-
</
|
456
|
+
</hcontainer>
|
457
457
|
</part>
|
458
|
-
<part
|
458
|
+
<part eId="chp_1__part_2">
|
459
459
|
<num>2</num>
|
460
460
|
<heading>Chapter One Part Two</heading>
|
461
|
-
<
|
461
|
+
<hcontainer eId="chp_1__part_2__hcontainer_1" name="hcontainer">
|
462
462
|
<content>
|
463
463
|
<p>one-two</p>
|
464
464
|
</content>
|
465
|
-
</
|
465
|
+
</hcontainer>
|
466
466
|
</part>
|
467
467
|
</chapter>'
|
468
468
|
end
|
@@ -482,20 +482,20 @@ CROSSHEADING crossheading
|
|
482
482
|
1. Section
|
483
483
|
Hello there
|
484
484
|
EOS
|
485
|
-
to_xml(node).should == '<part
|
485
|
+
to_xml(node).should == '<part eId="part_2">
|
486
486
|
<num>2</num>
|
487
487
|
<heading>The Part Heading</heading>
|
488
|
-
<hcontainer
|
488
|
+
<hcontainer eId="part_2__hcontainer_1" name="crossheading">
|
489
489
|
<heading>crossheading</heading>
|
490
490
|
</hcontainer>
|
491
|
-
<section
|
491
|
+
<section eId="sec_1">
|
492
492
|
<num>1.</num>
|
493
493
|
<heading>Section</heading>
|
494
|
-
<
|
494
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
495
495
|
<content>
|
496
496
|
<p>Hello there</p>
|
497
497
|
</content>
|
498
|
-
</
|
498
|
+
</hcontainer>
|
499
499
|
</section>
|
500
500
|
</part>'
|
501
501
|
end
|
@@ -506,17 +506,17 @@ Part 2 - The Part Heading
|
|
506
506
|
1. Section
|
507
507
|
Hello there
|
508
508
|
EOS
|
509
|
-
to_xml(node).should == '<part
|
509
|
+
to_xml(node).should == '<part eId="part_2">
|
510
510
|
<num>2</num>
|
511
511
|
<heading>The Part Heading</heading>
|
512
|
-
<section
|
512
|
+
<section eId="sec_1">
|
513
513
|
<num>1.</num>
|
514
514
|
<heading>Section</heading>
|
515
|
-
<
|
515
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
516
516
|
<content>
|
517
517
|
<p>Hello there</p>
|
518
518
|
</content>
|
519
|
-
</
|
519
|
+
</hcontainer>
|
520
520
|
</section>
|
521
521
|
</part>'
|
522
522
|
end
|
@@ -527,17 +527,17 @@ Part 2: The Part Heading
|
|
527
527
|
1. Section
|
528
528
|
Hello there
|
529
529
|
EOS
|
530
|
-
to_xml(node).should == '<part
|
530
|
+
to_xml(node).should == '<part eId="part_2">
|
531
531
|
<num>2</num>
|
532
532
|
<heading>The Part Heading</heading>
|
533
|
-
<section
|
533
|
+
<section eId="sec_1">
|
534
534
|
<num>1.</num>
|
535
535
|
<heading>Section</heading>
|
536
|
-
<
|
536
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
537
537
|
<content>
|
538
538
|
<p>Hello there</p>
|
539
539
|
</content>
|
540
|
-
</
|
540
|
+
</hcontainer>
|
541
541
|
</section>
|
542
542
|
</part>'
|
543
543
|
end
|
@@ -549,16 +549,16 @@ Part 2:
|
|
549
549
|
1. Section
|
550
550
|
Hello there
|
551
551
|
EOS
|
552
|
-
to_xml(node).should == '<part
|
552
|
+
to_xml(node).should == '<part eId="part_2">
|
553
553
|
<num>2</num>
|
554
|
-
<section
|
554
|
+
<section eId="sec_1">
|
555
555
|
<num>1.</num>
|
556
556
|
<heading>Section</heading>
|
557
|
-
<
|
557
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
558
558
|
<content>
|
559
559
|
<p>Hello there</p>
|
560
560
|
</content>
|
561
|
-
</
|
561
|
+
</hcontainer>
|
562
562
|
</section>
|
563
563
|
</part>'
|
564
564
|
end
|
@@ -570,17 +570,17 @@ Part 2
|
|
570
570
|
1. Section
|
571
571
|
Hello there
|
572
572
|
EOS
|
573
|
-
to_xml(node).should == '<part
|
573
|
+
to_xml(node).should == '<part eId="part_2">
|
574
574
|
<num>2</num>
|
575
575
|
<heading>The Part Heading</heading>
|
576
|
-
<section
|
576
|
+
<section eId="sec_1">
|
577
577
|
<num>1.</num>
|
578
578
|
<heading>Section</heading>
|
579
|
-
<
|
579
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
580
580
|
<content>
|
581
581
|
<p>Hello there</p>
|
582
582
|
</content>
|
583
|
-
</
|
583
|
+
</hcontainer>
|
584
584
|
</section>
|
585
585
|
</part>'
|
586
586
|
end
|
@@ -592,17 +592,17 @@ Part 2
|
|
592
592
|
1. Section
|
593
593
|
Hello there
|
594
594
|
EOS
|
595
|
-
to_xml(node).should == '<part
|
595
|
+
to_xml(node).should == '<part eId="part_2">
|
596
596
|
<num>2</num>
|
597
597
|
<heading>The <b>Part</b> Heading</heading>
|
598
|
-
<section
|
598
|
+
<section eId="sec_1">
|
599
599
|
<num>1.</num>
|
600
600
|
<heading>Section</heading>
|
601
|
-
<
|
601
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
602
602
|
<content>
|
603
603
|
<p>Hello there</p>
|
604
604
|
</content>
|
605
|
-
</
|
605
|
+
</hcontainer>
|
606
606
|
</section>
|
607
607
|
</part>'
|
608
608
|
end
|
@@ -613,17 +613,17 @@ Part 2 The **Part** Heading
|
|
613
613
|
1. Section
|
614
614
|
Hello there
|
615
615
|
EOS
|
616
|
-
to_xml(node).should == '<part
|
616
|
+
to_xml(node).should == '<part eId="part_2">
|
617
617
|
<num>2</num>
|
618
618
|
<heading>The <b>Part</b> Heading</heading>
|
619
|
-
<section
|
619
|
+
<section eId="sec_1">
|
620
620
|
<num>1.</num>
|
621
621
|
<heading>Section</heading>
|
622
|
-
<
|
622
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
623
623
|
<content>
|
624
624
|
<p>Hello there</p>
|
625
625
|
</content>
|
626
|
-
</
|
626
|
+
</hcontainer>
|
627
627
|
</section>
|
628
628
|
</part>'
|
629
629
|
end
|
@@ -636,17 +636,17 @@ PREVENTION AND SUPPRESSION OF HEALTH NUISANCES
|
|
636
636
|
1.
|
637
637
|
No owner or occupier of any shop or business premises or vacant land adjoining a shop or business premises shall cause a health nuisance.
|
638
638
|
EOS
|
639
|
-
to_xml(node).should == '<part
|
639
|
+
to_xml(node).should == '<part eId="part_1">
|
640
640
|
<num>1</num>
|
641
641
|
<heading>PREVENTION AND SUPPRESSION OF HEALTH NUISANCES</heading>
|
642
|
-
<section
|
642
|
+
<section eId="sec_1">
|
643
643
|
<num>1.</num>
|
644
644
|
<heading/>
|
645
|
-
<
|
645
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
646
646
|
<content>
|
647
647
|
<p>No owner or occupier of any shop or business premises or vacant land adjoining a shop or business premises shall cause a health nuisance.</p>
|
648
648
|
</content>
|
649
|
-
</
|
649
|
+
</hcontainer>
|
650
650
|
</section>
|
651
651
|
</part>'
|
652
652
|
end
|
@@ -663,22 +663,22 @@ Hello there
|
|
663
663
|
EOS
|
664
664
|
node.num.should == "2"
|
665
665
|
node.heading.heading.text_value.should == "\nThe Part Heading"
|
666
|
-
to_xml(node).should == '<part
|
666
|
+
to_xml(node).should == '<part eId="part_2">
|
667
667
|
<num>2</num>
|
668
668
|
<heading>The Part Heading</heading>
|
669
|
-
<
|
669
|
+
<hcontainer eId="part_2__hcontainer_1" name="hcontainer">
|
670
670
|
<content>
|
671
671
|
<p>Some text before the part.</p>
|
672
672
|
</content>
|
673
|
-
</
|
674
|
-
<section
|
673
|
+
</hcontainer>
|
674
|
+
<section eId="sec_1">
|
675
675
|
<num>1.</num>
|
676
676
|
<heading>Section</heading>
|
677
|
-
<
|
677
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
678
678
|
<content>
|
679
679
|
<p>Hello there</p>
|
680
680
|
</content>
|
681
|
-
</
|
681
|
+
</hcontainer>
|
682
682
|
</section>
|
683
683
|
</part>'
|
684
684
|
end
|
@@ -689,11 +689,11 @@ Part 2 The Part Heading
|
|
689
689
|
Part 3 The Other Heading
|
690
690
|
EOS
|
691
691
|
to_xml(node).should == '<body>
|
692
|
-
<part
|
692
|
+
<part eId="part_2">
|
693
693
|
<num>2</num>
|
694
694
|
<heading>The Part Heading</heading>
|
695
695
|
</part>
|
696
|
-
<part
|
696
|
+
<part eId="part_3">
|
697
697
|
<num>3</num>
|
698
698
|
<heading>The Other Heading</heading>
|
699
699
|
</part>
|
@@ -706,14 +706,14 @@ Part 2 The Part Heading
|
|
706
706
|
\\Part 3 ignored
|
707
707
|
EOS
|
708
708
|
to_xml(node).should == '<body>
|
709
|
-
<part
|
709
|
+
<part eId="part_2">
|
710
710
|
<num>2</num>
|
711
711
|
<heading>The Part Heading</heading>
|
712
|
-
<
|
712
|
+
<hcontainer eId="part_2__hcontainer_1" name="hcontainer">
|
713
713
|
<content>
|
714
714
|
<p>Part 3 ignored</p>
|
715
715
|
</content>
|
716
|
-
</
|
716
|
+
</hcontainer>
|
717
717
|
</part>
|
718
718
|
</body>'
|
719
719
|
end
|
@@ -730,26 +730,26 @@ Chapter 2 - Part One Chapter Two
|
|
730
730
|
|
731
731
|
one-two
|
732
732
|
EOS
|
733
|
-
to_xml(node).should == '<part
|
733
|
+
to_xml(node).should == '<part eId="part_1">
|
734
734
|
<num>1</num>
|
735
735
|
<heading>Part One</heading>
|
736
|
-
<chapter
|
736
|
+
<chapter eId="part_1__chp_1">
|
737
737
|
<num>1</num>
|
738
738
|
<heading>Part One Chapter One</heading>
|
739
|
-
<
|
739
|
+
<hcontainer eId="part_1__chp_1__hcontainer_1" name="hcontainer">
|
740
740
|
<content>
|
741
741
|
<p>one-one</p>
|
742
742
|
</content>
|
743
|
-
</
|
743
|
+
</hcontainer>
|
744
744
|
</chapter>
|
745
|
-
<chapter
|
745
|
+
<chapter eId="part_1__chp_2">
|
746
746
|
<num>2</num>
|
747
747
|
<heading>Part One Chapter Two</heading>
|
748
|
-
<
|
748
|
+
<hcontainer eId="part_1__chp_2__hcontainer_1" name="hcontainer">
|
749
749
|
<content>
|
750
750
|
<p>one-two</p>
|
751
751
|
</content>
|
752
|
-
</
|
752
|
+
</hcontainer>
|
753
753
|
</chapter>
|
754
754
|
</part>'
|
755
755
|
end
|
@@ -766,17 +766,17 @@ SUBPART 2 - Heading
|
|
766
766
|
1. Section
|
767
767
|
Hello there
|
768
768
|
EOS
|
769
|
-
to_xml(node).should == '<subpart
|
769
|
+
to_xml(node).should == '<subpart eId="subpart_2">
|
770
770
|
<num>2</num>
|
771
771
|
<heading>Heading</heading>
|
772
|
-
<section
|
772
|
+
<section eId="sec_1">
|
773
773
|
<num>1.</num>
|
774
774
|
<heading>Section</heading>
|
775
|
-
<
|
775
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
776
776
|
<content>
|
777
777
|
<p>Hello there</p>
|
778
778
|
</content>
|
779
|
-
</
|
779
|
+
</hcontainer>
|
780
780
|
</section>
|
781
781
|
</subpart>'
|
782
782
|
end
|
@@ -797,37 +797,58 @@ SUBPART 2 - The Subpart 2
|
|
797
797
|
|
798
798
|
Bye
|
799
799
|
EOS
|
800
|
-
to_xml(node).should == '<part
|
800
|
+
to_xml(node).should == '<part eId="part_A">
|
801
801
|
<num>A</num>
|
802
802
|
<heading>The Part</heading>
|
803
|
-
<subpart
|
803
|
+
<subpart eId="part_A__subpart_1">
|
804
804
|
<num>1</num>
|
805
805
|
<heading>The Subpart 1</heading>
|
806
|
-
<section
|
806
|
+
<section eId="sec_1">
|
807
807
|
<num>1.</num>
|
808
808
|
<heading>Section</heading>
|
809
|
-
<
|
809
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
810
810
|
<content>
|
811
811
|
<p>Hello</p>
|
812
812
|
</content>
|
813
|
-
</
|
813
|
+
</hcontainer>
|
814
814
|
</section>
|
815
815
|
</subpart>
|
816
|
-
<subpart
|
816
|
+
<subpart eId="part_A__subpart_2">
|
817
817
|
<num>2</num>
|
818
818
|
<heading>The Subpart 2</heading>
|
819
|
-
<section
|
819
|
+
<section eId="sec_2">
|
820
820
|
<num>2.</num>
|
821
821
|
<heading>Section</heading>
|
822
|
-
<
|
822
|
+
<hcontainer eId="sec_2__hcontainer_1" name="hcontainer">
|
823
823
|
<content>
|
824
824
|
<p>Bye</p>
|
825
825
|
</content>
|
826
|
-
</
|
826
|
+
</hcontainer>
|
827
827
|
</section>
|
828
828
|
</subpart>
|
829
829
|
</part>'
|
830
830
|
end
|
831
|
+
|
832
|
+
it 'should allow optional numbers' do
|
833
|
+
node = parse :subpart, <<EOS
|
834
|
+
SUBPART - Heading - with a dash
|
835
|
+
|
836
|
+
1. Section
|
837
|
+
Hello there
|
838
|
+
EOS
|
839
|
+
to_xml(node).should == '<subpart eId="subpart_1">
|
840
|
+
<heading>Heading - with a dash</heading>
|
841
|
+
<section eId="sec_1">
|
842
|
+
<num>1.</num>
|
843
|
+
<heading>Section</heading>
|
844
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
845
|
+
<content>
|
846
|
+
<p>Hello there</p>
|
847
|
+
</content>
|
848
|
+
</hcontainer>
|
849
|
+
</section>
|
850
|
+
</subpart>'
|
851
|
+
end
|
831
852
|
end
|
832
853
|
|
833
854
|
#-------------------------------------------------------------------------------
|
@@ -848,24 +869,24 @@ EOS
|
|
848
869
|
(c) three
|
849
870
|
(i) four
|
850
871
|
EOS
|
851
|
-
to_xml(node, "", 1).should == '<subsection
|
872
|
+
to_xml(node, "", 1).should == '<subsection eId="subsec_2">
|
852
873
|
<num>(2)</num>
|
853
874
|
<content>
|
854
875
|
<p>title</p>
|
855
|
-
<blockList
|
856
|
-
<item
|
876
|
+
<blockList eId="subsec_2__list_1" renest="true">
|
877
|
+
<item eId="subsec_2__list_1__item_a">
|
857
878
|
<num>(a)</num>
|
858
879
|
<p>one</p>
|
859
880
|
</item>
|
860
|
-
<item
|
881
|
+
<item eId="subsec_2__list_1__item_b">
|
861
882
|
<num>(b)</num>
|
862
883
|
<p>two</p>
|
863
884
|
</item>
|
864
|
-
<item
|
885
|
+
<item eId="subsec_2__list_1__item_c">
|
865
886
|
<num>(c)</num>
|
866
887
|
<p>three</p>
|
867
888
|
</item>
|
868
|
-
<item
|
889
|
+
<item eId="subsec_2__list_1__item_i">
|
869
890
|
<num>(i)</num>
|
870
891
|
<p>four</p>
|
871
892
|
</item>
|
@@ -882,23 +903,23 @@ EOS
|
|
882
903
|
(i) four
|
883
904
|
EOS
|
884
905
|
)
|
885
|
-
to_xml(node, "", 1).should == '<subsection
|
906
|
+
to_xml(node, "", 1).should == '<subsection eId="subsec_1">
|
886
907
|
<num>(1)</num>
|
887
908
|
<content>
|
888
|
-
<blockList
|
889
|
-
<item
|
909
|
+
<blockList eId="subsec_1__list_1" renest="true">
|
910
|
+
<item eId="subsec_1__list_1__item_a">
|
890
911
|
<num>(a)</num>
|
891
912
|
<p>one</p>
|
892
913
|
</item>
|
893
|
-
<item
|
914
|
+
<item eId="subsec_1__list_1__item_b">
|
894
915
|
<num>(b)</num>
|
895
916
|
<p>two</p>
|
896
917
|
</item>
|
897
|
-
<item
|
918
|
+
<item eId="subsec_1__list_1__item_c">
|
898
919
|
<num>(c)</num>
|
899
920
|
<p>three</p>
|
900
921
|
</item>
|
901
|
-
<item
|
922
|
+
<item eId="subsec_1__list_1__item_i">
|
902
923
|
<num>(i)</num>
|
903
924
|
<p>four</p>
|
904
925
|
</item>
|
@@ -914,15 +935,15 @@ EOS
|
|
914
935
|
(b) two
|
915
936
|
EOS
|
916
937
|
)
|
917
|
-
to_xml(node, "", 1).should == '<subsection
|
938
|
+
to_xml(node, "", 1).should == '<subsection eId="subsec_1">
|
918
939
|
<num>(1)</num>
|
919
940
|
<content>
|
920
|
-
<blockList
|
921
|
-
<item
|
941
|
+
<blockList eId="subsec_1__list_1" renest="true">
|
942
|
+
<item eId="subsec_1__list_1__item_a">
|
922
943
|
<num>(a)</num>
|
923
944
|
<p>one</p>
|
924
945
|
</item>
|
925
|
-
<item
|
946
|
+
<item eId="subsec_1__list_1__item_b">
|
926
947
|
<num>(b)</num>
|
927
948
|
<p>two</p>
|
928
949
|
</item>
|
@@ -940,22 +961,22 @@ EOS
|
|
940
961
|
(3) third
|
941
962
|
EOS
|
942
963
|
)
|
943
|
-
to_xml(node).should == '<section
|
964
|
+
to_xml(node).should == '<section eId="sec_1">
|
944
965
|
<num>1.</num>
|
945
966
|
<heading>Section</heading>
|
946
|
-
<subsection
|
967
|
+
<subsection eId="sec_1__subsec_1">
|
947
968
|
<num>(1)</num>
|
948
969
|
<content>
|
949
970
|
<p/>
|
950
971
|
</content>
|
951
972
|
</subsection>
|
952
|
-
<subsection
|
973
|
+
<subsection eId="sec_1__subsec_2">
|
953
974
|
<num>(2)</num>
|
954
975
|
<content>
|
955
976
|
<p>next line</p>
|
956
977
|
</content>
|
957
978
|
</subsection>
|
958
|
-
<subsection
|
979
|
+
<subsection eId="sec_1__subsec_3">
|
959
980
|
<num>(3)</num>
|
960
981
|
<content>
|
961
982
|
<p>third</p>
|
@@ -972,24 +993,24 @@ EOS
|
|
972
993
|
(ii) double
|
973
994
|
EOS
|
974
995
|
)
|
975
|
-
to_xml(node, "", 1).should == '<subsection
|
996
|
+
to_xml(node, "", 1).should == '<subsection eId="subsec_1">
|
976
997
|
<num>(1)</num>
|
977
998
|
<content>
|
978
999
|
<p>here\'s my really cool list,</p>
|
979
|
-
<blockList
|
980
|
-
<item
|
1000
|
+
<blockList eId="subsec_1__list_1" renest="true">
|
1001
|
+
<item eId="subsec_1__list_1__item_a">
|
981
1002
|
<num>(a)</num>
|
982
1003
|
<p>one</p>
|
983
1004
|
</item>
|
984
|
-
<item
|
1005
|
+
<item eId="subsec_1__list_1__item_b">
|
985
1006
|
<num>(b)</num>
|
986
1007
|
<p/>
|
987
1008
|
</item>
|
988
|
-
<item
|
1009
|
+
<item eId="subsec_1__list_1__item_i">
|
989
1010
|
<num>(i)</num>
|
990
1011
|
<p>single</p>
|
991
1012
|
</item>
|
992
|
-
<item
|
1013
|
+
<item eId="subsec_1__list_1__item_ii">
|
993
1014
|
<num>(ii)</num>
|
994
1015
|
<p>double</p>
|
995
1016
|
</item>
|
@@ -1006,24 +1027,24 @@ EOS
|
|
1006
1027
|
(ii) double
|
1007
1028
|
EOS
|
1008
1029
|
)
|
1009
|
-
to_xml(node, "", 1).should == '<subsection
|
1030
|
+
to_xml(node, "", 1).should == '<subsection eId="subsec_1">
|
1010
1031
|
<num>(1)</num>
|
1011
1032
|
<content>
|
1012
1033
|
<p>here\'s my really cool list,</p>
|
1013
|
-
<blockList
|
1014
|
-
<item
|
1034
|
+
<blockList eId="subsec_1__list_1" renest="true">
|
1035
|
+
<item eId="subsec_1__list_1__item_a">
|
1015
1036
|
<num>(a)</num>
|
1016
1037
|
<p/>
|
1017
1038
|
</item>
|
1018
|
-
<item
|
1039
|
+
<item eId="subsec_1__list_1__item_b">
|
1019
1040
|
<num>(b)</num>
|
1020
1041
|
<p/>
|
1021
1042
|
</item>
|
1022
|
-
<item
|
1043
|
+
<item eId="subsec_1__list_1__item_i">
|
1023
1044
|
<num>(i)</num>
|
1024
1045
|
<p>single</p>
|
1025
1046
|
</item>
|
1026
|
-
<item
|
1047
|
+
<item eId="subsec_1__list_1__item_ii">
|
1027
1048
|
<num>(ii)</num>
|
1028
1049
|
<p>double</p>
|
1029
1050
|
</item>
|
@@ -1036,10 +1057,32 @@ EOS
|
|
1036
1057
|
it 'should handle dotted number subsection numbers' do
|
1037
1058
|
node = parse :subsection, <<EOS
|
1038
1059
|
9.9. foo
|
1060
|
+
EOS
|
1061
|
+
node.num.should == "9.9"
|
1062
|
+
|
1063
|
+
node = parse :subsection, <<EOS
|
1064
|
+
9.9 foo
|
1039
1065
|
EOS
|
1040
1066
|
node.num.should == "9.9"
|
1041
1067
|
end
|
1042
1068
|
|
1069
|
+
it 'should handle dotted number and letter subsection numbers' do
|
1070
|
+
node = parse :subsection, <<EOS
|
1071
|
+
9.9A. foo
|
1072
|
+
EOS
|
1073
|
+
node.num.should == "9.9A"
|
1074
|
+
|
1075
|
+
node = parse :subsection, <<EOS
|
1076
|
+
9.9bis foo
|
1077
|
+
EOS
|
1078
|
+
node.num.should == "9.9bis"
|
1079
|
+
|
1080
|
+
node = parse :subsection, <<EOS
|
1081
|
+
9.9A foo
|
1082
|
+
EOS
|
1083
|
+
node.num.should == "9.9A"
|
1084
|
+
end
|
1085
|
+
|
1043
1086
|
it 'should handle dotted number sublists' do
|
1044
1087
|
node = parse(:subsection, <<EOS
|
1045
1088
|
9.9 foo
|
@@ -1048,20 +1091,20 @@ EOS
|
|
1048
1091
|
9.9.2.1 item3
|
1049
1092
|
EOS
|
1050
1093
|
)
|
1051
|
-
to_xml(node, '', 1).should == '<subsection
|
1094
|
+
to_xml(node, '', 1).should == '<subsection eId="subsec_9-9">
|
1052
1095
|
<num>9.9</num>
|
1053
1096
|
<content>
|
1054
1097
|
<p>foo</p>
|
1055
|
-
<blockList
|
1056
|
-
<item
|
1098
|
+
<blockList eId="subsec_9-9__list_1" renest="true">
|
1099
|
+
<item eId="subsec_9-9__list_1__item_9-9-1">
|
1057
1100
|
<num>9.9.1</num>
|
1058
1101
|
<p>item1</p>
|
1059
1102
|
</item>
|
1060
|
-
<item
|
1103
|
+
<item eId="subsec_9-9__list_1__item_9-9-2">
|
1061
1104
|
<num>9.9.2</num>
|
1062
1105
|
<p>item2</p>
|
1063
1106
|
</item>
|
1064
|
-
<item
|
1107
|
+
<item eId="subsec_9-9__list_1__item_9-9-2-1">
|
1065
1108
|
<num>9.9.2.1</num>
|
1066
1109
|
<p>item3</p>
|
1067
1110
|
</item>
|
@@ -1082,27 +1125,27 @@ EOS
|
|
1082
1125
|
EOS
|
1083
1126
|
)
|
1084
1127
|
|
1085
|
-
to_xml(node, '', 1).should == '<subsection
|
1128
|
+
to_xml(node, '', 1).should == '<subsection eId="subsec_1">
|
1086
1129
|
<num>(1)</num>
|
1087
1130
|
<content>
|
1088
1131
|
<p>a list</p>
|
1089
|
-
<blockList
|
1090
|
-
<item
|
1132
|
+
<blockList eId="subsec_1__list_1" renest="true">
|
1133
|
+
<item eId="subsec_1__list_1__item_a">
|
1091
1134
|
<num>(a)</num>
|
1092
1135
|
<p>item 1</p>
|
1093
1136
|
</item>
|
1094
|
-
<item
|
1137
|
+
<item eId="subsec_1__list_1__item_b">
|
1095
1138
|
<num>(b)</num>
|
1096
1139
|
<p>item 2</p>
|
1097
1140
|
</item>
|
1098
1141
|
</blockList>
|
1099
1142
|
<p>some text</p>
|
1100
|
-
<blockList
|
1101
|
-
<item
|
1143
|
+
<blockList eId="subsec_1__list_2" renest="true">
|
1144
|
+
<item eId="subsec_1__list_2__item_c">
|
1102
1145
|
<num>(c)</num>
|
1103
1146
|
<p>item 3</p>
|
1104
1147
|
</item>
|
1105
|
-
<item
|
1148
|
+
<item eId="subsec_1__list_2__item_d">
|
1106
1149
|
<num>(d)</num>
|
1107
1150
|
<p>item 4</p>
|
1108
1151
|
</item>
|
@@ -1122,7 +1165,7 @@ EOS
|
|
1122
1165
|
EOS
|
1123
1166
|
)
|
1124
1167
|
|
1125
|
-
to_xml(node, '', 1).should == '<subsection
|
1168
|
+
to_xml(node, '', 1).should == '<subsection eId="subsec_1">
|
1126
1169
|
<num>(1)</num>
|
1127
1170
|
<content>
|
1128
1171
|
<p>a subsection</p>
|
@@ -1143,16 +1186,16 @@ EOS
|
|
1143
1186
|
(3) Part 1
|
1144
1187
|
EOS
|
1145
1188
|
to_xml(node).should == '<body>
|
1146
|
-
<section
|
1189
|
+
<section eId="sec_1">
|
1147
1190
|
<num>1.</num>
|
1148
1191
|
<heading>Section</heading>
|
1149
|
-
<subsection
|
1192
|
+
<subsection eId="sec_1__subsec_2">
|
1150
1193
|
<num>(2)</num>
|
1151
1194
|
<content>
|
1152
1195
|
<p>Schedule 1 is cool.</p>
|
1153
1196
|
</content>
|
1154
1197
|
</subsection>
|
1155
|
-
<subsection
|
1198
|
+
<subsection eId="sec_1__subsec_3">
|
1156
1199
|
<num>(3)</num>
|
1157
1200
|
<content>
|
1158
1201
|
<p>Part 1</p>
|
@@ -1203,13 +1246,13 @@ baz
|
|
1203
1246
|
</preface>'
|
1204
1247
|
|
1205
1248
|
today = Time.now.strftime('%Y-%m-%d')
|
1206
|
-
to_xml(node, "").should == '<act contains="originalVersion">
|
1249
|
+
to_xml(node, "").should == '<act contains="originalVersion" name="act">
|
1207
1250
|
<meta>
|
1208
1251
|
<identification source="#slaw">
|
1209
1252
|
<FRBRWork>
|
1210
1253
|
<FRBRthis value="/za/act/1980/01/main"/>
|
1211
1254
|
<FRBRuri value="/za/act/1980/01"/>
|
1212
|
-
<FRBRalias value="Short Title"/>
|
1255
|
+
<FRBRalias value="Short Title" name="title"/>
|
1213
1256
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
1214
1257
|
<FRBRauthor href="#council"/>
|
1215
1258
|
<FRBRcountry value="za"/>
|
@@ -1229,8 +1272,8 @@ baz
|
|
1229
1272
|
</FRBRManifestation>
|
1230
1273
|
</identification>
|
1231
1274
|
<references source="#this">
|
1232
|
-
<TLCOrganization
|
1233
|
-
<TLCOrganization
|
1275
|
+
<TLCOrganization eId="slaw" href="https://github.com/longhotsummer/slaw" showAs="Slaw"/>
|
1276
|
+
<TLCOrganization eId="council" href="/ontology/organization/za/council" showAs="Council"/>
|
1234
1277
|
</references>
|
1235
1278
|
</meta>
|
1236
1279
|
<preface>
|
@@ -1241,10 +1284,10 @@ baz
|
|
1241
1284
|
<p>baz</p>
|
1242
1285
|
</preface>
|
1243
1286
|
<body>
|
1244
|
-
<section
|
1287
|
+
<section eId="sec_1">
|
1245
1288
|
<num>1.</num>
|
1246
1289
|
<heading>Section</heading>
|
1247
|
-
<subsection
|
1290
|
+
<subsection eId="sec_1__subsec_1">
|
1248
1291
|
<num>(1)</num>
|
1249
1292
|
<content>
|
1250
1293
|
<p>hello</p>
|
@@ -1374,11 +1417,11 @@ EOS
|
|
1374
1417
|
<p>this is in the preamble</p>
|
1375
1418
|
</preamble>'
|
1376
1419
|
to_xml(node.body).should == '<body>
|
1377
|
-
<
|
1420
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
1378
1421
|
<content>
|
1379
1422
|
<p>this is in the body</p>
|
1380
1423
|
</content>
|
1381
|
-
</
|
1424
|
+
</hcontainer>
|
1382
1425
|
</body>'
|
1383
1426
|
end
|
1384
1427
|
end
|
@@ -1464,12 +1507,12 @@ this is actually in the body
|
|
1464
1507
|
EOS
|
1465
1508
|
|
1466
1509
|
to_xml(node.body).should == '<body>
|
1467
|
-
<
|
1510
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
1468
1511
|
<content>
|
1469
1512
|
<p>PREAMBLE</p>
|
1470
1513
|
<p>this is actually in the body</p>
|
1471
1514
|
</content>
|
1472
|
-
</
|
1515
|
+
</hcontainer>
|
1473
1516
|
</body>'
|
1474
1517
|
end
|
1475
1518
|
|
@@ -1485,12 +1528,12 @@ this is actually in the body
|
|
1485
1528
|
EOS
|
1486
1529
|
|
1487
1530
|
to_xml(node.body).should == '<body>
|
1488
|
-
<
|
1531
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
1489
1532
|
<content>
|
1490
1533
|
<p>PREFACE</p>
|
1491
1534
|
<p>this is actually in the body</p>
|
1492
1535
|
</content>
|
1493
|
-
</
|
1536
|
+
</hcontainer>
|
1494
1537
|
</body>'
|
1495
1538
|
end
|
1496
1539
|
end
|
@@ -1507,10 +1550,10 @@ Section
|
|
1507
1550
|
EOS
|
1508
1551
|
|
1509
1552
|
s = to_xml(node)
|
1510
|
-
s.should == '<section
|
1553
|
+
s.should == '<section eId="sec_1">
|
1511
1554
|
<num>1.</num>
|
1512
1555
|
<heading>Section</heading>
|
1513
|
-
<subsection
|
1556
|
+
<subsection eId="sec_1__subsec_1">
|
1514
1557
|
<num>(1)</num>
|
1515
1558
|
<content>
|
1516
1559
|
<p>hello</p>
|
@@ -1526,10 +1569,10 @@ EOS
|
|
1526
1569
|
(1) hello
|
1527
1570
|
EOS
|
1528
1571
|
s = to_xml(node)
|
1529
|
-
s.should == '<section
|
1572
|
+
s.should == '<section eId="sec_1">
|
1530
1573
|
<num>1.</num>
|
1531
1574
|
<heading>Section</heading>
|
1532
|
-
<subsection
|
1575
|
+
<subsection eId="sec_1__subsec_1">
|
1533
1576
|
<num>(1)</num>
|
1534
1577
|
<content>
|
1535
1578
|
<p>hello</p>
|
@@ -1548,20 +1591,20 @@ EOS
|
|
1548
1591
|
EOS
|
1549
1592
|
s = to_xml(node)
|
1550
1593
|
s.should == '<body>
|
1551
|
-
<section
|
1594
|
+
<section eId="sec_1">
|
1552
1595
|
<num>1.</num>
|
1553
1596
|
<heading>A section</heading>
|
1554
|
-
<subsection
|
1597
|
+
<subsection eId="sec_1__subsec_1">
|
1555
1598
|
<num>(1)</num>
|
1556
1599
|
<content>
|
1557
1600
|
<p>hello</p>
|
1558
1601
|
</content>
|
1559
1602
|
</subsection>
|
1560
1603
|
</section>
|
1561
|
-
<section
|
1604
|
+
<section eId="sec_2">
|
1562
1605
|
<num>2.</num>
|
1563
1606
|
<heading>Another section</heading>
|
1564
|
-
<subsection
|
1607
|
+
<subsection eId="sec_2__subsec_2">
|
1565
1608
|
<num>(2)</num>
|
1566
1609
|
<content>
|
1567
1610
|
<p>Another line</p>
|
@@ -1578,16 +1621,16 @@ EOS
|
|
1578
1621
|
(2) Without limiting generality, stuff.
|
1579
1622
|
EOS
|
1580
1623
|
s = to_xml(node)
|
1581
|
-
s.should == '<section
|
1624
|
+
s.should == '<section eId="sec_10">
|
1582
1625
|
<num>10.</num>
|
1583
1626
|
<heading/>
|
1584
|
-
<subsection
|
1627
|
+
<subsection eId="sec_10__subsec_1">
|
1585
1628
|
<num>(1)</num>
|
1586
1629
|
<content>
|
1587
1630
|
<p>Transporters must remove medical waste.</p>
|
1588
1631
|
</content>
|
1589
1632
|
</subsection>
|
1590
|
-
<subsection
|
1633
|
+
<subsection eId="sec_10__subsec_2">
|
1591
1634
|
<num>(2)</num>
|
1592
1635
|
<content>
|
1593
1636
|
<p>Without limiting generality, stuff.</p>
|
@@ -1606,24 +1649,24 @@ and some stuff
|
|
1606
1649
|
EOS
|
1607
1650
|
|
1608
1651
|
s = to_xml(node)
|
1609
|
-
s.should == '<section
|
1652
|
+
s.should == '<section eId="sec_1">
|
1610
1653
|
<num>1.</num>
|
1611
1654
|
<heading>Section</heading>
|
1612
|
-
<
|
1655
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1613
1656
|
<content>
|
1614
|
-
<blockList
|
1615
|
-
<item
|
1657
|
+
<blockList eId="sec_1__hcontainer_1__list_1" renest="true">
|
1658
|
+
<item eId="sec_1__hcontainer_1__list_1__item_a">
|
1616
1659
|
<num>(a)</num>
|
1617
1660
|
<p>first</p>
|
1618
1661
|
</item>
|
1619
|
-
<item
|
1662
|
+
<item eId="sec_1__hcontainer_1__list_1__item_b">
|
1620
1663
|
<num>(b)</num>
|
1621
1664
|
<p>second</p>
|
1622
1665
|
</item>
|
1623
1666
|
</blockList>
|
1624
1667
|
<p>and some stuff</p>
|
1625
1668
|
</content>
|
1626
|
-
</
|
1669
|
+
</hcontainer>
|
1627
1670
|
</section>'
|
1628
1671
|
end
|
1629
1672
|
|
@@ -1636,14 +1679,14 @@ something
|
|
1636
1679
|
EOS
|
1637
1680
|
|
1638
1681
|
s = to_xml(node)
|
1639
|
-
s.should == '<section
|
1682
|
+
s.should == '<section eId="sec_1">
|
1640
1683
|
<num>1.</num>
|
1641
1684
|
<heading>Section <b>bold</b> <ref href="/za/act/1990/1">foo</ref></heading>
|
1642
|
-
<
|
1685
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1643
1686
|
<content>
|
1644
1687
|
<p>something</p>
|
1645
1688
|
</content>
|
1646
|
-
</
|
1689
|
+
</hcontainer>
|
1647
1690
|
</section>'
|
1648
1691
|
end
|
1649
1692
|
|
@@ -1657,14 +1700,14 @@ something
|
|
1657
1700
|
EOS
|
1658
1701
|
|
1659
1702
|
s = to_xml(node)
|
1660
|
-
s.should == '<section
|
1703
|
+
s.should == '<section eId="sec_1">
|
1661
1704
|
<num>1.</num>
|
1662
1705
|
<heading>Section <b>bold</b> <ref href="/za/act/1990/1">foo</ref></heading>
|
1663
|
-
<
|
1706
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1664
1707
|
<content>
|
1665
1708
|
<p>something</p>
|
1666
1709
|
</content>
|
1667
|
-
</
|
1710
|
+
</hcontainer>
|
1668
1711
|
</section>'
|
1669
1712
|
end
|
1670
1713
|
|
@@ -1683,24 +1726,24 @@ naked statement (c) blah
|
|
1683
1726
|
(a) foo
|
1684
1727
|
(b) bar
|
1685
1728
|
EOS
|
1686
|
-
to_xml(node, "").should == '<section
|
1729
|
+
to_xml(node, "").should == '<section eId="sec_1">
|
1687
1730
|
<num>1.</num>
|
1688
1731
|
<heading>Section</heading>
|
1689
|
-
<
|
1732
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1690
1733
|
<content>
|
1691
1734
|
<p>naked statement (c) blah</p>
|
1692
|
-
<blockList
|
1693
|
-
<item
|
1735
|
+
<blockList eId="sec_1__hcontainer_1__list_1" renest="true">
|
1736
|
+
<item eId="sec_1__hcontainer_1__list_1__item_a">
|
1694
1737
|
<num>(a)</num>
|
1695
1738
|
<p>foo</p>
|
1696
1739
|
</item>
|
1697
|
-
<item
|
1740
|
+
<item eId="sec_1__hcontainer_1__list_1__item_b">
|
1698
1741
|
<num>(b)</num>
|
1699
1742
|
<p>bar</p>
|
1700
1743
|
</item>
|
1701
1744
|
</blockList>
|
1702
1745
|
</content>
|
1703
|
-
</
|
1746
|
+
</hcontainer>
|
1704
1747
|
</section>'
|
1705
1748
|
end
|
1706
1749
|
|
@@ -1718,25 +1761,25 @@ something
|
|
1718
1761
|
|
1719
1762
|
(b) thing
|
1720
1763
|
EOS
|
1721
|
-
to_xml(node, "").should == '<section
|
1764
|
+
to_xml(node, "").should == '<section eId="sec_1">
|
1722
1765
|
<num>1.</num>
|
1723
1766
|
<heading>Section</heading>
|
1724
|
-
<subsection
|
1767
|
+
<subsection eId="sec_1__subsec_1">
|
1725
1768
|
<num>(1)</num>
|
1726
1769
|
<content>
|
1727
1770
|
<p>something</p>
|
1728
1771
|
</content>
|
1729
1772
|
</subsection>
|
1730
|
-
<subsection
|
1773
|
+
<subsection eId="sec_1__subsec_2">
|
1731
1774
|
<num>(2)</num>
|
1732
1775
|
<content>
|
1733
1776
|
<p>Schedule 1</p>
|
1734
|
-
<blockList
|
1735
|
-
<item
|
1777
|
+
<blockList eId="sec_1__subsec_2__list_1" renest="true">
|
1778
|
+
<item eId="sec_1__subsec_2__list_1__item_a">
|
1736
1779
|
<num>(a)</num>
|
1737
1780
|
<p>Part 1</p>
|
1738
1781
|
</item>
|
1739
|
-
<item
|
1782
|
+
<item eId="sec_1__subsec_2__list_1__item_b">
|
1740
1783
|
<num>(b)</num>
|
1741
1784
|
<p>thing</p>
|
1742
1785
|
</item>
|
@@ -1755,17 +1798,17 @@ EOS
|
|
1755
1798
|
stuff
|
1756
1799
|
\\3. a third
|
1757
1800
|
EOS
|
1758
|
-
to_xml(node, "").should == '<section
|
1801
|
+
to_xml(node, "").should == '<section eId="sec_1">
|
1759
1802
|
<num>1.</num>
|
1760
1803
|
<heading>Section</heading>
|
1761
|
-
<
|
1804
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1762
1805
|
<content>
|
1763
1806
|
<p>1. ignored</p>
|
1764
1807
|
<p>2. another line</p>
|
1765
1808
|
<p>stuff</p>
|
1766
1809
|
<p>3. a third</p>
|
1767
1810
|
</content>
|
1768
|
-
</
|
1811
|
+
</hcontainer>
|
1769
1812
|
</section>'
|
1770
1813
|
end
|
1771
1814
|
|
@@ -1777,14 +1820,14 @@ EOS
|
|
1777
1820
|
|
1778
1821
|
stuff
|
1779
1822
|
EOS
|
1780
|
-
to_xml(node, "").should == '<section
|
1823
|
+
to_xml(node, "").should == '<section eId="sec_1">
|
1781
1824
|
<num>1.</num>
|
1782
1825
|
<heading>Section</heading>
|
1783
|
-
<
|
1826
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1784
1827
|
<content>
|
1785
1828
|
<p>stuff</p>
|
1786
1829
|
</content>
|
1787
|
-
</
|
1830
|
+
</hcontainer>
|
1788
1831
|
</section>'
|
1789
1832
|
end
|
1790
1833
|
|
@@ -1796,19 +1839,19 @@ Informal trading may include, amongst others:-
|
|
1796
1839
|
3.1.1 street trading;
|
1797
1840
|
3.1.2 trading in pedestrian malls;
|
1798
1841
|
EOS
|
1799
|
-
to_xml(node, '').should == '<section
|
1842
|
+
to_xml(node, '').should == '<section eId="sec_3">
|
1800
1843
|
<num>3.</num>
|
1801
1844
|
<heading>Types of informal trading</heading>
|
1802
|
-
<subsection
|
1845
|
+
<subsection eId="sec_3__subsec_3-1">
|
1803
1846
|
<num>3.1</num>
|
1804
1847
|
<content>
|
1805
1848
|
<p>Informal trading may include, amongst others:-</p>
|
1806
|
-
<blockList
|
1807
|
-
<item
|
1849
|
+
<blockList eId="sec_3__subsec_3-1__list_1" renest="true">
|
1850
|
+
<item eId="sec_3__subsec_3-1__list_1__item_3-1-1">
|
1808
1851
|
<num>3.1.1</num>
|
1809
1852
|
<p>street trading;</p>
|
1810
1853
|
</item>
|
1811
|
-
<item
|
1854
|
+
<item eId="sec_3__subsec_3-1__list_1__item_3-1-2">
|
1812
1855
|
<num>3.1.2</num>
|
1813
1856
|
<p>trading in pedestrian malls;</p>
|
1814
1857
|
</item>
|
@@ -1825,7 +1868,7 @@ EOS
|
|
1825
1868
|
context 'crossheadings' do
|
1826
1869
|
it 'should handle a inline_items in crossheadings' do
|
1827
1870
|
node = parse :crossheading, "CROSSHEADING something [[remark]] [link](/foo/bar)\n"
|
1828
|
-
to_xml(node, '').should == '<hcontainer
|
1871
|
+
to_xml(node, '').should == '<hcontainer eId="hcontainer_1" name="crossheading">
|
1829
1872
|
<heading>something <remark status="editorial">[remark]</remark> <ref href="/foo/bar">link</ref></heading>
|
1830
1873
|
</hcontainer>'
|
1831
1874
|
end
|
@@ -1843,13 +1886,13 @@ CROSSHEADING In the body
|
|
1843
1886
|
Text
|
1844
1887
|
'
|
1845
1888
|
today = Time.now.strftime('%Y-%m-%d')
|
1846
|
-
to_xml(node, "").should == '<act contains="originalVersion">
|
1889
|
+
to_xml(node, "").should == '<act contains="originalVersion" name="act">
|
1847
1890
|
<meta>
|
1848
1891
|
<identification source="#slaw">
|
1849
1892
|
<FRBRWork>
|
1850
1893
|
<FRBRthis value="/za/act/1980/01/main"/>
|
1851
1894
|
<FRBRuri value="/za/act/1980/01"/>
|
1852
|
-
<FRBRalias value="Short Title"/>
|
1895
|
+
<FRBRalias value="Short Title" name="title"/>
|
1853
1896
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
1854
1897
|
<FRBRauthor href="#council"/>
|
1855
1898
|
<FRBRcountry value="za"/>
|
@@ -1869,25 +1912,25 @@ Text
|
|
1869
1912
|
</FRBRManifestation>
|
1870
1913
|
</identification>
|
1871
1914
|
<references source="#this">
|
1872
|
-
<TLCOrganization
|
1873
|
-
<TLCOrganization
|
1915
|
+
<TLCOrganization eId="slaw" href="https://github.com/longhotsummer/slaw" showAs="Slaw"/>
|
1916
|
+
<TLCOrganization eId="council" href="/ontology/organization/za/council" showAs="Council"/>
|
1874
1917
|
</references>
|
1875
1918
|
</meta>
|
1876
1919
|
<preface>
|
1877
1920
|
<p>Some text</p>
|
1878
1921
|
</preface>
|
1879
1922
|
<body>
|
1880
|
-
<hcontainer
|
1923
|
+
<hcontainer eId="hcontainer_1" name="crossheading">
|
1881
1924
|
<heading>In the body</heading>
|
1882
1925
|
</hcontainer>
|
1883
|
-
<section
|
1926
|
+
<section eId="sec_1">
|
1884
1927
|
<num>1.</num>
|
1885
1928
|
<heading>Section 1</heading>
|
1886
|
-
<
|
1929
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1887
1930
|
<content>
|
1888
1931
|
<p>Text</p>
|
1889
1932
|
</content>
|
1890
|
-
</
|
1933
|
+
</hcontainer>
|
1891
1934
|
</section>
|
1892
1935
|
</body>
|
1893
1936
|
</act>'
|
@@ -1906,13 +1949,13 @@ CROSSHEADING In the body
|
|
1906
1949
|
Text
|
1907
1950
|
'
|
1908
1951
|
today = Time.now.strftime('%Y-%m-%d')
|
1909
|
-
to_xml(node, "").should == '<act contains="originalVersion">
|
1952
|
+
to_xml(node, "").should == '<act contains="originalVersion" name="act">
|
1910
1953
|
<meta>
|
1911
1954
|
<identification source="#slaw">
|
1912
1955
|
<FRBRWork>
|
1913
1956
|
<FRBRthis value="/za/act/1980/01/main"/>
|
1914
1957
|
<FRBRuri value="/za/act/1980/01"/>
|
1915
|
-
<FRBRalias value="Short Title"/>
|
1958
|
+
<FRBRalias value="Short Title" name="title"/>
|
1916
1959
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
1917
1960
|
<FRBRauthor href="#council"/>
|
1918
1961
|
<FRBRcountry value="za"/>
|
@@ -1932,25 +1975,25 @@ Text
|
|
1932
1975
|
</FRBRManifestation>
|
1933
1976
|
</identification>
|
1934
1977
|
<references source="#this">
|
1935
|
-
<TLCOrganization
|
1936
|
-
<TLCOrganization
|
1978
|
+
<TLCOrganization eId="slaw" href="https://github.com/longhotsummer/slaw" showAs="Slaw"/>
|
1979
|
+
<TLCOrganization eId="council" href="/ontology/organization/za/council" showAs="Council"/>
|
1937
1980
|
</references>
|
1938
1981
|
</meta>
|
1939
1982
|
<preamble>
|
1940
1983
|
<p>Some text</p>
|
1941
1984
|
</preamble>
|
1942
1985
|
<body>
|
1943
|
-
<hcontainer
|
1986
|
+
<hcontainer eId="hcontainer_1" name="crossheading">
|
1944
1987
|
<heading>In the body</heading>
|
1945
1988
|
</hcontainer>
|
1946
|
-
<section
|
1989
|
+
<section eId="sec_1">
|
1947
1990
|
<num>1.</num>
|
1948
1991
|
<heading>Section 1</heading>
|
1949
|
-
<
|
1992
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1950
1993
|
<content>
|
1951
1994
|
<p>Text</p>
|
1952
1995
|
</content>
|
1953
|
-
</
|
1996
|
+
</hcontainer>
|
1954
1997
|
</section>
|
1955
1998
|
</body>
|
1956
1999
|
</act>'
|
@@ -2014,14 +2057,14 @@ LONGTITLE a long title
|
|
2014
2057
|
EOS
|
2015
2058
|
|
2016
2059
|
to_xml(node).should == '<body>
|
2017
|
-
<section
|
2060
|
+
<section eId="sec_1">
|
2018
2061
|
<num>1.</num>
|
2019
2062
|
<heading>Section</heading>
|
2020
|
-
<
|
2063
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
2021
2064
|
<content>
|
2022
2065
|
<p>LONGTITLE a long title</p>
|
2023
2066
|
</content>
|
2024
|
-
</
|
2067
|
+
</hcontainer>
|
2025
2068
|
</section>
|
2026
2069
|
</body>'
|
2027
2070
|
end
|