slaw 10.7.0 → 11.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e4cdd070ad171d0d999cbaa93da4fb2723df0a2d430679833d3588903049575
4
- data.tar.gz: 33bffb144c455bb8d35f7c8dc7e3593041eead5d1c76569575afa8df73bd0a8e
3
+ metadata.gz: 736f598c8a9924a22e2474b2380a229a49188b9fab567280a167cc187554fdb0
4
+ data.tar.gz: 01de6d73cd7352ff0d6dfbf201b25e7eeb219f6f213dbb8d4c7e05bca40e5b6b
5
5
  SHA512:
6
- metadata.gz: b69cf6e2303be5096d3697ced6fe3bb1538d46a5657c718f8e1c6e8e4edee1b1c24ea4b7a6f199920499412b716cfa21e0fddb72be46928377d02145236831cf
7
- data.tar.gz: 13744a12c6e8f62d90cd6fd4b553e3d45f4dd7b38ca076c6da2d2dcea7e72a31feb9345f687d7d29fa5a0d9a8874c4a506929f5c1a73838f2b551df8cc063806
6
+ metadata.gz: faab27a9d122bde77325b295e1d9f705edd314cb9a7abd2cdff8b5e08fd9cdc43333c879e8e7c7e7dd1c7ba9e702457ef683372c890726739f46fc002ee26f3e
7
+ data.tar.gz: 0c289d9a797771c43be62059cf0b08f4a0730ca637400c2e38aedd2285c193cf1c6ce44763b1a4c6c33335200c00351982ff46002fd60cd5c5e194444b8798b6
data/README.md CHANGED
@@ -86,6 +86,11 @@ You can create your own grammar by creating a gem that provides these files and
86
86
 
87
87
  ## Changelog
88
88
 
89
+ ### 11.0.0 (2021-10-29)
90
+
91
+ * Prefix eId attributes in attachments with attachement's eId
92
+ * Use crossHeading element for crossheadings
93
+
89
94
  ### 10.7.0 (11 June 2021)
90
95
 
91
96
  * Support underlines with `__text__`
@@ -97,8 +97,9 @@ module Slaw
97
97
 
98
98
  # the schedule id is derived from the heading
99
99
  schedule_id = self.schedule_id(heading_text, i)
100
+ eId = "att_#{i}"
100
101
 
