slaw 7.0.0 → 8.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: fde17ca3304eb910432a89b75fe777e9ce50cf1abed667d2bb7b2d673bc77aa0
4
- data.tar.gz: 7102e2b19079e12bbf89c783aed99a48b9cd645f9dac396b0b68061279e86174
3
+ metadata.gz: c0c018a71314291d2304ba458300e360da8555bfe6df1d4348fcba8bb4501700
4
+ data.tar.gz: 5c68a881a0d52f54b28998fe195d877a068361c3750a254e8f88e3479c24f056
5
5
  SHA512:
6
- metadata.gz: c7740c01a12b46d138051b82de734a67806155f5166c2c0c56a9aab1d7d5fc8e79526260bc4236310cd88215dd742ce3beabb298288c086f5a39111375d825ff
7
- data.tar.gz: 219658ca25c23b52ce5f7ae499728a8e183b488db3f03477cb726d5f88f7ec290faf26a02727c8eb705f21ea85866f64d3e437799b0cafdb53fb3a087fd80144
6
+ metadata.gz: 5538b79f68d5db2289d713a0db9760147bb3baf4a986d63d0a9097fc86af95df6e6b3c8637eeaccd25834b4c79b8cadedf50c107c60833c8fb90382d7559f43f
7
+ data.tar.gz: d9bdcf5780887407f8ab397e765b6df83de5d54e1898a71792f0560a74044d1216e41b30e6166cc86974719fc4007513db82340c927117dec6087b974b176f1b
data/README.md CHANGED
@@ -81,6 +81,11 @@ You can create your own grammar by creating a gem that provides these files and
81
81
 
82
82
  ## Changelog
83
83
 
84
+ ### 8.0.0 (19 Feb 2020)
85
+
86
+ * Obey --id-prefix for group nodes
87
+ * Ensure that schedules prefix their children, for those that require it (parts and chapters)
88
+
84
89
  ### 7.0.0 (31 Jan 2020)
85
90
 
86
91
  * Lists ids are now numbered sequentially, rather than by tree position
@@ -1,13 +1,13 @@
1
1
  module Slaw
2
2
  module Grammars
3
3
  class GroupNode < Treetop::Runtime::SyntaxNode
4
- def to_xml(b, *args)
5
- children.elements.each { |e| e.to_xml(b, *args) }
4
+ def to_xml(b, id_prefix='')
5
+ children.elements.each { |e| e.to_xml(b, id_prefix) }
6
6
  end
7
7
  end
8
8
 
9
9
  class Body < Treetop::Runtime::SyntaxNode
10
- def to_xml(b)
10
+ def to_xml(b, id_prefix='')
11
11
  b.body { |b|
12
12
  children.elements.each_with_index { |e, i| e.to_xml(b, '', i) }
13
13
  }
@@ -137,13 +137,8 @@ module Slaw
137
137
  heading.num
138
138
  end
139
139
 
140
- def to_xml(b, *args)
141
- id = "part-#{num}"
142
-
143
- # include a chapter number in the id if our parent has one
144
- if parent and parent.parent.is_a?(Chapter) and parent.parent.num
145
- id = "chapter-#{parent.parent.num}.#{id}"
146
- end
140
+ def to_xml(b, id_prefix='', *args)
141
+ id = id_prefix + "part-#{num}"
147
142
 
148
143
  b.part(id: id) { |b|
149
144
  heading.to_xml(b)
@@ -172,13 +167,8 @@ module Slaw
172
167
  heading.num
173
168
  end
174
169
 
175
- def to_xml(b, *args)
176
- id = "chapter-#{num}"
177
-
178
- # include a part number in the id if our parent has one
179
- if parent and parent.parent.is_a?(Part) and parent.parent.num
180
- id = "part-#{parent.parent.num}.#{id}"
181
- end
170
+ def to_xml(b, id_prefix='', *args)
171
+ id = id_prefix + "chapter-#{num}"
182
172
 
183
173
  b.chapter(id: id) { |b|
184
174
  heading.to_xml(b)
@@ -148,14 +148,7 @@ module Slaw
148
148
  builder.akomaNtoso("xmlns:xsi"=> "http://www.w3.org/2001/XMLSchema-instance",
149
149
  "xsi:schemaLocation" => "http://www.akomantoso.org/2.0 akomantoso20.xsd",
150
150
  "xmlns" => NS) do |b|
151
- args = [b]
152
-
153
- # should we provide an id prefix?
154
- arity = tree.method('to_xml').arity
155
- arity = arity.abs-1 if arity < 0
156
- args << (fragment_id_prefix || "") if arity > 1
157
-
158
- tree.to_xml(*args)
151
+ tree.to_xml(b, fragment_id_prefix || '')
159
152
  end
160
153
 
161
154
  builder.to_xml(encoding: 'UTF-8')
data/lib/slaw/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Slaw
2
- VERSION = "7.0.0"
2
+ VERSION = "8.0.0"
3
3
  end
@@ -383,19 +383,19 @@ EOS
383
383
  <hcontainer id="schedule1" name="schedule">
384
384
  <heading>Schedule 1</heading>
385
385
  <subheading>Forms</subheading>
386
- <part id="part-I">
386
+ <part id="schedule1.part-I">
387
387
  <num>I</num>
388
388
  <heading>Form of authentication statement</heading>
389
- <paragraph id="part-I.paragraph0">
389
+ <paragraph id="schedule1.part-I.paragraph0">
390
390
  <content>
391
391
  <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>
392
392
  </content>
393
393
  </paragraph>
394
394
  </part>
395
- <part id="part-II">
395
+ <part id="schedule1.part-II">
396
396
  <num>II</num>
397
397
  <heading>Form of statement of the President’s assent.</heading>
398
- <paragraph id="part-II.paragraph0">
398
+ <paragraph id="schedule1.part-II.paragraph0">
399
399
  <content>
400
400
  <p>I signify my assent to the bill and a whole bunch of other stuff.</p>
401
401
  </content>
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: 7.0.0
4
+ version: 8.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: 2020-01-31 00:00:00.000000000 Z
11
+ date: 2020-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake