slaw 0.8.3 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/README.md +10 -0
- data/lib/slaw/parse/blocklists.rb +19 -1
- data/lib/slaw/parse/builder.rb +7 -6
- data/lib/slaw/version.rb +1 -1
- data/lib/slaw/za/act.treetop +54 -57
- data/lib/slaw/za/act_nodes.rb +24 -53
- data/spec/parse/builder_spec.rb +135 -10
- data/spec/za/act_spec.rb +225 -129
- metadata +2 -2
data/spec/za/act_spec.rb
CHANGED
@@ -47,11 +47,11 @@ EOS
|
|
47
47
|
<section id="section-1">
|
48
48
|
<num>1.</num>
|
49
49
|
<heading>Section</heading>
|
50
|
-
<
|
50
|
+
<paragraph id="section-1.paragraph-0">
|
51
51
|
<content>
|
52
52
|
<p>Hello there</p>
|
53
53
|
</content>
|
54
|
-
</
|
54
|
+
</paragraph>
|
55
55
|
</section>
|
56
56
|
</body>'
|
57
57
|
end
|
@@ -70,12 +70,12 @@ EOS
|
|
70
70
|
<paragraph id="paragraph-0">
|
71
71
|
<content>
|
72
72
|
<p>Some content before the section</p>
|
73
|
-
<blockList id="
|
74
|
-
<item id="
|
73
|
+
<blockList id="paragraph-0.list1">
|
74
|
+
<item id="paragraph-0.list1.a">
|
75
75
|
<num>(a)</num>
|
76
76
|
<p>foo</p>
|
77
77
|
</item>
|
78
|
-
<item id="
|
78
|
+
<item id="paragraph-0.list1.b">
|
79
79
|
<num>(b)</num>
|
80
80
|
<p>bar</p>
|
81
81
|
</item>
|
@@ -85,11 +85,11 @@ EOS
|
|
85
85
|
<section id="section-1">
|
86
86
|
<num>1.</num>
|
87
87
|
<heading>Section</heading>
|
88
|
-
<
|
88
|
+
<paragraph id="section-1.paragraph-0">
|
89
89
|
<content>
|
90
90
|
<p>Hello there</p>
|
91
91
|
</content>
|
92
|
-
</
|
92
|
+
</paragraph>
|
93
93
|
</section>
|
94
94
|
</body>'
|
95
95
|
end
|
@@ -112,11 +112,11 @@ EOS
|
|
112
112
|
<section id="section-1">
|
113
113
|
<num>1.</num>
|
114
114
|
<heading>Section</heading>
|
115
|
-
<
|
115
|
+
<paragraph id="section-1.paragraph-0">
|
116
116
|
<content>
|
117
117
|
<p>Hello there</p>
|
118
118
|
</content>
|
119
|
-
</
|
119
|
+
</paragraph>
|
120
120
|
</section>
|
121
121
|
</chapter>'
|
122
122
|
end
|
@@ -133,11 +133,11 @@ EOS
|
|
133
133
|
<section id="section-1">
|
134
134
|
<num>1.</num>
|
135
135
|
<heading>Section</heading>
|
136
|
-
<
|
136
|
+
<paragraph id="section-1.paragraph-0">
|
137
137
|
<content>
|
138
138
|
<p>Hello there</p>
|
139
139
|
</content>
|
140
|
-
</
|
140
|
+
</paragraph>
|
141
141
|
</section>
|
142
142
|
</chapter>'
|
143
143
|
end
|
@@ -185,11 +185,11 @@ EOS
|
|
185
185
|
<section id="section-1">
|
186
186
|
<num>1.</num>
|
187
187
|
<heading>Section 1</heading>
|
188
|
-
<
|
188
|
+
<paragraph id="section-1.paragraph-0">
|
189
189
|
<content>
|
190
190
|
<p>Section text.</p>
|
191
191
|
</content>
|
192
|
-
</
|
192
|
+
</paragraph>
|
193
193
|
</section>
|
194
194
|
</chapter>'
|
195
195
|
end
|
@@ -207,11 +207,11 @@ EOS
|
|
207
207
|
<section id="section-1">
|
208
208
|
<num>1.</num>
|
209
209
|
<heading>Section</heading>
|
210
|
-
<
|
210
|
+
<paragraph id="section-1.paragraph-0">
|
211
211
|
<content>
|
212
212
|
<p>Hello there</p>
|
213
213
|
</content>
|
214
|
-
</
|
214
|
+
</paragraph>
|
215
215
|
</section>
|
216
216
|
</chapter>'
|
217
217
|
end
|
@@ -232,6 +232,31 @@ EOS
|
|
232
232
|
</chapter>
|
233
233
|
</body>'
|
234
234
|
end
|
235
|
+
|
236
|
+
it 'should be able to contain just a table' do
|
237
|
+
node = parse :chapter, <<EOS
|
238
|
+
Chapter 2 The Chapter
|
239
|
+
|
240
|
+
{|
|
241
|
+
| foo
|
242
|
+
|}
|
243
|
+
EOS
|
244
|
+
to_xml(node).should == '<chapter id="chapter-2">
|
245
|
+
<num>2</num>
|
246
|
+
<heading>The Chapter</heading>
|
247
|
+
<paragraph id="chapter-2.paragraph-0">
|
248
|
+
<content>
|
249
|
+
<table id="chapter-2.paragraph-0.table0">
|
250
|
+
<tr>
|
251
|
+
<td>
|
252
|
+
<p>foo</p>
|
253
|
+
</td>
|
254
|
+
</tr>
|
255
|
+
</table>
|
256
|
+
</content>
|
257
|
+
</paragraph>
|
258
|
+
</chapter>'
|
259
|
+
end
|
235
260
|
end
|
236
261
|
|
237
262
|
#-------------------------------------------------------------------------------
|
@@ -251,11 +276,11 @@ EOS
|
|
251
276
|
<section id="section-1">
|
252
277
|
<num>1.</num>
|
253
278
|
<heading>Section</heading>
|
254
|
-
<
|
279
|
+
<paragraph id="section-1.paragraph-0">
|
255
280
|
<content>
|
256
281
|
<p>Hello there</p>
|
257
282
|
</content>
|
258
|
-
</
|
283
|
+
</paragraph>
|
259
284
|
</section>
|
260
285
|
</part>'
|
261
286
|
end
|
@@ -272,11 +297,11 @@ EOS
|
|
272
297
|
<section id="section-1">
|
273
298
|
<num>1.</num>
|
274
299
|
<heading>Section</heading>
|
275
|
-
<
|
300
|
+
<paragraph id="section-1.paragraph-0">
|
276
301
|
<content>
|
277
302
|
<p>Hello there</p>
|
278
303
|
</content>
|
279
|
-
</
|
304
|
+
</paragraph>
|
280
305
|
</section>
|
281
306
|
</part>'
|
282
307
|
end
|
@@ -293,11 +318,11 @@ EOS
|
|
293
318
|
<section id="section-1">
|
294
319
|
<num>1.</num>
|
295
320
|
<heading>Section</heading>
|
296
|
-
<
|
321
|
+
<paragraph id="section-1.paragraph-0">
|
297
322
|
<content>
|
298
323
|
<p>Hello there</p>
|
299
324
|
</content>
|
300
|
-
</
|
325
|
+
</paragraph>
|
301
326
|
</section>
|
302
327
|
</part>'
|
303
328
|
end
|
@@ -314,11 +339,11 @@ EOS
|
|
314
339
|
<section id="section-1">
|
315
340
|
<num>1.</num>
|
316
341
|
<heading>Section</heading>
|
317
|
-
<
|
342
|
+
<paragraph id="section-1.paragraph-0">
|
318
343
|
<content>
|
319
344
|
<p>Hello there</p>
|
320
345
|
</content>
|
321
|
-
</
|
346
|
+
</paragraph>
|
322
347
|
</section>
|
323
348
|
</part>'
|
324
349
|
end
|
@@ -336,11 +361,11 @@ EOS
|
|
336
361
|
<section id="section-1">
|
337
362
|
<num>1.</num>
|
338
363
|
<heading>Section</heading>
|
339
|
-
<
|
364
|
+
<paragraph id="section-1.paragraph-0">
|
340
365
|
<content>
|
341
366
|
<p>Hello there</p>
|
342
367
|
</content>
|
343
|
-
</
|
368
|
+
</paragraph>
|
344
369
|
</section>
|
345
370
|
</part>'
|
346
371
|
end
|
@@ -359,11 +384,11 @@ EOS
|
|
359
384
|
<section id="section-1">
|
360
385
|
<num>1.</num>
|
361
386
|
<heading/>
|
362
|
-
<
|
387
|
+
<paragraph id="section-1.paragraph-0">
|
363
388
|
<content>
|
364
389
|
<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>
|
365
390
|
</content>
|
366
|
-
</
|
391
|
+
</paragraph>
|
367
392
|
</section>
|
368
393
|
</part>'
|
369
394
|
end
|
@@ -391,11 +416,11 @@ EOS
|
|
391
416
|
<section id="section-1">
|
392
417
|
<num>1.</num>
|
393
418
|
<heading>Section</heading>
|
394
|
-
<
|
419
|
+
<paragraph id="section-1.paragraph-0">
|
395
420
|
<content>
|
396
421
|
<p>Hello there</p>
|
397
422
|
</content>
|
398
|
-
</
|
423
|
+
</paragraph>
|
399
424
|
</section>
|
400
425
|
</part>'
|
401
426
|
end
|
@@ -428,35 +453,6 @@ EOS
|
|
428
453
|
EOS
|
429
454
|
end
|
430
455
|
|
431
|
-
it 'should handle a naked statement' do
|
432
|
-
should_parse :subsection, 'naked statement'
|
433
|
-
end
|
434
|
-
|
435
|
-
it 'should handle a naked statement and blocklist' do
|
436
|
-
node = parse :subsection, <<EOS
|
437
|
-
naked statement (c) blah
|
438
|
-
(a) foo
|
439
|
-
(b) bar
|
440
|
-
EOS
|
441
|
-
node.statement.clauses.text_value.should == "naked statement (c) blah"
|
442
|
-
node.blocklist.elements.first.num.should == "(a)"
|
443
|
-
to_xml(node, "").should == '<subsection id="subsection-0">
|
444
|
-
<content>
|
445
|
-
<blockList id="subsection-0.list0">
|
446
|
-
<listIntroduction>naked statement (c) blah</listIntroduction>
|
447
|
-
<item id="subsection-0.list0.a">
|
448
|
-
<num>(a)</num>
|
449
|
-
<p>foo</p>
|
450
|
-
</item>
|
451
|
-
<item id="subsection-0.list0.b">
|
452
|
-
<num>(b)</num>
|
453
|
-
<p>bar</p>
|
454
|
-
</item>
|
455
|
-
</blockList>
|
456
|
-
</content>
|
457
|
-
</subsection>'
|
458
|
-
end
|
459
|
-
|
460
456
|
it 'should handle a blocklist' do
|
461
457
|
node = parse :subsection, <<EOS
|
462
458
|
(2) title
|
@@ -465,26 +461,24 @@ EOS
|
|
465
461
|
(c) three
|
466
462
|
(i) four
|
467
463
|
EOS
|
468
|
-
node.
|
469
|
-
node.statement.content.text_value.should == "title"
|
470
|
-
to_xml(node, "").should == '<subsection id="2">
|
464
|
+
to_xml(node, "", 1).should == '<subsection id="2">
|
471
465
|
<num>(2)</num>
|
472
466
|
<content>
|
473
|
-
<
|
474
|
-
|
475
|
-
<item id="2.
|
467
|
+
<p>title</p>
|
468
|
+
<blockList id="2.list1">
|
469
|
+
<item id="2.list1.a">
|
476
470
|
<num>(a)</num>
|
477
471
|
<p>one</p>
|
478
472
|
</item>
|
479
|
-
<item id="2.
|
473
|
+
<item id="2.list1.b">
|
480
474
|
<num>(b)</num>
|
481
475
|
<p>two</p>
|
482
476
|
</item>
|
483
|
-
<item id="2.
|
477
|
+
<item id="2.list1.c">
|
484
478
|
<num>(c)</num>
|
485
479
|
<p>three</p>
|
486
480
|
</item>
|
487
|
-
<item id="2.
|
481
|
+
<item id="2.list1.i">
|
488
482
|
<num>(i)</num>
|
489
483
|
<p>four</p>
|
490
484
|
</item>
|
@@ -501,10 +495,7 @@ EOS
|
|
501
495
|
(i) four
|
502
496
|
EOS
|
503
497
|
)
|
504
|
-
node.
|
505
|
-
node.blocklist.elements.first.num.should == "(a)"
|
506
|
-
node.blocklist.elements.first.content.should == "one"
|
507
|
-
to_xml(node, "").should == '<subsection id="1">
|
498
|
+
to_xml(node, "", 1).should == '<subsection id="1">
|
508
499
|
<num>(1)</num>
|
509
500
|
<content>
|
510
501
|
<blockList id="1.list0">
|
@@ -537,30 +528,23 @@ EOS
|
|
537
528
|
(ii) double
|
538
529
|
EOS
|
539
530
|
)
|
540
|
-
node.
|
541
|
-
node.blocklist.elements.first.num.should == "(a)"
|
542
|
-
node.blocklist.elements.first.content.should == "one"
|
543
|
-
node.blocklist.elements[1].num.should == "(b)"
|
544
|
-
node.blocklist.elements[1].content.should be_nil
|
545
|
-
node.blocklist.elements[2].num.should == "(i)"
|
546
|
-
node.blocklist.elements[2].content.should == "single"
|
547
|
-
to_xml(node, "").should == '<subsection id="1">
|
531
|
+
to_xml(node, "", 1).should == '<subsection id="1">
|
548
532
|
<num>(1)</num>
|
549
533
|
<content>
|
550
|
-
<
|
551
|
-
|
552
|
-
<item id="1.
|
534
|
+
<p>here\'s my really cool list,</p>
|
535
|
+
<blockList id="1.list1">
|
536
|
+
<item id="1.list1.a">
|
553
537
|
<num>(a)</num>
|
554
538
|
<p>one</p>
|
555
539
|
</item>
|
556
|
-
<item id="1.
|
540
|
+
<item id="1.list1.b">
|
557
541
|
<num>(b)</num>
|
558
542
|
</item>
|
559
|
-
<item id="1.
|
543
|
+
<item id="1.list1.i">
|
560
544
|
<num>(i)</num>
|
561
545
|
<p>single</p>
|
562
546
|
</item>
|
563
|
-
<item id="1.
|
547
|
+
<item id="1.list1.ii">
|
564
548
|
<num>(ii)</num>
|
565
549
|
<p>double</p>
|
566
550
|
</item>
|
@@ -574,8 +558,7 @@ EOS
|
|
574
558
|
node = parse :subsection, <<EOS
|
575
559
|
9.9. foo
|
576
560
|
EOS
|
577
|
-
node.
|
578
|
-
node.statement.num.should == "9.9"
|
561
|
+
node.num.should == "9.9"
|
579
562
|
end
|
580
563
|
|
581
564
|
it 'should handle dotted number sublists' do
|
@@ -586,14 +569,68 @@ EOS
|
|
586
569
|
9.9.2.1 item3
|
587
570
|
EOS
|
588
571
|
)
|
589
|
-
node.
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
572
|
+
to_xml(node, '', 1).should == '<subsection id="9.9">
|
573
|
+
<num>9.9</num>
|
574
|
+
<content>
|
575
|
+
<p>foo</p>
|
576
|
+
<blockList id="9.9.list1">
|
577
|
+
<item id="9.9.list1.9.9.1">
|
578
|
+
<num>9.9.1</num>
|
579
|
+
<p>item1</p>
|
580
|
+
</item>
|
581
|
+
<item id="9.9.list1.9.9.2">
|
582
|
+
<num>9.9.2</num>
|
583
|
+
<p>item2</p>
|
584
|
+
</item>
|
585
|
+
<item id="9.9.list1.9.9.2.1">
|
586
|
+
<num>9.9.2.1</num>
|
587
|
+
<p>item3</p>
|
588
|
+
</item>
|
589
|
+
</blockList>
|
590
|
+
</content>
|
591
|
+
</subsection>'
|
595
592
|
end
|
596
593
|
end
|
594
|
+
|
595
|
+
it 'should id blocklists correctly' do
|
596
|
+
node = parse(:subsection, <<EOS
|
597
|
+
(1) a list
|
598
|
+
(a) item 1
|
599
|
+
(b) item 2
|
600
|
+
some text
|
601
|
+
(c) item 3
|
602
|
+
(d) item 4
|
603
|
+
EOS
|
604
|
+
)
|
605
|
+
|
606
|
+
to_xml(node, '', 1).should == '<subsection id="1">
|
607
|
+
<num>(1)</num>
|
608
|
+
<content>
|
609
|
+
<p>a list</p>
|
610
|
+
<blockList id="1.list1">
|
611
|
+
<item id="1.list1.a">
|
612
|
+
<num>(a)</num>
|
613
|
+
<p>item 1</p>
|
614
|
+
</item>
|
615
|
+
<item id="1.list1.b">
|
616
|
+
<num>(b)</num>
|
617
|
+
<p>item 2</p>
|
618
|
+
</item>
|
619
|
+
</blockList>
|
620
|
+
<p>some text</p>
|
621
|
+
<blockList id="1.list3">
|
622
|
+
<item id="1.list3.c">
|
623
|
+
<num>(c)</num>
|
624
|
+
<p>item 3</p>
|
625
|
+
</item>
|
626
|
+
<item id="1.list3.d">
|
627
|
+
<num>(d)</num>
|
628
|
+
<p>item 4</p>
|
629
|
+
</item>
|
630
|
+
</blockList>
|
631
|
+
</content>
|
632
|
+
</subsection>'
|
633
|
+
end
|
597
634
|
end
|
598
635
|
|
599
636
|
#-------------------------------------------------------------------------------
|
@@ -601,34 +638,34 @@ EOS
|
|
601
638
|
|
602
639
|
describe 'remark' do
|
603
640
|
it 'should handle a plain remark' do
|
604
|
-
node = parse :
|
641
|
+
node = parse :block_paragraphs, <<EOS
|
605
642
|
[[Section 2 amended by Act 23 of 2004]]
|
606
643
|
EOS
|
607
|
-
to_xml(node, "").should == '<
|
644
|
+
to_xml(node, "").should == '<paragraph id="paragraph-0">
|
608
645
|
<content>
|
609
646
|
<p>
|
610
647
|
<remark status="editorial">[Section 2 amended by Act 23 of 2004]</remark>
|
611
648
|
</p>
|
612
649
|
</content>
|
613
|
-
</
|
650
|
+
</paragraph>'
|
614
651
|
end
|
615
652
|
|
616
653
|
it 'should handle an inline remark at the end of a sentence' do
|
617
|
-
node = parse :
|
654
|
+
node = parse :block_paragraphs, <<EOS
|
618
655
|
This statement has an inline remark. [[Section 2 amended by Act 23 of 2004]]
|
619
656
|
EOS
|
620
|
-
to_xml(node, "").should == '<
|
657
|
+
to_xml(node, "").should == '<paragraph id="paragraph-0">
|
621
658
|
<content>
|
622
659
|
<p>This statement has an inline remark. <remark status="editorial">[Section 2 amended by Act 23 of 2004]</remark></p>
|
623
660
|
</content>
|
624
|
-
</
|
661
|
+
</paragraph>'
|
625
662
|
end
|
626
663
|
|
627
664
|
it 'should handle an inline remark mid-way through' do
|
628
665
|
node = parse :subsection, <<EOS
|
629
666
|
(1) This statement has an inline remark. [[Section 2 amended by Act 23 of 2004]] And now some more.
|
630
667
|
EOS
|
631
|
-
to_xml(node, "").should == '<subsection id="1">
|
668
|
+
to_xml(node, "", 1).should == '<subsection id="1">
|
632
669
|
<num>(1)</num>
|
633
670
|
<content>
|
634
671
|
<p>This statement has an inline remark. <remark status="editorial">[Section 2 amended by Act 23 of 2004]</remark> And now some more.</p>
|
@@ -637,14 +674,14 @@ EOS
|
|
637
674
|
end
|
638
675
|
|
639
676
|
it 'should handle many inline remarks' do
|
640
|
-
node = parse :
|
677
|
+
node = parse :block_paragraphs, <<EOS
|
641
678
|
This statement has an inline remark. [[Section 2 amended by Act 23 of 2004]]. And now some more. [[Another remark]] [[and another]]
|
642
679
|
EOS
|
643
|
-
to_xml(node, "").should == '<
|
680
|
+
to_xml(node, "").should == '<paragraph id="paragraph-0">
|
644
681
|
<content>
|
645
682
|
<p>This statement has an inline remark. <remark status="editorial">[Section 2 amended by Act 23 of 2004]</remark>. And now some more. <remark status="editorial">[Another remark]</remark> <remark status="editorial">[and another]</remark></p>
|
646
683
|
</content>
|
647
|
-
</
|
684
|
+
</paragraph>'
|
648
685
|
end
|
649
686
|
|
650
687
|
it 'should handle a remark in a section' do
|
@@ -657,18 +694,14 @@ EOS
|
|
657
694
|
to_xml(node).should == '<section id="section-1">
|
658
695
|
<num>1.</num>
|
659
696
|
<heading>Section title</heading>
|
660
|
-
<
|
697
|
+
<paragraph id="section-1.paragraph-0">
|
661
698
|
<content>
|
662
699
|
<p>Some text is a long line.</p>
|
663
|
-
</content>
|
664
|
-
</subsection>
|
665
|
-
<subsection id="section-1.subsection-1">
|
666
|
-
<content>
|
667
700
|
<p>
|
668
701
|
<remark status="editorial">[Section 1 amended by Act 23 of 2004]</remark>
|
669
702
|
</p>
|
670
703
|
</content>
|
671
|
-
</
|
704
|
+
</paragraph>
|
672
705
|
</section>'
|
673
706
|
end
|
674
707
|
|
@@ -713,7 +746,7 @@ EOS
|
|
713
746
|
<mainBody>
|
714
747
|
<article id="schedule1">
|
715
748
|
<heading>A Title</heading>
|
716
|
-
<paragraph id="paragraph-0">
|
749
|
+
<paragraph id="schedule1.paragraph-0">
|
717
750
|
<content>
|
718
751
|
<p>
|
719
752
|
<remark status="editorial">[Schedule 1 added by Act 23 of 2004]</remark>
|
@@ -733,8 +766,8 @@ EOS
|
|
733
766
|
|
734
767
|
describe 'numbered_statement' do
|
735
768
|
it 'should handle basic numbered statements' do
|
736
|
-
should_parse :
|
737
|
-
should_parse :
|
769
|
+
should_parse :subsection, '(1) foo bar'
|
770
|
+
should_parse :subsection, '(1a) foo bar'
|
738
771
|
end
|
739
772
|
end
|
740
773
|
|
@@ -963,9 +996,9 @@ EOS
|
|
963
996
|
end
|
964
997
|
|
965
998
|
#-------------------------------------------------------------------------------
|
966
|
-
#
|
999
|
+
# Section
|
967
1000
|
|
968
|
-
context '
|
1001
|
+
context 'section' do
|
969
1002
|
it 'should handle section numbers after title' do
|
970
1003
|
subject.parser.options = {section_number_after_title: true}
|
971
1004
|
node = parse :section, <<EOS
|
@@ -1060,6 +1093,73 @@ EOS
|
|
1060
1093
|
<p>Without limiting generality, stuff.</p>
|
1061
1094
|
</content>
|
1062
1095
|
</subsection>
|
1096
|
+
</section>'
|
1097
|
+
end
|
1098
|
+
|
1099
|
+
it 'should handle sections that dive straight into lists' do
|
1100
|
+
subject.parser.options = {section_number_after_title: false}
|
1101
|
+
node = parse :section, <<EOS
|
1102
|
+
1. Section
|
1103
|
+
(a) first
|
1104
|
+
(b) second
|
1105
|
+
and some stuff
|
1106
|
+
EOS
|
1107
|
+
|
1108
|
+
s = to_xml(node)
|
1109
|
+
s.should == '<section id="section-1">
|
1110
|
+
<num>1.</num>
|
1111
|
+
<heading>Section</heading>
|
1112
|
+
<paragraph id="section-1.paragraph-0">
|
1113
|
+
<content>
|
1114
|
+
<blockList id="section-1.paragraph-0.list0">
|
1115
|
+
<item id="section-1.paragraph-0.list0.a">
|
1116
|
+
<num>(a)</num>
|
1117
|
+
<p>first</p>
|
1118
|
+
</item>
|
1119
|
+
<item id="section-1.paragraph-0.list0.b">
|
1120
|
+
<num>(b)</num>
|
1121
|
+
<p>second</p>
|
1122
|
+
</item>
|
1123
|
+
</blockList>
|
1124
|
+
<p>and some stuff</p>
|
1125
|
+
</content>
|
1126
|
+
</paragraph>
|
1127
|
+
</section>'
|
1128
|
+
end
|
1129
|
+
|
1130
|
+
it 'should handle a naked statement' do
|
1131
|
+
should_parse :section, <<EOS
|
1132
|
+
1. Section
|
1133
|
+
|
1134
|
+
naked statement
|
1135
|
+
EOS
|
1136
|
+
end
|
1137
|
+
|
1138
|
+
it 'should handle a naked statement and blocklist' do
|
1139
|
+
node = parse :section, <<EOS
|
1140
|
+
1. Section
|
1141
|
+
naked statement (c) blah
|
1142
|
+
(a) foo
|
1143
|
+
(b) bar
|
1144
|
+
EOS
|
1145
|
+
to_xml(node, "").should == '<section id="section-1">
|
1146
|
+
<num>1.</num>
|
1147
|
+
<heading>Section</heading>
|
1148
|
+
<paragraph id="section-1.paragraph-0">
|
1149
|
+
<content>
|
1150
|
+
<p>naked statement (c) blah</p>
|
1151
|
+
<blockList id="section-1.paragraph-0.list1">
|
1152
|
+
<item id="section-1.paragraph-0.list1.a">
|
1153
|
+
<num>(a)</num>
|
1154
|
+
<p>foo</p>
|
1155
|
+
</item>
|
1156
|
+
<item id="section-1.paragraph-0.list1.b">
|
1157
|
+
<num>(b)</num>
|
1158
|
+
<p>bar</p>
|
1159
|
+
</item>
|
1160
|
+
</blockList>
|
1161
|
+
</content>
|
1162
|
+
</paragraph>
|
1063
1163
|
</section>'
|
1064
1164
|
end
|
1065
1165
|
end
|
@@ -1107,7 +1207,7 @@ EOS
|
|
1107
1207
|
</meta>
|
1108
1208
|
<mainBody>
|
1109
1209
|
<article id="schedule">
|
1110
|
-
<paragraph id="paragraph-0">
|
1210
|
+
<paragraph id="schedule.paragraph-0">
|
1111
1211
|
<content>
|
1112
1212
|
<p>Subject to approval in terms of this By-Law, the erection:</p>
|
1113
1213
|
</content>
|
@@ -1214,7 +1314,7 @@ EOS
|
|
1214
1314
|
<mainBody>
|
1215
1315
|
<article id="schedule3">
|
1216
1316
|
<heading>Another Title</heading>
|
1217
|
-
<paragraph id="paragraph-0">
|
1317
|
+
<paragraph id="schedule3.paragraph-0">
|
1218
1318
|
<content>
|
1219
1319
|
<p>Baz</p>
|
1220
1320
|
<p>Boom</p>
|
@@ -1271,7 +1371,7 @@ EOS
|
|
1271
1371
|
<mainBody>
|
1272
1372
|
<article id="schedule1">
|
1273
1373
|
<heading>Schedule Heading</heading>
|
1274
|
-
<paragraph id="paragraph-0">
|
1374
|
+
<paragraph id="schedule1.paragraph-0">
|
1275
1375
|
<content>
|
1276
1376
|
<p>Subject to approval in terms of this By-Law, the erection:</p>
|
1277
1377
|
</content>
|
@@ -1331,7 +1431,7 @@ EOS
|
|
1331
1431
|
<mainBody>
|
1332
1432
|
<article id="schedule1">
|
1333
1433
|
<heading>Schedule Heading</heading>
|
1334
|
-
<paragraph id="paragraph-0">
|
1434
|
+
<paragraph id="schedule1.paragraph-0">
|
1335
1435
|
<content>
|
1336
1436
|
<p>Subject to approval in terms of this By-Law, the erection:</p>
|
1337
1437
|
</content>
|
@@ -1389,7 +1489,7 @@ EOS
|
|
1389
1489
|
</meta>
|
1390
1490
|
<mainBody>
|
1391
1491
|
<article id="firstschedule">
|
1392
|
-
<paragraph id="paragraph-0">
|
1492
|
+
<paragraph id="firstschedule.paragraph-0">
|
1393
1493
|
<content>
|
1394
1494
|
<p>Subject to approval in terms of this By-Law, the erection:</p>
|
1395
1495
|
</content>
|
@@ -1449,7 +1549,7 @@ EOS
|
|
1449
1549
|
</meta>
|
1450
1550
|
<mainBody>
|
1451
1551
|
<article id="schedule1">
|
1452
|
-
<paragraph id="paragraph-0">
|
1552
|
+
<paragraph id="schedule1.paragraph-0">
|
1453
1553
|
<content>
|
1454
1554
|
<p>Other than as is set out hereinbelow, no signs other than locality bound signs, temporary signs including loose portable sign, estate agents signs, newspaper headline posters and posters (the erection of which must comply with the appropriate schedules pertinent thereto) shall be erected on Municipal owned land.</p>
|
1455
1555
|
</content>
|
@@ -1596,19 +1696,15 @@ EOS
|
|
1596
1696
|
xml.should == '<section id="section-10">
|
1597
1697
|
<num>10.</num>
|
1598
1698
|
<heading>A section title</heading>
|
1599
|
-
<
|
1699
|
+
<paragraph id="section-10.paragraph-0">
|
1600
1700
|
<content>
|
1601
1701
|
<p>Heres a table:</p>
|
1602
|
-
|
1603
|
-
</subsection>
|
1604
|
-
<subsection id="section-10.subsection-1">
|
1605
|
-
<content>
|
1606
|
-
<table id="section-10.subsection-1.table0"><tr><td><p>r1c1</p></td>
|
1702
|
+
<table id="section-10.paragraph-0.table1"><tr><td><p>r1c1</p></td>
|
1607
1703
|
<td><p>r1c2</p></td></tr>
|
1608
1704
|
<tr><td><p>r2c1</p></td>
|
1609
1705
|
<td><p>r2c2</p></td></tr></table>
|
1610
1706
|
</content>
|
1611
|
-
</
|
1707
|
+
</paragraph>
|
1612
1708
|
</section>'
|
1613
1709
|
end
|
1614
1710
|
|
@@ -1658,10 +1754,10 @@ EOS
|
|
1658
1754
|
</meta>
|
1659
1755
|
<mainBody>
|
1660
1756
|
<article id="schedule1">
|
1661
|
-
<paragraph id="paragraph-0">
|
1757
|
+
<paragraph id="schedule1.paragraph-0">
|
1662
1758
|
<content>
|
1663
1759
|
<p>Heres a table:</p>
|
1664
|
-
<table id="
|
1760
|
+
<table id="schedule1.paragraph-0.table1"><tr><td><p>r1c1</p></td>
|
1665
1761
|
<td><p>r1c2</p></td></tr>
|
1666
1762
|
<tr><td><p>r2c1</p></td>
|
1667
1763
|
<td><p>r2c2</p></td></tr></table>
|