slaw 8.0.0 → 10.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.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +31 -1
- data/bin/slaw +7 -1
- data/lib/slaw/grammars/counters.rb +22 -5
- data/lib/slaw/grammars/schedules_nodes.rb +13 -16
- data/lib/slaw/grammars/tables_nodes.rb +3 -1
- data/lib/slaw/grammars/terminals.treetop +5 -1
- data/lib/slaw/grammars/za/act.treetop +26 -7
- data/lib/slaw/grammars/za/act_nodes.rb +66 -29
- data/lib/slaw/grammars/za/act_text.xsl +17 -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 +367 -249
- data/spec/za/act_inline_spec.rb +67 -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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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">
|
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,31 +730,127 @@ 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">
|
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">
|
749
749
|
<content>
|
750
750
|
<p>one-two</p>
|
751
751
|
</content>
|
752
|
-
</
|
752
|
+
</hcontainer>
|
753
753
|
</chapter>
|
754
754
|
</part>'
|
755
755
|
end
|
756
756
|
end
|
757
757
|
|
758
|
+
#-------------------------------------------------------------------------------
|
759
|
+
# Subparts
|
760
|
+
|
761
|
+
describe 'subparts' do
|
762
|
+
it 'should handle subparts' do
|
763
|
+
node = parse :subpart, <<EOS
|
764
|
+
SUBPART 2 - Heading
|
765
|
+
|
766
|
+
1. Section
|
767
|
+
Hello there
|
768
|
+
EOS
|
769
|
+
to_xml(node).should == '<subpart eId="subpart_2">
|
770
|
+
<num>2</num>
|
771
|
+
<heading>Heading</heading>
|
772
|
+
<section eId="sec_1">
|
773
|
+
<num>1.</num>
|
774
|
+
<heading>Section</heading>
|
775
|
+
<hcontainer eId="sec_1__hcontainer_1">
|
776
|
+
<content>
|
777
|
+
<p>Hello there</p>
|
778
|
+
</content>
|
779
|
+
</hcontainer>
|
780
|
+
</section>
|
781
|
+
</subpart>'
|
782
|
+
end
|
783
|
+
|
784
|
+
it 'should handle subparts in parts' do
|
785
|
+
node = parse :part, <<EOS
|
786
|
+
PART A - The Part
|
787
|
+
|
788
|
+
SUBPART 1 - The Subpart 1
|
789
|
+
|
790
|
+
1. Section
|
791
|
+
|
792
|
+
Hello
|
793
|
+
|
794
|
+
SUBPART 2 - The Subpart 2
|
795
|
+
|
796
|
+
2. Section
|
797
|
+
|
798
|
+
Bye
|
799
|
+
EOS
|
800
|
+
to_xml(node).should == '<part eId="part_A">
|
801
|
+
<num>A</num>
|
802
|
+
<heading>The Part</heading>
|
803
|
+
<subpart eId="part_A__subpart_1">
|
804
|
+
<num>1</num>
|
805
|
+
<heading>The Subpart 1</heading>
|
806
|
+
<section eId="sec_1">
|
807
|
+
<num>1.</num>
|
808
|
+
<heading>Section</heading>
|
809
|
+
<hcontainer eId="sec_1__hcontainer_1">
|
810
|
+
<content>
|
811
|
+
<p>Hello</p>
|
812
|
+
</content>
|
813
|
+
</hcontainer>
|
814
|
+
</section>
|
815
|
+
</subpart>
|
816
|
+
<subpart eId="part_A__subpart_2">
|
817
|
+
<num>2</num>
|
818
|
+
<heading>The Subpart 2</heading>
|
819
|
+
<section eId="sec_2">
|
820
|
+
<num>2.</num>
|
821
|
+
<heading>Section</heading>
|
822
|
+
<hcontainer eId="sec_2__hcontainer_1">
|
823
|
+
<content>
|
824
|
+
<p>Bye</p>
|
825
|
+
</content>
|
826
|
+
</hcontainer>
|
827
|
+
</section>
|
828
|
+
</subpart>
|
829
|
+
</part>'
|
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">
|
845
|
+
<content>
|
846
|
+
<p>Hello there</p>
|
847
|
+
</content>
|
848
|
+
</hcontainer>
|
849
|
+
</section>
|
850
|
+
</subpart>'
|
851
|
+
end
|
852
|
+
end
|
853
|
+
|
758
854
|
#-------------------------------------------------------------------------------
|
759
855
|
# Subsections
|
760
856
|
|
@@ -773,24 +869,24 @@ EOS
|
|
773
869
|
(c) three
|
774
870
|
(i) four
|
775
871
|
EOS
|
776
|
-
to_xml(node, "", 1).should == '<subsection
|
872
|
+
to_xml(node, "", 1).should == '<subsection eId="subsec_2">
|
777
873
|
<num>(2)</num>
|
778
874
|
<content>
|
779
875
|
<p>title</p>
|
780
|
-
<blockList
|
781
|
-
<item
|
876
|
+
<blockList eId="subsec_2__list_1" renest="true">
|
877
|
+
<item eId="subsec_2__list_1__item_a">
|
782
878
|
<num>(a)</num>
|
783
879
|
<p>one</p>
|
784
880
|
</item>
|
785
|
-
<item
|
881
|
+
<item eId="subsec_2__list_1__item_b">
|
786
882
|
<num>(b)</num>
|
787
883
|
<p>two</p>
|
788
884
|
</item>
|
789
|
-
<item
|
885
|
+
<item eId="subsec_2__list_1__item_c">
|
790
886
|
<num>(c)</num>
|
791
887
|
<p>three</p>
|
792
888
|
</item>
|
793
|
-
<item
|
889
|
+
<item eId="subsec_2__list_1__item_i">
|
794
890
|
<num>(i)</num>
|
795
891
|
<p>four</p>
|
796
892
|
</item>
|
@@ -807,23 +903,23 @@ EOS
|
|
807
903
|
(i) four
|
808
904
|
EOS
|
809
905
|
)
|
810
|
-
to_xml(node, "", 1).should == '<subsection
|
906
|
+
to_xml(node, "", 1).should == '<subsection eId="subsec_1">
|
811
907
|
<num>(1)</num>
|
812
908
|
<content>
|
813
|
-
<blockList
|
814
|
-
<item
|
909
|
+
<blockList eId="subsec_1__list_1" renest="true">
|
910
|
+
<item eId="subsec_1__list_1__item_a">
|
815
911
|
<num>(a)</num>
|
816
912
|
<p>one</p>
|
817
913
|
</item>
|
818
|
-
<item
|
914
|
+
<item eId="subsec_1__list_1__item_b">
|
819
915
|
<num>(b)</num>
|
820
916
|
<p>two</p>
|
821
917
|
</item>
|
822
|
-
<item
|
918
|
+
<item eId="subsec_1__list_1__item_c">
|
823
919
|
<num>(c)</num>
|
824
920
|
<p>three</p>
|
825
921
|
</item>
|
826
|
-
<item
|
922
|
+
<item eId="subsec_1__list_1__item_i">
|
827
923
|
<num>(i)</num>
|
828
924
|
<p>four</p>
|
829
925
|
</item>
|
@@ -839,15 +935,15 @@ EOS
|
|
839
935
|
(b) two
|
840
936
|
EOS
|
841
937
|
)
|
842
|
-
to_xml(node, "", 1).should == '<subsection
|
938
|
+
to_xml(node, "", 1).should == '<subsection eId="subsec_1">
|
843
939
|
<num>(1)</num>
|
844
940
|
<content>
|
845
|
-
<blockList
|
846
|
-
<item
|
941
|
+
<blockList eId="subsec_1__list_1" renest="true">
|
942
|
+
<item eId="subsec_1__list_1__item_a">
|
847
943
|
<num>(a)</num>
|
848
944
|
<p>one</p>
|
849
945
|
</item>
|
850
|
-
<item
|
946
|
+
<item eId="subsec_1__list_1__item_b">
|
851
947
|
<num>(b)</num>
|
852
948
|
<p>two</p>
|
853
949
|
</item>
|
@@ -865,22 +961,22 @@ EOS
|
|
865
961
|
(3) third
|
866
962
|
EOS
|
867
963
|
)
|
868
|
-
to_xml(node).should == '<section
|
964
|
+
to_xml(node).should == '<section eId="sec_1">
|
869
965
|
<num>1.</num>
|
870
966
|
<heading>Section</heading>
|
871
|
-
<subsection
|
967
|
+
<subsection eId="sec_1__subsec_1">
|
872
968
|
<num>(1)</num>
|
873
969
|
<content>
|
874
970
|
<p/>
|
875
971
|
</content>
|
876
972
|
</subsection>
|
877
|
-
<subsection
|
973
|
+
<subsection eId="sec_1__subsec_2">
|
878
974
|
<num>(2)</num>
|
879
975
|
<content>
|
880
976
|
<p>next line</p>
|
881
977
|
</content>
|
882
978
|
</subsection>
|
883
|
-
<subsection
|
979
|
+
<subsection eId="sec_1__subsec_3">
|
884
980
|
<num>(3)</num>
|
885
981
|
<content>
|
886
982
|
<p>third</p>
|
@@ -897,24 +993,24 @@ EOS
|
|
897
993
|
(ii) double
|
898
994
|
EOS
|
899
995
|
)
|
900
|
-
to_xml(node, "", 1).should == '<subsection
|
996
|
+
to_xml(node, "", 1).should == '<subsection eId="subsec_1">
|
901
997
|
<num>(1)</num>
|
902
998
|
<content>
|
903
999
|
<p>here\'s my really cool list,</p>
|
904
|
-
<blockList
|
905
|
-
<item
|
1000
|
+
<blockList eId="subsec_1__list_1" renest="true">
|
1001
|
+
<item eId="subsec_1__list_1__item_a">
|
906
1002
|
<num>(a)</num>
|
907
1003
|
<p>one</p>
|
908
1004
|
</item>
|
909
|
-
<item
|
1005
|
+
<item eId="subsec_1__list_1__item_b">
|
910
1006
|
<num>(b)</num>
|
911
1007
|
<p/>
|
912
1008
|
</item>
|
913
|
-
<item
|
1009
|
+
<item eId="subsec_1__list_1__item_i">
|
914
1010
|
<num>(i)</num>
|
915
1011
|
<p>single</p>
|
916
1012
|
</item>
|
917
|
-
<item
|
1013
|
+
<item eId="subsec_1__list_1__item_ii">
|
918
1014
|
<num>(ii)</num>
|
919
1015
|
<p>double</p>
|
920
1016
|
</item>
|
@@ -931,24 +1027,24 @@ EOS
|
|
931
1027
|
(ii) double
|
932
1028
|
EOS
|
933
1029
|
)
|
934
|
-
to_xml(node, "", 1).should == '<subsection
|
1030
|
+
to_xml(node, "", 1).should == '<subsection eId="subsec_1">
|
935
1031
|
<num>(1)</num>
|
936
1032
|
<content>
|
937
1033
|
<p>here\'s my really cool list,</p>
|
938
|
-
<blockList
|
939
|
-
<item
|
1034
|
+
<blockList eId="subsec_1__list_1" renest="true">
|
1035
|
+
<item eId="subsec_1__list_1__item_a">
|
940
1036
|
<num>(a)</num>
|
941
1037
|
<p/>
|
942
1038
|
</item>
|
943
|
-
<item
|
1039
|
+
<item eId="subsec_1__list_1__item_b">
|
944
1040
|
<num>(b)</num>
|
945
1041
|
<p/>
|
946
1042
|
</item>
|
947
|
-
<item
|
1043
|
+
<item eId="subsec_1__list_1__item_i">
|
948
1044
|
<num>(i)</num>
|
949
1045
|
<p>single</p>
|
950
1046
|
</item>
|
951
|
-
<item
|
1047
|
+
<item eId="subsec_1__list_1__item_ii">
|
952
1048
|
<num>(ii)</num>
|
953
1049
|
<p>double</p>
|
954
1050
|
</item>
|
@@ -961,10 +1057,32 @@ EOS
|
|
961
1057
|
it 'should handle dotted number subsection numbers' do
|
962
1058
|
node = parse :subsection, <<EOS
|
963
1059
|
9.9. foo
|
1060
|
+
EOS
|
1061
|
+
node.num.should == "9.9"
|
1062
|
+
|
1063
|
+
node = parse :subsection, <<EOS
|
1064
|
+
9.9 foo
|
964
1065
|
EOS
|
965
1066
|
node.num.should == "9.9"
|
966
1067
|
end
|
967
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
|
+
|
968
1086
|
it 'should handle dotted number sublists' do
|
969
1087
|
node = parse(:subsection, <<EOS
|
970
1088
|
9.9 foo
|
@@ -973,20 +1091,20 @@ EOS
|
|
973
1091
|
9.9.2.1 item3
|
974
1092
|
EOS
|
975
1093
|
)
|
976
|
-
to_xml(node, '', 1).should == '<subsection
|
1094
|
+
to_xml(node, '', 1).should == '<subsection eId="subsec_9-9">
|
977
1095
|
<num>9.9</num>
|
978
1096
|
<content>
|
979
1097
|
<p>foo</p>
|
980
|
-
<blockList
|
981
|
-
<item
|
1098
|
+
<blockList eId="subsec_9-9__list_1" renest="true">
|
1099
|
+
<item eId="subsec_9-9__list_1__item_9-9-1">
|
982
1100
|
<num>9.9.1</num>
|
983
1101
|
<p>item1</p>
|
984
1102
|
</item>
|
985
|
-
<item
|
1103
|
+
<item eId="subsec_9-9__list_1__item_9-9-2">
|
986
1104
|
<num>9.9.2</num>
|
987
1105
|
<p>item2</p>
|
988
1106
|
</item>
|
989
|
-
<item
|
1107
|
+
<item eId="subsec_9-9__list_1__item_9-9-2-1">
|
990
1108
|
<num>9.9.2.1</num>
|
991
1109
|
<p>item3</p>
|
992
1110
|
</item>
|
@@ -1007,27 +1125,27 @@ EOS
|
|
1007
1125
|
EOS
|
1008
1126
|
)
|
1009
1127
|
|
1010
|
-
to_xml(node, '', 1).should == '<subsection
|
1128
|
+
to_xml(node, '', 1).should == '<subsection eId="subsec_1">
|
1011
1129
|
<num>(1)</num>
|
1012
1130
|
<content>
|
1013
1131
|
<p>a list</p>
|
1014
|
-
<blockList
|
1015
|
-
<item
|
1132
|
+
<blockList eId="subsec_1__list_1" renest="true">
|
1133
|
+
<item eId="subsec_1__list_1__item_a">
|
1016
1134
|
<num>(a)</num>
|
1017
1135
|
<p>item 1</p>
|
1018
1136
|
</item>
|
1019
|
-
<item
|
1137
|
+
<item eId="subsec_1__list_1__item_b">
|
1020
1138
|
<num>(b)</num>
|
1021
1139
|
<p>item 2</p>
|
1022
1140
|
</item>
|
1023
1141
|
</blockList>
|
1024
1142
|
<p>some text</p>
|
1025
|
-
<blockList
|
1026
|
-
<item
|
1143
|
+
<blockList eId="subsec_1__list_2" renest="true">
|
1144
|
+
<item eId="subsec_1__list_2__item_c">
|
1027
1145
|
<num>(c)</num>
|
1028
1146
|
<p>item 3</p>
|
1029
1147
|
</item>
|
1030
|
-
<item
|
1148
|
+
<item eId="subsec_1__list_2__item_d">
|
1031
1149
|
<num>(d)</num>
|
1032
1150
|
<p>item 4</p>
|
1033
1151
|
</item>
|
@@ -1047,7 +1165,7 @@ EOS
|
|
1047
1165
|
EOS
|
1048
1166
|
)
|
1049
1167
|
|
1050
|
-
to_xml(node, '', 1).should == '<subsection
|
1168
|
+
to_xml(node, '', 1).should == '<subsection eId="subsec_1">
|
1051
1169
|
<num>(1)</num>
|
1052
1170
|
<content>
|
1053
1171
|
<p>a subsection</p>
|
@@ -1068,16 +1186,16 @@ EOS
|
|
1068
1186
|
(3) Part 1
|
1069
1187
|
EOS
|
1070
1188
|
to_xml(node).should == '<body>
|
1071
|
-
<section
|
1189
|
+
<section eId="sec_1">
|
1072
1190
|
<num>1.</num>
|
1073
1191
|
<heading>Section</heading>
|
1074
|
-
<subsection
|
1192
|
+
<subsection eId="sec_1__subsec_2">
|
1075
1193
|
<num>(2)</num>
|
1076
1194
|
<content>
|
1077
1195
|
<p>Schedule 1 is cool.</p>
|
1078
1196
|
</content>
|
1079
1197
|
</subsection>
|
1080
|
-
<subsection
|
1198
|
+
<subsection eId="sec_1__subsec_3">
|
1081
1199
|
<num>(3)</num>
|
1082
1200
|
<content>
|
1083
1201
|
<p>Part 1</p>
|
@@ -1128,13 +1246,13 @@ baz
|
|
1128
1246
|
</preface>'
|
1129
1247
|
|
1130
1248
|
today = Time.now.strftime('%Y-%m-%d')
|
1131
|
-
to_xml(node, "").should == '<act contains="originalVersion">
|
1249
|
+
to_xml(node, "").should == '<act contains="originalVersion" name="act">
|
1132
1250
|
<meta>
|
1133
1251
|
<identification source="#slaw">
|
1134
1252
|
<FRBRWork>
|
1135
1253
|
<FRBRthis value="/za/act/1980/01/main"/>
|
1136
1254
|
<FRBRuri value="/za/act/1980/01"/>
|
1137
|
-
<FRBRalias value="Short Title"/>
|
1255
|
+
<FRBRalias value="Short Title" name="title"/>
|
1138
1256
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
1139
1257
|
<FRBRauthor href="#council"/>
|
1140
1258
|
<FRBRcountry value="za"/>
|
@@ -1154,8 +1272,8 @@ baz
|
|
1154
1272
|
</FRBRManifestation>
|
1155
1273
|
</identification>
|
1156
1274
|
<references source="#this">
|
1157
|
-
<TLCOrganization
|
1158
|
-
<TLCOrganization
|
1275
|
+
<TLCOrganization eId="slaw" href="https://github.com/longhotsummer/slaw" showAs="Slaw"/>
|
1276
|
+
<TLCOrganization eId="council" href="/ontology/organization/za/council" showAs="Council"/>
|
1159
1277
|
</references>
|
1160
1278
|
</meta>
|
1161
1279
|
<preface>
|
@@ -1166,10 +1284,10 @@ baz
|
|
1166
1284
|
<p>baz</p>
|
1167
1285
|
</preface>
|
1168
1286
|
<body>
|
1169
|
-
<section
|
1287
|
+
<section eId="sec_1">
|
1170
1288
|
<num>1.</num>
|
1171
1289
|
<heading>Section</heading>
|
1172
|
-
<subsection
|
1290
|
+
<subsection eId="sec_1__subsec_1">
|
1173
1291
|
<num>(1)</num>
|
1174
1292
|
<content>
|
1175
1293
|
<p>hello</p>
|
@@ -1299,11 +1417,11 @@ EOS
|
|
1299
1417
|
<p>this is in the preamble</p>
|
1300
1418
|
</preamble>'
|
1301
1419
|
to_xml(node.body).should == '<body>
|
1302
|
-
<
|
1420
|
+
<hcontainer eId="hcontainer_1">
|
1303
1421
|
<content>
|
1304
1422
|
<p>this is in the body</p>
|
1305
1423
|
</content>
|
1306
|
-
</
|
1424
|
+
</hcontainer>
|
1307
1425
|
</body>'
|
1308
1426
|
end
|
1309
1427
|
end
|
@@ -1389,12 +1507,12 @@ this is actually in the body
|
|
1389
1507
|
EOS
|
1390
1508
|
|
1391
1509
|
to_xml(node.body).should == '<body>
|
1392
|
-
<
|
1510
|
+
<hcontainer eId="hcontainer_1">
|
1393
1511
|
<content>
|
1394
1512
|
<p>PREAMBLE</p>
|
1395
1513
|
<p>this is actually in the body</p>
|
1396
1514
|
</content>
|
1397
|
-
</
|
1515
|
+
</hcontainer>
|
1398
1516
|
</body>'
|
1399
1517
|
end
|
1400
1518
|
|
@@ -1410,12 +1528,12 @@ this is actually in the body
|
|
1410
1528
|
EOS
|
1411
1529
|
|
1412
1530
|
to_xml(node.body).should == '<body>
|
1413
|
-
<
|
1531
|
+
<hcontainer eId="hcontainer_1">
|
1414
1532
|
<content>
|
1415
1533
|
<p>PREFACE</p>
|
1416
1534
|
<p>this is actually in the body</p>
|
1417
1535
|
</content>
|
1418
|
-
</
|
1536
|
+
</hcontainer>
|
1419
1537
|
</body>'
|
1420
1538
|
end
|
1421
1539
|
end
|
@@ -1432,10 +1550,10 @@ Section
|
|
1432
1550
|
EOS
|
1433
1551
|
|
1434
1552
|
s = to_xml(node)
|
1435
|
-
s.should == '<section
|
1553
|
+
s.should == '<section eId="sec_1">
|
1436
1554
|
<num>1.</num>
|
1437
1555
|
<heading>Section</heading>
|
1438
|
-
<subsection
|
1556
|
+
<subsection eId="sec_1__subsec_1">
|
1439
1557
|
<num>(1)</num>
|
1440
1558
|
<content>
|
1441
1559
|
<p>hello</p>
|
@@ -1451,10 +1569,10 @@ EOS
|
|
1451
1569
|
(1) hello
|
1452
1570
|
EOS
|
1453
1571
|
s = to_xml(node)
|
1454
|
-
s.should == '<section
|
1572
|
+
s.should == '<section eId="sec_1">
|
1455
1573
|
<num>1.</num>
|
1456
1574
|
<heading>Section</heading>
|
1457
|
-
<subsection
|
1575
|
+
<subsection eId="sec_1__subsec_1">
|
1458
1576
|
<num>(1)</num>
|
1459
1577
|
<content>
|
1460
1578
|
<p>hello</p>
|
@@ -1473,20 +1591,20 @@ EOS
|
|
1473
1591
|
EOS
|
1474
1592
|
s = to_xml(node)
|
1475
1593
|
s.should == '<body>
|
1476
|
-
<section
|
1594
|
+
<section eId="sec_1">
|
1477
1595
|
<num>1.</num>
|
1478
1596
|
<heading>A section</heading>
|
1479
|
-
<subsection
|
1597
|
+
<subsection eId="sec_1__subsec_1">
|
1480
1598
|
<num>(1)</num>
|
1481
1599
|
<content>
|
1482
1600
|
<p>hello</p>
|
1483
1601
|
</content>
|
1484
1602
|
</subsection>
|
1485
1603
|
</section>
|
1486
|
-
<section
|
1604
|
+
<section eId="sec_2">
|
1487
1605
|
<num>2.</num>
|
1488
1606
|
<heading>Another section</heading>
|
1489
|
-
<subsection
|
1607
|
+
<subsection eId="sec_2__subsec_2">
|
1490
1608
|
<num>(2)</num>
|
1491
1609
|
<content>
|
1492
1610
|
<p>Another line</p>
|
@@ -1503,16 +1621,16 @@ EOS
|
|
1503
1621
|
(2) Without limiting generality, stuff.
|
1504
1622
|
EOS
|
1505
1623
|
s = to_xml(node)
|
1506
|
-
s.should == '<section
|
1624
|
+
s.should == '<section eId="sec_10">
|
1507
1625
|
<num>10.</num>
|
1508
1626
|
<heading/>
|
1509
|
-
<subsection
|
1627
|
+
<subsection eId="sec_10__subsec_1">
|
1510
1628
|
<num>(1)</num>
|
1511
1629
|
<content>
|
1512
1630
|
<p>Transporters must remove medical waste.</p>
|
1513
1631
|
</content>
|
1514
1632
|
</subsection>
|
1515
|
-
<subsection
|
1633
|
+
<subsection eId="sec_10__subsec_2">
|
1516
1634
|
<num>(2)</num>
|
1517
1635
|
<content>
|
1518
1636
|
<p>Without limiting generality, stuff.</p>
|
@@ -1531,24 +1649,24 @@ and some stuff
|
|
1531
1649
|
EOS
|
1532
1650
|
|
1533
1651
|
s = to_xml(node)
|
1534
|
-
s.should == '<section
|
1652
|
+
s.should == '<section eId="sec_1">
|
1535
1653
|
<num>1.</num>
|
1536
1654
|
<heading>Section</heading>
|
1537
|
-
<
|
1655
|
+
<hcontainer eId="sec_1__hcontainer_1">
|
1538
1656
|
<content>
|
1539
|
-
<blockList
|
1540
|
-
<item
|
1657
|
+
<blockList eId="sec_1__hcontainer_1__list_1" renest="true">
|
1658
|
+
<item eId="sec_1__hcontainer_1__list_1__item_a">
|
1541
1659
|
<num>(a)</num>
|
1542
1660
|
<p>first</p>
|
1543
1661
|
</item>
|
1544
|
-
<item
|
1662
|
+
<item eId="sec_1__hcontainer_1__list_1__item_b">
|
1545
1663
|
<num>(b)</num>
|
1546
1664
|
<p>second</p>
|
1547
1665
|
</item>
|
1548
1666
|
</blockList>
|
1549
1667
|
<p>and some stuff</p>
|
1550
1668
|
</content>
|
1551
|
-
</
|
1669
|
+
</hcontainer>
|
1552
1670
|
</section>'
|
1553
1671
|
end
|
1554
1672
|
|
@@ -1561,14 +1679,14 @@ something
|
|
1561
1679
|
EOS
|
1562
1680
|
|
1563
1681
|
s = to_xml(node)
|
1564
|
-
s.should == '<section
|
1682
|
+
s.should == '<section eId="sec_1">
|
1565
1683
|
<num>1.</num>
|
1566
1684
|
<heading>Section <b>bold</b> <ref href="/za/act/1990/1">foo</ref></heading>
|
1567
|
-
<
|
1685
|
+
<hcontainer eId="sec_1__hcontainer_1">
|
1568
1686
|
<content>
|
1569
1687
|
<p>something</p>
|
1570
1688
|
</content>
|
1571
|
-
</
|
1689
|
+
</hcontainer>
|
1572
1690
|
</section>'
|
1573
1691
|
end
|
1574
1692
|
|
@@ -1582,14 +1700,14 @@ something
|
|
1582
1700
|
EOS
|
1583
1701
|
|
1584
1702
|
s = to_xml(node)
|
1585
|
-
s.should == '<section
|
1703
|
+
s.should == '<section eId="sec_1">
|
1586
1704
|
<num>1.</num>
|
1587
1705
|
<heading>Section <b>bold</b> <ref href="/za/act/1990/1">foo</ref></heading>
|
1588
|
-
<
|
1706
|
+
<hcontainer eId="sec_1__hcontainer_1">
|
1589
1707
|
<content>
|
1590
1708
|
<p>something</p>
|
1591
1709
|
</content>
|
1592
|
-
</
|
1710
|
+
</hcontainer>
|
1593
1711
|
</section>'
|
1594
1712
|
end
|
1595
1713
|
|
@@ -1608,24 +1726,24 @@ naked statement (c) blah
|
|
1608
1726
|
(a) foo
|
1609
1727
|
(b) bar
|
1610
1728
|
EOS
|
1611
|
-
to_xml(node, "").should == '<section
|
1729
|
+
to_xml(node, "").should == '<section eId="sec_1">
|
1612
1730
|
<num>1.</num>
|
1613
1731
|
<heading>Section</heading>
|
1614
|
-
<
|
1732
|
+
<hcontainer eId="sec_1__hcontainer_1">
|
1615
1733
|
<content>
|
1616
1734
|
<p>naked statement (c) blah</p>
|
1617
|
-
<blockList
|
1618
|
-
<item
|
1735
|
+
<blockList eId="sec_1__hcontainer_1__list_1" renest="true">
|
1736
|
+
<item eId="sec_1__hcontainer_1__list_1__item_a">
|
1619
1737
|
<num>(a)</num>
|
1620
1738
|
<p>foo</p>
|
1621
1739
|
</item>
|
1622
|
-
<item
|
1740
|
+
<item eId="sec_1__hcontainer_1__list_1__item_b">
|
1623
1741
|
<num>(b)</num>
|
1624
1742
|
<p>bar</p>
|
1625
1743
|
</item>
|
1626
1744
|
</blockList>
|
1627
1745
|
</content>
|
1628
|
-
</
|
1746
|
+
</hcontainer>
|
1629
1747
|
</section>'
|
1630
1748
|
end
|
1631
1749
|
|
@@ -1643,25 +1761,25 @@ something
|
|
1643
1761
|
|
1644
1762
|
(b) thing
|
1645
1763
|
EOS
|
1646
|
-
to_xml(node, "").should == '<section
|
1764
|
+
to_xml(node, "").should == '<section eId="sec_1">
|
1647
1765
|
<num>1.</num>
|
1648
1766
|
<heading>Section</heading>
|
1649
|
-
<subsection
|
1767
|
+
<subsection eId="sec_1__subsec_1">
|
1650
1768
|
<num>(1)</num>
|
1651
1769
|
<content>
|
1652
1770
|
<p>something</p>
|
1653
1771
|
</content>
|
1654
1772
|
</subsection>
|
1655
|
-
<subsection
|
1773
|
+
<subsection eId="sec_1__subsec_2">
|
1656
1774
|
<num>(2)</num>
|
1657
1775
|
<content>
|
1658
1776
|
<p>Schedule 1</p>
|
1659
|
-
<blockList
|
1660
|
-
<item
|
1777
|
+
<blockList eId="sec_1__subsec_2__list_1" renest="true">
|
1778
|
+
<item eId="sec_1__subsec_2__list_1__item_a">
|
1661
1779
|
<num>(a)</num>
|
1662
1780
|
<p>Part 1</p>
|
1663
1781
|
</item>
|
1664
|
-
<item
|
1782
|
+
<item eId="sec_1__subsec_2__list_1__item_b">
|
1665
1783
|
<num>(b)</num>
|
1666
1784
|
<p>thing</p>
|
1667
1785
|
</item>
|
@@ -1680,17 +1798,17 @@ EOS
|
|
1680
1798
|
stuff
|
1681
1799
|
\\3. a third
|
1682
1800
|
EOS
|
1683
|
-
to_xml(node, "").should == '<section
|
1801
|
+
to_xml(node, "").should == '<section eId="sec_1">
|
1684
1802
|
<num>1.</num>
|
1685
1803
|
<heading>Section</heading>
|
1686
|
-
<
|
1804
|
+
<hcontainer eId="sec_1__hcontainer_1">
|
1687
1805
|
<content>
|
1688
1806
|
<p>1. ignored</p>
|
1689
1807
|
<p>2. another line</p>
|
1690
1808
|
<p>stuff</p>
|
1691
1809
|
<p>3. a third</p>
|
1692
1810
|
</content>
|
1693
|
-
</
|
1811
|
+
</hcontainer>
|
1694
1812
|
</section>'
|
1695
1813
|
end
|
1696
1814
|
|
@@ -1702,14 +1820,14 @@ EOS
|
|
1702
1820
|
|
1703
1821
|
stuff
|
1704
1822
|
EOS
|
1705
|
-
to_xml(node, "").should == '<section
|
1823
|
+
to_xml(node, "").should == '<section eId="sec_1">
|
1706
1824
|
<num>1.</num>
|
1707
1825
|
<heading>Section</heading>
|
1708
|
-
<
|
1826
|
+
<hcontainer eId="sec_1__hcontainer_1">
|
1709
1827
|
<content>
|
1710
1828
|
<p>stuff</p>
|
1711
1829
|
</content>
|
1712
|
-
</
|
1830
|
+
</hcontainer>
|
1713
1831
|
</section>'
|
1714
1832
|
end
|
1715
1833
|
|
@@ -1721,19 +1839,19 @@ Informal trading may include, amongst others:-
|
|
1721
1839
|
3.1.1 street trading;
|
1722
1840
|
3.1.2 trading in pedestrian malls;
|
1723
1841
|
EOS
|
1724
|
-
to_xml(node, '').should == '<section
|
1842
|
+
to_xml(node, '').should == '<section eId="sec_3">
|
1725
1843
|
<num>3.</num>
|
1726
1844
|
<heading>Types of informal trading</heading>
|
1727
|
-
<subsection
|
1845
|
+
<subsection eId="sec_3__subsec_3-1">
|
1728
1846
|
<num>3.1</num>
|
1729
1847
|
<content>
|
1730
1848
|
<p>Informal trading may include, amongst others:-</p>
|
1731
|
-
<blockList
|
1732
|
-
<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">
|
1733
1851
|
<num>3.1.1</num>
|
1734
1852
|
<p>street trading;</p>
|
1735
1853
|
</item>
|
1736
|
-
<item
|
1854
|
+
<item eId="sec_3__subsec_3-1__list_1__item_3-1-2">
|
1737
1855
|
<num>3.1.2</num>
|
1738
1856
|
<p>trading in pedestrian malls;</p>
|
1739
1857
|
</item>
|
@@ -1750,7 +1868,7 @@ EOS
|
|
1750
1868
|
context 'crossheadings' do
|
1751
1869
|
it 'should handle a inline_items in crossheadings' do
|
1752
1870
|
node = parse :crossheading, "CROSSHEADING something [[remark]] [link](/foo/bar)\n"
|
1753
|
-
to_xml(node, '').should == '<hcontainer
|
1871
|
+
to_xml(node, '').should == '<hcontainer eId="hcontainer_1" name="crossheading">
|
1754
1872
|
<heading>something <remark status="editorial">[remark]</remark> <ref href="/foo/bar">link</ref></heading>
|
1755
1873
|
</hcontainer>'
|
1756
1874
|
end
|
@@ -1768,13 +1886,13 @@ CROSSHEADING In the body
|
|
1768
1886
|
Text
|
1769
1887
|
'
|
1770
1888
|
today = Time.now.strftime('%Y-%m-%d')
|
1771
|
-
to_xml(node, "").should == '<act contains="originalVersion">
|
1889
|
+
to_xml(node, "").should == '<act contains="originalVersion" name="act">
|
1772
1890
|
<meta>
|
1773
1891
|
<identification source="#slaw">
|
1774
1892
|
<FRBRWork>
|
1775
1893
|
<FRBRthis value="/za/act/1980/01/main"/>
|
1776
1894
|
<FRBRuri value="/za/act/1980/01"/>
|
1777
|
-
<FRBRalias value="Short Title"/>
|
1895
|
+
<FRBRalias value="Short Title" name="title"/>
|
1778
1896
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
1779
1897
|
<FRBRauthor href="#council"/>
|
1780
1898
|
<FRBRcountry value="za"/>
|
@@ -1794,25 +1912,25 @@ Text
|
|
1794
1912
|
</FRBRManifestation>
|
1795
1913
|
</identification>
|
1796
1914
|
<references source="#this">
|
1797
|
-
<TLCOrganization
|
1798
|
-
<TLCOrganization
|
1915
|
+
<TLCOrganization eId="slaw" href="https://github.com/longhotsummer/slaw" showAs="Slaw"/>
|
1916
|
+
<TLCOrganization eId="council" href="/ontology/organization/za/council" showAs="Council"/>
|
1799
1917
|
</references>
|
1800
1918
|
</meta>
|
1801
1919
|
<preface>
|
1802
1920
|
<p>Some text</p>
|
1803
1921
|
</preface>
|
1804
1922
|
<body>
|
1805
|
-
<hcontainer
|
1923
|
+
<hcontainer eId="hcontainer_1" name="crossheading">
|
1806
1924
|
<heading>In the body</heading>
|
1807
1925
|
</hcontainer>
|
1808
|
-
<section
|
1926
|
+
<section eId="sec_1">
|
1809
1927
|
<num>1.</num>
|
1810
1928
|
<heading>Section 1</heading>
|
1811
|
-
<
|
1929
|
+
<hcontainer eId="sec_1__hcontainer_1">
|
1812
1930
|
<content>
|
1813
1931
|
<p>Text</p>
|
1814
1932
|
</content>
|
1815
|
-
</
|
1933
|
+
</hcontainer>
|
1816
1934
|
</section>
|
1817
1935
|
</body>
|
1818
1936
|
</act>'
|
@@ -1831,13 +1949,13 @@ CROSSHEADING In the body
|
|
1831
1949
|
Text
|
1832
1950
|
'
|
1833
1951
|
today = Time.now.strftime('%Y-%m-%d')
|
1834
|
-
to_xml(node, "").should == '<act contains="originalVersion">
|
1952
|
+
to_xml(node, "").should == '<act contains="originalVersion" name="act">
|
1835
1953
|
<meta>
|
1836
1954
|
<identification source="#slaw">
|
1837
1955
|
<FRBRWork>
|
1838
1956
|
<FRBRthis value="/za/act/1980/01/main"/>
|
1839
1957
|
<FRBRuri value="/za/act/1980/01"/>
|
1840
|
-
<FRBRalias value="Short Title"/>
|
1958
|
+
<FRBRalias value="Short Title" name="title"/>
|
1841
1959
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
1842
1960
|
<FRBRauthor href="#council"/>
|
1843
1961
|
<FRBRcountry value="za"/>
|
@@ -1857,25 +1975,25 @@ Text
|
|
1857
1975
|
</FRBRManifestation>
|
1858
1976
|
</identification>
|
1859
1977
|
<references source="#this">
|
1860
|
-
<TLCOrganization
|
1861
|
-
<TLCOrganization
|
1978
|
+
<TLCOrganization eId="slaw" href="https://github.com/longhotsummer/slaw" showAs="Slaw"/>
|
1979
|
+
<TLCOrganization eId="council" href="/ontology/organization/za/council" showAs="Council"/>
|
1862
1980
|
</references>
|
1863
1981
|
</meta>
|
1864
1982
|
<preamble>
|
1865
1983
|
<p>Some text</p>
|
1866
1984
|
</preamble>
|
1867
1985
|
<body>
|
1868
|
-
<hcontainer
|
1986
|
+
<hcontainer eId="hcontainer_1" name="crossheading">
|
1869
1987
|
<heading>In the body</heading>
|
1870
1988
|
</hcontainer>
|
1871
|
-
<section
|
1989
|
+
<section eId="sec_1">
|
1872
1990
|
<num>1.</num>
|
1873
1991
|
<heading>Section 1</heading>
|
1874
|
-
<
|
1992
|
+
<hcontainer eId="sec_1__hcontainer_1">
|
1875
1993
|
<content>
|
1876
1994
|
<p>Text</p>
|
1877
1995
|
</content>
|
1878
|
-
</
|
1996
|
+
</hcontainer>
|
1879
1997
|
</section>
|
1880
1998
|
</body>
|
1881
1999
|
</act>'
|
@@ -1939,14 +2057,14 @@ LONGTITLE a long title
|
|
1939
2057
|
EOS
|
1940
2058
|
|
1941
2059
|
to_xml(node).should == '<body>
|
1942
|
-
<section
|
2060
|
+
<section eId="sec_1">
|
1943
2061
|
<num>1.</num>
|
1944
2062
|
<heading>Section</heading>
|
1945
|
-
<
|
2063
|
+
<hcontainer eId="sec_1__hcontainer_1">
|
1946
2064
|
<content>
|
1947
2065
|
<p>LONGTITLE a long title</p>
|
1948
2066
|
</content>
|
1949
|
-
</
|
2067
|
+
</hcontainer>
|
1950
2068
|
</section>
|
1951
2069
|
</body>'
|
1952
2070
|
end
|