101
- b.attachment(eId: "att_#{i}") { |b|
102
+ b.attachment(eId: eId) { |b|
102
103
  schedule_title.to_xml(b, '', heading_text)
103
104
  b.doc_(name: "schedule") { |b|
104
105
  b.meta { |b|
@@ -128,7 +129,7 @@ module Slaw
128
129
  }
129
130
 
130
131
  b.mainBody { |b|
131
- body.children.elements.each_with_index { |e| e.to_xml(b, '', i) } if body.is_a? Body
132
+ body.children.elements.each_with_index { |e| e.to_xml(b, eId + "__", i) } if body.is_a? Body
132
133
  }
133
134
  }
134
135
  }
@@ -234,8 +234,14 @@ module Slaw
234
234
  section_title.num
235
235
  end
236
236
 
237
- def to_xml(b, *args)
237
+ def to_xml(b, idprefix='', *args)
238
238
  id = "sec_#{Slaw::Grammars::Counters.clean(num)}"
239
+ # For historical reasons, we normally ignore the idprefix for sections, assuming
240
+ # them to be unique. However, in an attachment (eg. a schedule), ensure they
241
+ # are correctly prefixed
242
+ # TODO: always include the idprefix
243
+ id = idprefix + id if idprefix.start_with? 'att_'
244
+
239
245
  b.section(eId: id) { |b|
240
246
  section_title.to_xml(b)
241
247
 
@@ -371,13 +377,11 @@ module Slaw
371
377
 
372
378
  class Crossheading < Treetop::Runtime::SyntaxNode
373
379
  def to_xml(b, idprefix, i=0)
374
- cnt = Slaw::Grammars::Counters.counters[idprefix]['hcontainer'] += 1
375
- id = "#{idprefix}hcontainer_#{cnt}"
380
+ cnt = Slaw::Grammars::Counters.counters[idprefix]['crossHeading'] += 1
381
+ id = "#{idprefix}crossHeading_#{cnt}"
376
382
 
377
- b.hcontainer(eId: id, name: 'crossheading') { |b|
378
- b.heading { |b|
383
+ b.crossHeading(eId: id) { |b|
379
384
  inline_items.to_xml(b, idprefix)
380
- }
381
385
  }
382
386
  end
383
387
  end
@@ -231,9 +231,9 @@
231
231
  </xsl:template>
232
232
 
233
233
  <!-- crossheadings -->
234
- <xsl:template match="a:hcontainer[@name='crossheading']">
234
+ <xsl:template match="a:crossHeading">
235
235
  <xsl:text>CROSSHEADING </xsl:text>
236
- <xsl:apply-templates select="a:heading" />
236
+ <xsl:apply-templates />
237
237
  <xsl:text>&#10;&#10;</xsl:text>
238
238
  </xsl:template>
239
239
 
data/lib/slaw/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Slaw
2
- VERSION = "10.7.0"
2
+ VERSION = "11.0.0"
3
3
  end
@@ -59,9 +59,7 @@ EOS
59
59
  <p>Hello there</p>
60
60
  </content>
61
61
  </hcontainer>
62
- <hcontainer eId="sec_1__hcontainer_2" name="crossheading">
63
- <heading>crossheading</heading>
64
- </hcontainer>
62
+ <crossHeading eId="sec_1__crossHeading_1">crossheading</crossHeading>
65
63
  </section>
66
64
  </body>'
67
65
  end
@@ -96,9 +94,7 @@ EOS
96
94
  </blockList>
97
95
  </content>
98
96
  </hcontainer>
99
- <hcontainer eId="hcontainer_2" name="crossheading">
100
- <heading>crossheading</heading>
101
- </hcontainer>
97
+ <crossHeading eId="crossHeading_1">crossheading</crossHeading>
102
98
  <section eId="sec_1">
103
99
  <num>1.</num>
104
100
  <heading>Section</heading>
@@ -107,9 +103,7 @@ EOS
107
103
  <p>Hello there</p>
108
104
  </content>
109
105
  </hcontainer>
110
- <hcontainer eId="sec_1__hcontainer_2" name="crossheading">
111
- <heading>crossheading</heading>
112
- </hcontainer>
106
+ <crossHeading eId="sec_1__crossHeading_1">crossheading</crossHeading>
113
107
  </section>
114
108
  </body>'
115
109
  end
@@ -260,10 +254,8 @@ EOS
260
254
  to_xml(node).should == '<chapter eId="chp_2">
261
255
  <num>2</num>
262
256
  <heading>The Chapter Heading</heading>
263
- <hcontainer eId="chp_2__hcontainer_1" name="crossheading">
264
- <heading>crossheading</heading>
265
- </hcontainer>
266
- <hcontainer eId="chp_2__hcontainer_2" name="hcontainer">
257
+ <crossHeading eId="chp_2__crossHeading_1">crossheading</crossHeading>
258
+ <hcontainer eId="chp_2__hcontainer_1" name="hcontainer">
267
259
  <content>
268
260
  <p>Some lines at the start of the chapter.</p>
269
261
  </content>
@@ -489,9 +481,7 @@ EOS
489
481
  to_xml(node).should == '<part eId="part_2">
490
482
  <num>2</num>
491
483
  <heading>The Part Heading</heading>
492
- <hcontainer eId="part_2__hcontainer_1" name="crossheading">
493
- <heading>crossheading</heading>
494
- </hcontainer>
484
+ <crossHeading eId="part_2__crossHeading_1">crossheading</crossHeading>
495
485
  <section eId="sec_1">
496
486
  <num>1.</num>
497
487
  <heading>Section</heading>
@@ -1872,9 +1862,7 @@ EOS
1872
1862
  context 'crossheadings' do
1873
1863
  it 'should handle a inline_items in crossheadings' do
1874
1864
  node = parse :crossheading, "CROSSHEADING something [[remark]] [link](/foo/bar)\n"
1875
- to_xml(node, '').should == '<hcontainer eId="hcontainer_1" name="crossheading">
1876
- <heading>something <remark status="editorial">[remark]</remark> <ref href="/foo/bar">link</ref></heading>
1877
- </hcontainer>'
1865
+ to_xml(node, '').should == '<crossHeading eId="crossHeading_1">something <remark status="editorial">[remark]</remark> <ref href="/foo/bar">link</ref></crossHeading>'
1878
1866
  end
1879
1867
 
1880
1868
  it 'should not be allowed in preface' do
@@ -1924,9 +1912,7 @@ Text
1924
1912
  <p>Some text</p>
1925
1913
  </preface>
1926
1914
  <body>
1927
- <hcontainer eId="hcontainer_1" name="crossheading">
1928
- <heading>In the body</heading>
1929
- </hcontainer>
1915
+ <crossHeading eId="crossHeading_1">In the body</crossHeading>
1930
1916
  <section eId="sec_1">
1931
1917
  <num>1.</num>
1932
1918
  <heading>Section 1</heading>
@@ -1987,9 +1973,7 @@ Text
1987
1973
  <p>Some text</p>
1988
1974
  </preamble>
1989
1975
  <body>
1990
- <hcontainer eId="hcontainer_1" name="crossheading">
1991
- <heading>In the body</heading>
1992
- </hcontainer>
1976
+ <crossHeading eId="crossHeading_1">In the body</crossHeading>
1993
1977
  <section eId="sec_1">
1994
1978
  <num>1.</num>
1995
1979
  <heading>Section 1</heading>
@@ -197,7 +197,7 @@ EOS
197
197
  </identification>
198
198
  </meta>
199
199
  <mainBody>
200
- <hcontainer eId="hcontainer_1" name="hcontainer">
200
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
201
201
  <content>
202
202
  <p>
203
203
  <remark status="editorial">[Schedule 1 added by Act 23 of 2004]</remark>
@@ -88,11 +88,11 @@ EOS
88
88
  </identification>
89
89
  </meta>
90
90
  <mainBody>
91
- <section eId="sec_1">
91
+ <section eId="att_1__sec_1">
92
92
  <num>1.</num>
93
93
  <heading>Foo</heading>
94
94
  </section>
95
- <section eId="sec_2">
95
+ <section eId="att_1__sec_2">
96
96
  <num>2.</num>
97
97
  <heading>Bar</heading>
98
98
  </section>
@@ -129,7 +129,7 @@ EOS
129
129
  </identification>
130
130
  </meta>
131
131
  <mainBody>
132
- <hcontainer eId="hcontainer_1" name="hcontainer">
132
+ <hcontainer eId="att_2__hcontainer_1" name="hcontainer">
133
133
  <content>
134
134
  <p>Baz</p>
135
135
  <p>Boom</p>
@@ -186,16 +186,16 @@ EOS
186
186
  </identification>
187
187
  </meta>
188
188
  <mainBody>
189
- <hcontainer eId="hcontainer_1" name="hcontainer">
189
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
190
190
  <content>
191
191
  <p>Subject to approval in terms of this By-Law, the erection:</p>
192
192
  </content>
193
193
  </hcontainer>
194
- <section eId="sec_1">
194
+ <section eId="att_1__sec_1">
195
195
  <num>1.</num>
196
196
  <heading>Foo</heading>
197
197
  </section>
198
- <section eId="sec_2">
198
+ <section eId="att_1__sec_2">
199
199
  <num>2.</num>
200
200
  <heading>Bar</heading>
201
201
  </section>
@@ -246,16 +246,16 @@ EOS
246
246
  </identification>
247
247
  </meta>
248
248
  <mainBody>
249
- <hcontainer eId="hcontainer_1" name="hcontainer">
249
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
250
250
  <content>
251
251
  <p>Subject to approval in terms of this By-Law, the erection:</p>
252
252
  </content>
253
253
  </hcontainer>
254
- <section eId="sec_1">
254
+ <section eId="att_1__sec_1">
255
255
  <num>1.</num>
256
256
  <heading>Foo</heading>
257
257
  </section>
258
- <section eId="sec_2">
258
+ <section eId="att_1__sec_2">
259
259
  <num>2.</num>
260
260
  <heading>Bar</heading>
261
261
  </section>
@@ -304,16 +304,16 @@ EOS
304
304
  </identification>
305
305
  </meta>
306
306
  <mainBody>
307
- <hcontainer eId="hcontainer_1" name="hcontainer">
307
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
308
308
  <content>
309
309
  <p>Subject to approval in terms of this By-Law, the erection:</p>
310
310
  </content>
311
311
  </hcontainer>
312
- <section eId="sec_1">
312
+ <section eId="att_1__sec_1">
313
313
  <num>1.</num>
314
314
  <heading>Foo</heading>
315
315
  </section>
316
- <section eId="sec_2">
316
+ <section eId="att_1__sec_2">
317
317
  <num>2.</num>
318
318
  <heading>Bar</heading>
319
319
  </section>
@@ -372,19 +372,19 @@ EOS
372
372
  </identification>
373
373
  </meta>
374
374
  <mainBody>
375
- <part eId="part_I">
375
+ <part eId="att_1__part_I">
376
376
  <num>I</num>
377
377
  <heading>Form of authentication statement</heading>
378
- <hcontainer eId="part_I__hcontainer_1" name="hcontainer">
378
+ <hcontainer eId="att_1__part_I__hcontainer_1" name="hcontainer">
379
379
  <content>
380
380
  <p>This printed impression has been carefully compared by me with the bill which was passed by Parliament and found by me to be a true copy of the bill.</p>
381
381
  </content>
382
382
  </hcontainer>
383
383
  </part>
384
- <part eId="part_II">
384
+ <part eId="att_1__part_II">
385
385
  <num>II</num>
386
386
  <heading>Form of statement of the President’s assent.</heading>
387
- <hcontainer eId="part_II__hcontainer_1" name="hcontainer">
387
+ <hcontainer eId="att_1__part_II__hcontainer_1" name="hcontainer">
388
388
  <content>
389
389
  <p>I signify my assent to the bill and a whole bunch of other stuff.</p>
390
390
  </content>
@@ -447,7 +447,7 @@ EOS
447
447
  </identification>
448
448
  </meta>
449
449
  <mainBody>
450
- <hcontainer eId="hcontainer_1" name="hcontainer">
450
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
451
451
  <content>
452
452
  <p>Subject to approval in terms of this By-Law.</p>
453
453
  <p>Schedule another</p>
@@ -499,7 +499,7 @@ EOS
499
499
  </identification>
500
500
  </meta>
501
501
  <mainBody>
502
- <hcontainer eId="hcontainer_1" name="hcontainer">
502
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
503
503
  <content>
504
504
  <p>Subject to approval in terms of this By-Law.</p>
505
505
  </content>
@@ -550,16 +550,16 @@ EOS
550
550
  </identification>
551
551
  </meta>
552
552
  <mainBody>
553
- <hcontainer eId="hcontainer_1" name="hcontainer">
553
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
554
554
  <content>
555
555
  <p>Subject to approval in terms of this By-Law, the erection:</p>
556
556
  </content>
557
557
  </hcontainer>
558
- <section eId="sec_1">
558
+ <section eId="att_1__sec_1">
559
559
  <num>1.</num>
560
560
  <heading>Foo</heading>
561
561
  </section>
562
- <section eId="sec_2">
562
+ <section eId="att_1__sec_2">
563
563
  <num>2.</num>
564
564
  <heading>Bar</heading>
565
565
  </section>
@@ -608,12 +608,12 @@ EOS
608
608
  </identification>
609
609
  </meta>
610
610
  <mainBody>
611
- <hcontainer eId="hcontainer_1" name="hcontainer">
611
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
612
612
  <content>
613
613
  <p>Subject to approval in terms of this By-Law, the erection:</p>
614
614
  </content>
615
615
  </hcontainer>
616
- <section eId="sec_1">
616
+ <section eId="att_1__sec_1">
617
617
  <num>1.</num>
618
618
  <heading>Foo</heading>
619
619
  </section>
@@ -665,16 +665,16 @@ EOS
665
665
  </identification>
666
666
  </meta>
667
667
  <mainBody>
668
- <hcontainer eId="hcontainer_1" name="hcontainer">
668
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
669
669
  <content>
670
670
  <p>Subject to approval in terms of this By-Law, the erection:</p>
671
671
  </content>
672
672
  </hcontainer>
673
- <section eId="sec_1">
673
+ <section eId="att_1__sec_1">
674
674
  <num>1.</num>
675
675
  <heading>Foo</heading>
676
676
  </section>
677
- <section eId="sec_2">
677
+ <section eId="att_1__sec_2">
678
678
  <num>2.</num>
679
679
  <heading>Bar</heading>
680
680
  </section>
@@ -729,11 +729,11 @@ EOS
729
729
  </identification>
730
730
  </meta>
731
731
  <mainBody>
732
- <section eId="sec_1">
732
+ <section eId="att_1__sec_1">
733
733
  <num>1.</num>
734
734
  <heading>Foo</heading>
735
735
  </section>
736
- <section eId="sec_2">
736
+ <section eId="att_1__sec_2">
737
737
  <num>2.</num>
738
738
  <heading>Bar</heading>
739
739
  </section>
@@ -770,7 +770,7 @@ EOS
770
770
  </identification>
771
771
  </meta>
772
772
  <mainBody>
773
- <hcontainer eId="hcontainer_1" name="hcontainer">
773
+ <hcontainer eId="att_2__hcontainer_1" name="hcontainer">
774
774
  <content>
775
775
  <p>Baz</p>
776
776
  <p>Boom</p>
@@ -826,16 +826,16 @@ EOS
826
826
  </identification>
827
827
  </meta>
828
828
  <mainBody>
829
- <hcontainer eId="hcontainer_1" name="hcontainer">
829
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
830
830
  <content>
831
831
  <p>Subject to approval in terms of this By-Law, the erection:</p>
832
832
  </content>
833
833
  </hcontainer>
834
- <section eId="sec_1">
834
+ <section eId="att_1__sec_1">
835
835
  <num>1.</num>
836
836
  <heading>Foo</heading>
837
837
  </section>
838
- <section eId="sec_2">
838
+ <section eId="att_1__sec_2">
839
839
  <num>2.</num>
840
840
  <heading>Bar</heading>
841
841
  </section>
@@ -885,16 +885,16 @@ EOS
885
885
  </identification>
886
886
  </meta>
887
887
  <mainBody>
888
- <hcontainer eId="hcontainer_1" name="hcontainer">
888
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
889
889
  <content>
890
890
  <p>Subject to approval in terms of this By-Law, the erection:</p>
891
891
  </content>
892
892
  </hcontainer>
893
- <section eId="sec_1">
893
+ <section eId="att_1__sec_1">
894
894
  <num>1.</num>
895
895
  <heading>Foo</heading>
896
896
  </section>
897
- <section eId="sec_2">
897
+ <section eId="att_1__sec_2">
898
898
  <num>2.</num>
899
899
  <heading>Bar</heading>
900
900
  </section>
@@ -942,16 +942,16 @@ EOS
942
942
  </identification>
943
943
  </meta>
944
944
  <mainBody>
945
- <hcontainer eId="hcontainer_1" name="hcontainer">
945
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
946
946
  <content>
947
947
  <p>Subject to approval in terms of this By-Law, the erection:</p>
948
948
  </content>
949
949
  </hcontainer>
950
- <section eId="sec_1">
950
+ <section eId="att_1__sec_1">
951
951
  <num>1.</num>
952
952
  <heading>Foo</heading>
953
953
  </section>
954
- <section eId="sec_2">
954
+ <section eId="att_1__sec_2">
955
955
  <num>2.</num>
956
956
  <heading>Bar</heading>
957
957
  </section>
@@ -1001,16 +1001,16 @@ EOS
1001
1001
  </identification>
1002
1002
  </meta>
1003
1003
  <mainBody>
1004
- <hcontainer eId="hcontainer_1" name="hcontainer">
1004
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
1005
1005
  <content>
1006
1006
  <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>
1007
1007
  </content>
1008
1008
  </hcontainer>
1009
- <section eId="sec_1">
1009
+ <section eId="att_1__sec_1">
1010
1010
  <num>1.</num>
1011
1011
  <heading>Foo</heading>
1012
1012
  </section>
1013
- <section eId="sec_2">
1013
+ <section eId="att_1__sec_2">
1014
1014
  <num>2.</num>
1015
1015
  <heading>Bar</heading>
1016
1016
  </section>
@@ -1060,7 +1060,7 @@ EOS
1060
1060
  </identification>
1061
1061
  </meta>
1062
1062
  <mainBody>
1063
- <hcontainer eId="hcontainer_1" name="hcontainer">
1063
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
1064
1064
  <content>
1065
1065
  <p>Subject to approval in terms of this By-Law.</p>
1066
1066
  </content>
@@ -298,10 +298,10 @@ EOS
298
298
  </identification>
299
299
  </meta>
300
300
  <mainBody>
301
- <hcontainer eId="hcontainer_1" name="hcontainer">
301
+ <hcontainer eId="att_1__hcontainer_1" name="hcontainer">
302
302
  <content>
303
303
  <p>Heres a table:</p>
304
- <table eId="hcontainer_1__table_1">
304
+ <table eId="att_1__hcontainer_1__table_1">
305
305
  <tr>
306
306
  <td>
307
307
  <p>r1c1</p>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slaw
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.7.0
4
+ version: 11.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Kempe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-11 00:00:00.000000000 Z
11
+ date: 2021-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
175
  - !ruby/object:Gem::Version
176
176
  version: '0'
177
177
  requirements: []
178
- rubygems_version: 3.0.3
178
+ rubygems_version: 3.1.4
179
179
  signing_key:
180
180
  specification_version: 4
181
181
  summary: A lightweight library for using Akoma Ntoso acts in Ruby.