slaw 9.1.0 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/slaw/grammars/za/act.treetop +1 -1
- data/lib/slaw/grammars/za/act_nodes.rb +7 -2
- data/lib/slaw/version.rb +1 -1
- data/spec/za/act_block_spec.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0654597e1ede427474f5b9b4f703070c4d23fc34fdbf10700ae72485f8372a21'
|
4
|
+
data.tar.gz: d19cd4ebfe1e256f5366addde1723817547075e6468ab31b0d65c8d492f5c6d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a778d4798462049e8fbb123c30d72d2e43c4f7f8344e0bc31590d2c5873daa3675979cafdb3fc14be1327f3ed262c19e6220b2e2ed40e825cc68fe353bb57614
|
7
|
+
data.tar.gz: 585ea851576bca2c5059a3693067066f9f06a9b1ef67761534b707ddcd51f447cc8953f7f7b33842486cb77e442b3f7d60dd63e763306d269db14f1c1b17fcaa
|
data/README.md
CHANGED
@@ -86,6 +86,10 @@ You can create your own grammar by creating a gem that provides these files and
|
|
86
86
|
|
87
87
|
## Changelog
|
88
88
|
|
89
|
+
### 9.2.0 (10 June 2020)
|
90
|
+
|
91
|
+
* Subpart numbers are optional
|
92
|
+
|
89
93
|
### 9.1.0 (15 April 2020)
|
90
94
|
|
91
95
|
* Subsections can have numbers such as 1.1A and 1.1bis
|
@@ -168,6 +168,11 @@ module Slaw
|
|
168
168
|
end
|
169
169
|
|
170
170
|
def to_xml(b, id_prefix='', *args)
|
171
|
+
num = self.num
|
172
|
+
if num.empty?
|
173
|
+
num = Slaw::Grammars::Counters.counters[id_prefix]['subpart'] += 1
|
174
|
+
end
|
175
|
+
|
171
176
|
id = id_prefix + "subpart-#{num}"
|
172
177
|
|
173
178
|
b.subpart(id: id) { |b|
|
@@ -179,11 +184,11 @@ module Slaw
|
|
179
184
|
|
180
185
|
class SubpartHeading < Treetop::Runtime::SyntaxNode
|
181
186
|
def num
|
182
|
-
subpart_heading_prefix.
|
187
|
+
subpart_heading_prefix.num.text_value.strip()
|
183
188
|
end
|
184
189
|
|
185
190
|
def to_xml(b)
|
186
|
-
b.num(num)
|
191
|
+
b.num(num) unless self.num.empty?
|
187
192
|
if heading.respond_to? :inline_items
|
188
193
|
b.heading { |b|
|
189
194
|
heading.inline_items.to_xml(b)
|
data/lib/slaw/version.rb
CHANGED
data/spec/za/act_block_spec.rb
CHANGED
@@ -828,6 +828,27 @@ EOS
|
|
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 id="subpart-0">
|
840
|
+
<heading>Heading - with a dash</heading>
|
841
|
+
<section id="section-1">
|
842
|
+
<num>1.</num>
|
843
|
+
<heading>Section</heading>
|
844
|
+
<paragraph id="section-1.paragraph0">
|
845
|
+
<content>
|
846
|
+
<p>Hello there</p>
|
847
|
+
</content>
|
848
|
+
</paragraph>
|
849
|
+
</section>
|
850
|
+
</subpart>'
|
851
|
+
end
|
831
852
|
end
|
832
853
|
|
833
854
|
#-------------------------------------------------------------------------------
|
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: 9.
|
4
|
+
version: 9.2.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-
|
11
|
+
date: 2020-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|