slaw 9.1.0 → 10.3.1
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 +27 -1
- data/bin/slaw +7 -1
- data/lib/slaw/grammars/counters.rb +34 -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/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/counters_spec.rb +38 -0
- 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 +283 -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 +5 -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>
|
@@ -1070,20 +1091,20 @@ EOS
|
|
1070
1091
|
9.9.2.1 item3
|
1071
1092
|
EOS
|
1072
1093
|
)
|
1073
|
-
to_xml(node, '', 1).should == '<subsection
|
1094
|
+
to_xml(node, '', 1).should == '<subsection eId="subsec_9-9">
|
1074
1095
|
<num>9.9</num>
|
1075
1096
|
<content>
|
1076
1097
|
<p>foo</p>
|
1077
|
-
<blockList
|
1078
|
-
<item
|
1098
|
+
<blockList eId="subsec_9-9__list_1" renest="true">
|
1099
|
+
<item eId="subsec_9-9__list_1__item_9-9-1">
|
1079
1100
|
<num>9.9.1</num>
|
1080
1101
|
<p>item1</p>
|
1081
1102
|
</item>
|
1082
|
-
<item
|
1103
|
+
<item eId="subsec_9-9__list_1__item_9-9-2">
|
1083
1104
|
<num>9.9.2</num>
|
1084
1105
|
<p>item2</p>
|
1085
1106
|
</item>
|
1086
|
-
<item
|
1107
|
+
<item eId="subsec_9-9__list_1__item_9-9-2-1">
|
1087
1108
|
<num>9.9.2.1</num>
|
1088
1109
|
<p>item3</p>
|
1089
1110
|
</item>
|
@@ -1104,27 +1125,27 @@ EOS
|
|
1104
1125
|
EOS
|
1105
1126
|
)
|
1106
1127
|
|
1107
|
-
to_xml(node, '', 1).should == '<subsection
|
1128
|
+
to_xml(node, '', 1).should == '<subsection eId="subsec_1">
|
1108
1129
|
<num>(1)</num>
|
1109
1130
|
<content>
|
1110
1131
|
<p>a list</p>
|
1111
|
-
<blockList
|
1112
|
-
<item
|
1132
|
+
<blockList eId="subsec_1__list_1" renest="true">
|
1133
|
+
<item eId="subsec_1__list_1__item_a">
|
1113
1134
|
<num>(a)</num>
|
1114
1135
|
<p>item 1</p>
|
1115
1136
|
</item>
|
1116
|
-
<item
|
1137
|
+
<item eId="subsec_1__list_1__item_b">
|
1117
1138
|
<num>(b)</num>
|
1118
1139
|
<p>item 2</p>
|
1119
1140
|
</item>
|
1120
1141
|
</blockList>
|
1121
1142
|
<p>some text</p>
|
1122
|
-
<blockList
|
1123
|
-
<item
|
1143
|
+
<blockList eId="subsec_1__list_2" renest="true">
|
1144
|
+
<item eId="subsec_1__list_2__item_c">
|
1124
1145
|
<num>(c)</num>
|
1125
1146
|
<p>item 3</p>
|
1126
1147
|
</item>
|
1127
|
-
<item
|
1148
|
+
<item eId="subsec_1__list_2__item_d">
|
1128
1149
|
<num>(d)</num>
|
1129
1150
|
<p>item 4</p>
|
1130
1151
|
</item>
|
@@ -1144,7 +1165,7 @@ EOS
|
|
1144
1165
|
EOS
|
1145
1166
|
)
|
1146
1167
|
|
1147
|
-
to_xml(node, '', 1).should == '<subsection
|
1168
|
+
to_xml(node, '', 1).should == '<subsection eId="subsec_1">
|
1148
1169
|
<num>(1)</num>
|
1149
1170
|
<content>
|
1150
1171
|
<p>a subsection</p>
|
@@ -1165,16 +1186,16 @@ EOS
|
|
1165
1186
|
(3) Part 1
|
1166
1187
|
EOS
|
1167
1188
|
to_xml(node).should == '<body>
|
1168
|
-
<section
|
1189
|
+
<section eId="sec_1">
|
1169
1190
|
<num>1.</num>
|
1170
1191
|
<heading>Section</heading>
|
1171
|
-
<subsection
|
1192
|
+
<subsection eId="sec_1__subsec_2">
|
1172
1193
|
<num>(2)</num>
|
1173
1194
|
<content>
|
1174
1195
|
<p>Schedule 1 is cool.</p>
|
1175
1196
|
</content>
|
1176
1197
|
</subsection>
|
1177
|
-
<subsection
|
1198
|
+
<subsection eId="sec_1__subsec_3">
|
1178
1199
|
<num>(3)</num>
|
1179
1200
|
<content>
|
1180
1201
|
<p>Part 1</p>
|
@@ -1225,13 +1246,13 @@ baz
|
|
1225
1246
|
</preface>'
|
1226
1247
|
|
1227
1248
|
today = Time.now.strftime('%Y-%m-%d')
|
1228
|
-
to_xml(node, "").should == '<act contains="originalVersion">
|
1249
|
+
to_xml(node, "").should == '<act contains="originalVersion" name="act">
|
1229
1250
|
<meta>
|
1230
1251
|
<identification source="#slaw">
|
1231
1252
|
<FRBRWork>
|
1232
1253
|
<FRBRthis value="/za/act/1980/01/main"/>
|
1233
1254
|
<FRBRuri value="/za/act/1980/01"/>
|
1234
|
-
<FRBRalias value="Short Title"/>
|
1255
|
+
<FRBRalias value="Short Title" name="title"/>
|
1235
1256
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
1236
1257
|
<FRBRauthor href="#council"/>
|
1237
1258
|
<FRBRcountry value="za"/>
|
@@ -1251,8 +1272,8 @@ baz
|
|
1251
1272
|
</FRBRManifestation>
|
1252
1273
|
</identification>
|
1253
1274
|
<references source="#this">
|
1254
|
-
<TLCOrganization
|
1255
|
-
<TLCOrganization
|
1275
|
+
<TLCOrganization eId="slaw" href="https://github.com/longhotsummer/slaw" showAs="Slaw"/>
|
1276
|
+
<TLCOrganization eId="council" href="/ontology/organization/za/council" showAs="Council"/>
|
1256
1277
|
</references>
|
1257
1278
|
</meta>
|
1258
1279
|
<preface>
|
@@ -1263,10 +1284,10 @@ baz
|
|
1263
1284
|
<p>baz</p>
|
1264
1285
|
</preface>
|
1265
1286
|
<body>
|
1266
|
-
<section
|
1287
|
+
<section eId="sec_1">
|
1267
1288
|
<num>1.</num>
|
1268
1289
|
<heading>Section</heading>
|
1269
|
-
<subsection
|
1290
|
+
<subsection eId="sec_1__subsec_1">
|
1270
1291
|
<num>(1)</num>
|
1271
1292
|
<content>
|
1272
1293
|
<p>hello</p>
|
@@ -1396,11 +1417,11 @@ EOS
|
|
1396
1417
|
<p>this is in the preamble</p>
|
1397
1418
|
</preamble>'
|
1398
1419
|
to_xml(node.body).should == '<body>
|
1399
|
-
<
|
1420
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
1400
1421
|
<content>
|
1401
1422
|
<p>this is in the body</p>
|
1402
1423
|
</content>
|
1403
|
-
</
|
1424
|
+
</hcontainer>
|
1404
1425
|
</body>'
|
1405
1426
|
end
|
1406
1427
|
end
|
@@ -1486,12 +1507,12 @@ this is actually in the body
|
|
1486
1507
|
EOS
|
1487
1508
|
|
1488
1509
|
to_xml(node.body).should == '<body>
|
1489
|
-
<
|
1510
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
1490
1511
|
<content>
|
1491
1512
|
<p>PREAMBLE</p>
|
1492
1513
|
<p>this is actually in the body</p>
|
1493
1514
|
</content>
|
1494
|
-
</
|
1515
|
+
</hcontainer>
|
1495
1516
|
</body>'
|
1496
1517
|
end
|
1497
1518
|
|
@@ -1507,12 +1528,12 @@ this is actually in the body
|
|
1507
1528
|
EOS
|
1508
1529
|
|
1509
1530
|
to_xml(node.body).should == '<body>
|
1510
|
-
<
|
1531
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
1511
1532
|
<content>
|
1512
1533
|
<p>PREFACE</p>
|
1513
1534
|
<p>this is actually in the body</p>
|
1514
1535
|
</content>
|
1515
|
-
</
|
1536
|
+
</hcontainer>
|
1516
1537
|
</body>'
|
1517
1538
|
end
|
1518
1539
|
end
|
@@ -1529,10 +1550,10 @@ Section
|
|
1529
1550
|
EOS
|
1530
1551
|
|
1531
1552
|
s = to_xml(node)
|
1532
|
-
s.should == '<section
|
1553
|
+
s.should == '<section eId="sec_1">
|
1533
1554
|
<num>1.</num>
|
1534
1555
|
<heading>Section</heading>
|
1535
|
-
<subsection
|
1556
|
+
<subsection eId="sec_1__subsec_1">
|
1536
1557
|
<num>(1)</num>
|
1537
1558
|
<content>
|
1538
1559
|
<p>hello</p>
|
@@ -1548,10 +1569,10 @@ EOS
|
|
1548
1569
|
(1) hello
|
1549
1570
|
EOS
|
1550
1571
|
s = to_xml(node)
|
1551
|
-
s.should == '<section
|
1572
|
+
s.should == '<section eId="sec_1">
|
1552
1573
|
<num>1.</num>
|
1553
1574
|
<heading>Section</heading>
|
1554
|
-
<subsection
|
1575
|
+
<subsection eId="sec_1__subsec_1">
|
1555
1576
|
<num>(1)</num>
|
1556
1577
|
<content>
|
1557
1578
|
<p>hello</p>
|
@@ -1570,20 +1591,20 @@ EOS
|
|
1570
1591
|
EOS
|
1571
1592
|
s = to_xml(node)
|
1572
1593
|
s.should == '<body>
|
1573
|
-
<section
|
1594
|
+
<section eId="sec_1">
|
1574
1595
|
<num>1.</num>
|
1575
1596
|
<heading>A section</heading>
|
1576
|
-
<subsection
|
1597
|
+
<subsection eId="sec_1__subsec_1">
|
1577
1598
|
<num>(1)</num>
|
1578
1599
|
<content>
|
1579
1600
|
<p>hello</p>
|
1580
1601
|
</content>
|
1581
1602
|
</subsection>
|
1582
1603
|
</section>
|
1583
|
-
<section
|
1604
|
+
<section eId="sec_2">
|
1584
1605
|
<num>2.</num>
|
1585
1606
|
<heading>Another section</heading>
|
1586
|
-
<subsection
|
1607
|
+
<subsection eId="sec_2__subsec_2">
|
1587
1608
|
<num>(2)</num>
|
1588
1609
|
<content>
|
1589
1610
|
<p>Another line</p>
|
@@ -1600,16 +1621,16 @@ EOS
|
|
1600
1621
|
(2) Without limiting generality, stuff.
|
1601
1622
|
EOS
|
1602
1623
|
s = to_xml(node)
|
1603
|
-
s.should == '<section
|
1624
|
+
s.should == '<section eId="sec_10">
|
1604
1625
|
<num>10.</num>
|
1605
1626
|
<heading/>
|
1606
|
-
<subsection
|
1627
|
+
<subsection eId="sec_10__subsec_1">
|
1607
1628
|
<num>(1)</num>
|
1608
1629
|
<content>
|
1609
1630
|
<p>Transporters must remove medical waste.</p>
|
1610
1631
|
</content>
|
1611
1632
|
</subsection>
|
1612
|
-
<subsection
|
1633
|
+
<subsection eId="sec_10__subsec_2">
|
1613
1634
|
<num>(2)</num>
|
1614
1635
|
<content>
|
1615
1636
|
<p>Without limiting generality, stuff.</p>
|
@@ -1628,24 +1649,24 @@ and some stuff
|
|
1628
1649
|
EOS
|
1629
1650
|
|
1630
1651
|
s = to_xml(node)
|
1631
|
-
s.should == '<section
|
1652
|
+
s.should == '<section eId="sec_1">
|
1632
1653
|
<num>1.</num>
|
1633
1654
|
<heading>Section</heading>
|
1634
|
-
<
|
1655
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1635
1656
|
<content>
|
1636
|
-
<blockList
|
1637
|
-
<item
|
1657
|
+
<blockList eId="sec_1__hcontainer_1__list_1" renest="true">
|
1658
|
+
<item eId="sec_1__hcontainer_1__list_1__item_a">
|
1638
1659
|
<num>(a)</num>
|
1639
1660
|
<p>first</p>
|
1640
1661
|
</item>
|
1641
|
-
<item
|
1662
|
+
<item eId="sec_1__hcontainer_1__list_1__item_b">
|
1642
1663
|
<num>(b)</num>
|
1643
1664
|
<p>second</p>
|
1644
1665
|
</item>
|
1645
1666
|
</blockList>
|
1646
1667
|
<p>and some stuff</p>
|
1647
1668
|
</content>
|
1648
|
-
</
|
1669
|
+
</hcontainer>
|
1649
1670
|
</section>'
|
1650
1671
|
end
|
1651
1672
|
|
@@ -1658,14 +1679,14 @@ something
|
|
1658
1679
|
EOS
|
1659
1680
|
|
1660
1681
|
s = to_xml(node)
|
1661
|
-
s.should == '<section
|
1682
|
+
s.should == '<section eId="sec_1">
|
1662
1683
|
<num>1.</num>
|
1663
1684
|
<heading>Section <b>bold</b> <ref href="/za/act/1990/1">foo</ref></heading>
|
1664
|
-
<
|
1685
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1665
1686
|
<content>
|
1666
1687
|
<p>something</p>
|
1667
1688
|
</content>
|
1668
|
-
</
|
1689
|
+
</hcontainer>
|
1669
1690
|
</section>'
|
1670
1691
|
end
|
1671
1692
|
|
@@ -1679,14 +1700,14 @@ something
|
|
1679
1700
|
EOS
|
1680
1701
|
|
1681
1702
|
s = to_xml(node)
|
1682
|
-
s.should == '<section
|
1703
|
+
s.should == '<section eId="sec_1">
|
1683
1704
|
<num>1.</num>
|
1684
1705
|
<heading>Section <b>bold</b> <ref href="/za/act/1990/1">foo</ref></heading>
|
1685
|
-
<
|
1706
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1686
1707
|
<content>
|
1687
1708
|
<p>something</p>
|
1688
1709
|
</content>
|
1689
|
-
</
|
1710
|
+
</hcontainer>
|
1690
1711
|
</section>'
|
1691
1712
|
end
|
1692
1713
|
|
@@ -1705,24 +1726,24 @@ naked statement (c) blah
|
|
1705
1726
|
(a) foo
|
1706
1727
|
(b) bar
|
1707
1728
|
EOS
|
1708
|
-
to_xml(node, "").should == '<section
|
1729
|
+
to_xml(node, "").should == '<section eId="sec_1">
|
1709
1730
|
<num>1.</num>
|
1710
1731
|
<heading>Section</heading>
|
1711
|
-
<
|
1732
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1712
1733
|
<content>
|
1713
1734
|
<p>naked statement (c) blah</p>
|
1714
|
-
<blockList
|
1715
|
-
<item
|
1735
|
+
<blockList eId="sec_1__hcontainer_1__list_1" renest="true">
|
1736
|
+
<item eId="sec_1__hcontainer_1__list_1__item_a">
|
1716
1737
|
<num>(a)</num>
|
1717
1738
|
<p>foo</p>
|
1718
1739
|
</item>
|
1719
|
-
<item
|
1740
|
+
<item eId="sec_1__hcontainer_1__list_1__item_b">
|
1720
1741
|
<num>(b)</num>
|
1721
1742
|
<p>bar</p>
|
1722
1743
|
</item>
|
1723
1744
|
</blockList>
|
1724
1745
|
</content>
|
1725
|
-
</
|
1746
|
+
</hcontainer>
|
1726
1747
|
</section>'
|
1727
1748
|
end
|
1728
1749
|
|
@@ -1740,25 +1761,25 @@ something
|
|
1740
1761
|
|
1741
1762
|
(b) thing
|
1742
1763
|
EOS
|
1743
|
-
to_xml(node, "").should == '<section
|
1764
|
+
to_xml(node, "").should == '<section eId="sec_1">
|
1744
1765
|
<num>1.</num>
|
1745
1766
|
<heading>Section</heading>
|
1746
|
-
<subsection
|
1767
|
+
<subsection eId="sec_1__subsec_1">
|
1747
1768
|
<num>(1)</num>
|
1748
1769
|
<content>
|
1749
1770
|
<p>something</p>
|
1750
1771
|
</content>
|
1751
1772
|
</subsection>
|
1752
|
-
<subsection
|
1773
|
+
<subsection eId="sec_1__subsec_2">
|
1753
1774
|
<num>(2)</num>
|
1754
1775
|
<content>
|
1755
1776
|
<p>Schedule 1</p>
|
1756
|
-
<blockList
|
1757
|
-
<item
|
1777
|
+
<blockList eId="sec_1__subsec_2__list_1" renest="true">
|
1778
|
+
<item eId="sec_1__subsec_2__list_1__item_a">
|
1758
1779
|
<num>(a)</num>
|
1759
1780
|
<p>Part 1</p>
|
1760
1781
|
</item>
|
1761
|
-
<item
|
1782
|
+
<item eId="sec_1__subsec_2__list_1__item_b">
|
1762
1783
|
<num>(b)</num>
|
1763
1784
|
<p>thing</p>
|
1764
1785
|
</item>
|
@@ -1777,17 +1798,17 @@ EOS
|
|
1777
1798
|
stuff
|
1778
1799
|
\\3. a third
|
1779
1800
|
EOS
|
1780
|
-
to_xml(node, "").should == '<section
|
1801
|
+
to_xml(node, "").should == '<section eId="sec_1">
|
1781
1802
|
<num>1.</num>
|
1782
1803
|
<heading>Section</heading>
|
1783
|
-
<
|
1804
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1784
1805
|
<content>
|
1785
1806
|
<p>1. ignored</p>
|
1786
1807
|
<p>2. another line</p>
|
1787
1808
|
<p>stuff</p>
|
1788
1809
|
<p>3. a third</p>
|
1789
1810
|
</content>
|
1790
|
-
</
|
1811
|
+
</hcontainer>
|
1791
1812
|
</section>'
|
1792
1813
|
end
|
1793
1814
|
|
@@ -1799,14 +1820,14 @@ EOS
|
|
1799
1820
|
|
1800
1821
|
stuff
|
1801
1822
|
EOS
|
1802
|
-
to_xml(node, "").should == '<section
|
1823
|
+
to_xml(node, "").should == '<section eId="sec_1">
|
1803
1824
|
<num>1.</num>
|
1804
1825
|
<heading>Section</heading>
|
1805
|
-
<
|
1826
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1806
1827
|
<content>
|
1807
1828
|
<p>stuff</p>
|
1808
1829
|
</content>
|
1809
|
-
</
|
1830
|
+
</hcontainer>
|
1810
1831
|
</section>'
|
1811
1832
|
end
|
1812
1833
|
|
@@ -1818,19 +1839,19 @@ Informal trading may include, amongst others:-
|
|
1818
1839
|
3.1.1 street trading;
|
1819
1840
|
3.1.2 trading in pedestrian malls;
|
1820
1841
|
EOS
|
1821
|
-
to_xml(node, '').should == '<section
|
1842
|
+
to_xml(node, '').should == '<section eId="sec_3">
|
1822
1843
|
<num>3.</num>
|
1823
1844
|
<heading>Types of informal trading</heading>
|
1824
|
-
<subsection
|
1845
|
+
<subsection eId="sec_3__subsec_3-1">
|
1825
1846
|
<num>3.1</num>
|
1826
1847
|
<content>
|
1827
1848
|
<p>Informal trading may include, amongst others:-</p>
|
1828
|
-
<blockList
|
1829
|
-
<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">
|
1830
1851
|
<num>3.1.1</num>
|
1831
1852
|
<p>street trading;</p>
|
1832
1853
|
</item>
|
1833
|
-
<item
|
1854
|
+
<item eId="sec_3__subsec_3-1__list_1__item_3-1-2">
|
1834
1855
|
<num>3.1.2</num>
|
1835
1856
|
<p>trading in pedestrian malls;</p>
|
1836
1857
|
</item>
|
@@ -1847,7 +1868,7 @@ EOS
|
|
1847
1868
|
context 'crossheadings' do
|
1848
1869
|
it 'should handle a inline_items in crossheadings' do
|
1849
1870
|
node = parse :crossheading, "CROSSHEADING something [[remark]] [link](/foo/bar)\n"
|
1850
|
-
to_xml(node, '').should == '<hcontainer
|
1871
|
+
to_xml(node, '').should == '<hcontainer eId="hcontainer_1" name="crossheading">
|
1851
1872
|
<heading>something <remark status="editorial">[remark]</remark> <ref href="/foo/bar">link</ref></heading>
|
1852
1873
|
</hcontainer>'
|
1853
1874
|
end
|
@@ -1865,13 +1886,13 @@ CROSSHEADING In the body
|
|
1865
1886
|
Text
|
1866
1887
|
'
|
1867
1888
|
today = Time.now.strftime('%Y-%m-%d')
|
1868
|
-
to_xml(node, "").should == '<act contains="originalVersion">
|
1889
|
+
to_xml(node, "").should == '<act contains="originalVersion" name="act">
|
1869
1890
|
<meta>
|
1870
1891
|
<identification source="#slaw">
|
1871
1892
|
<FRBRWork>
|
1872
1893
|
<FRBRthis value="/za/act/1980/01/main"/>
|
1873
1894
|
<FRBRuri value="/za/act/1980/01"/>
|
1874
|
-
<FRBRalias value="Short Title"/>
|
1895
|
+
<FRBRalias value="Short Title" name="title"/>
|
1875
1896
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
1876
1897
|
<FRBRauthor href="#council"/>
|
1877
1898
|
<FRBRcountry value="za"/>
|
@@ -1891,25 +1912,25 @@ Text
|
|
1891
1912
|
</FRBRManifestation>
|
1892
1913
|
</identification>
|
1893
1914
|
<references source="#this">
|
1894
|
-
<TLCOrganization
|
1895
|
-
<TLCOrganization
|
1915
|
+
<TLCOrganization eId="slaw" href="https://github.com/longhotsummer/slaw" showAs="Slaw"/>
|
1916
|
+
<TLCOrganization eId="council" href="/ontology/organization/za/council" showAs="Council"/>
|
1896
1917
|
</references>
|
1897
1918
|
</meta>
|
1898
1919
|
<preface>
|
1899
1920
|
<p>Some text</p>
|
1900
1921
|
</preface>
|
1901
1922
|
<body>
|
1902
|
-
<hcontainer
|
1923
|
+
<hcontainer eId="hcontainer_1" name="crossheading">
|
1903
1924
|
<heading>In the body</heading>
|
1904
1925
|
</hcontainer>
|
1905
|
-
<section
|
1926
|
+
<section eId="sec_1">
|
1906
1927
|
<num>1.</num>
|
1907
1928
|
<heading>Section 1</heading>
|
1908
|
-
<
|
1929
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1909
1930
|
<content>
|
1910
1931
|
<p>Text</p>
|
1911
1932
|
</content>
|
1912
|
-
</
|
1933
|
+
</hcontainer>
|
1913
1934
|
</section>
|
1914
1935
|
</body>
|
1915
1936
|
</act>'
|
@@ -1928,13 +1949,13 @@ CROSSHEADING In the body
|
|
1928
1949
|
Text
|
1929
1950
|
'
|
1930
1951
|
today = Time.now.strftime('%Y-%m-%d')
|
1931
|
-
to_xml(node, "").should == '<act contains="originalVersion">
|
1952
|
+
to_xml(node, "").should == '<act contains="originalVersion" name="act">
|
1932
1953
|
<meta>
|
1933
1954
|
<identification source="#slaw">
|
1934
1955
|
<FRBRWork>
|
1935
1956
|
<FRBRthis value="/za/act/1980/01/main"/>
|
1936
1957
|
<FRBRuri value="/za/act/1980/01"/>
|
1937
|
-
<FRBRalias value="Short Title"/>
|
1958
|
+
<FRBRalias value="Short Title" name="title"/>
|
1938
1959
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
1939
1960
|
<FRBRauthor href="#council"/>
|
1940
1961
|
<FRBRcountry value="za"/>
|
@@ -1954,25 +1975,25 @@ Text
|
|
1954
1975
|
</FRBRManifestation>
|
1955
1976
|
</identification>
|
1956
1977
|
<references source="#this">
|
1957
|
-
<TLCOrganization
|
1958
|
-
<TLCOrganization
|
1978
|
+
<TLCOrganization eId="slaw" href="https://github.com/longhotsummer/slaw" showAs="Slaw"/>
|
1979
|
+
<TLCOrganization eId="council" href="/ontology/organization/za/council" showAs="Council"/>
|
1959
1980
|
</references>
|
1960
1981
|
</meta>
|
1961
1982
|
<preamble>
|
1962
1983
|
<p>Some text</p>
|
1963
1984
|
</preamble>
|
1964
1985
|
<body>
|
1965
|
-
<hcontainer
|
1986
|
+
<hcontainer eId="hcontainer_1" name="crossheading">
|
1966
1987
|
<heading>In the body</heading>
|
1967
1988
|
</hcontainer>
|
1968
|
-
<section
|
1989
|
+
<section eId="sec_1">
|
1969
1990
|
<num>1.</num>
|
1970
1991
|
<heading>Section 1</heading>
|
1971
|
-
<
|
1992
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1972
1993
|
<content>
|
1973
1994
|
<p>Text</p>
|
1974
1995
|
</content>
|
1975
|
-
</
|
1996
|
+
</hcontainer>
|
1976
1997
|
</section>
|
1977
1998
|
</body>
|
1978
1999
|
</act>'
|
@@ -2036,14 +2057,14 @@ LONGTITLE a long title
|
|
2036
2057
|
EOS
|
2037
2058
|
|
2038
2059
|
to_xml(node).should == '<body>
|
2039
|
-
<section
|
2060
|
+
<section eId="sec_1">
|
2040
2061
|
<num>1.</num>
|
2041
2062
|
<heading>Section</heading>
|
2042
|
-
<
|
2063
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
2043
2064
|
<content>
|
2044
2065
|
<p>LONGTITLE a long title</p>
|
2045
2066
|
</content>
|
2046
|
-
</
|
2067
|
+
</hcontainer>
|
2047
2068
|
</section>
|
2048
2069
|
</body>'
|
2049
2070
|
end
|