slaw 9.1.0 → 10.3.1
Sign up to get free protection for your applications and to get access to all the features.
- 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/za/act_table_spec.rb
CHANGED
@@ -44,7 +44,7 @@ describe Slaw::ActGenerator do
|
|
44
44
|
|}
|
45
45
|
EOS
|
46
46
|
|
47
|
-
to_xml(node, "
|
47
|
+
to_xml(node, "prefix__").should == '<table eId="prefix__table_1">
|
48
48
|
<tr>
|
49
49
|
<th>
|
50
50
|
<p>r1c1</p>
|
@@ -78,7 +78,7 @@ EOS
|
|
78
78
|
|}
|
79
79
|
EOS
|
80
80
|
|
81
|
-
to_xml(node, "
|
81
|
+
to_xml(node, "prefix__").should == '<table eId="prefix__table_1">
|
82
82
|
<tr>
|
83
83
|
<th>
|
84
84
|
<p/>
|
@@ -109,7 +109,7 @@ EOS
|
|
109
109
|
|}
|
110
110
|
EOS
|
111
111
|
|
112
|
-
to_xml(node, "
|
112
|
+
to_xml(node, "prefix__").should == '<table eId="prefix__table_1">
|
113
113
|
<tr>
|
114
114
|
<td colspan="2">
|
115
115
|
<p>r1c1</p>
|
@@ -148,7 +148,7 @@ two
|
|
148
148
|
|}
|
149
149
|
EOS
|
150
150
|
|
151
|
-
to_xml(node, "
|
151
|
+
to_xml(node, "prefix__").should == '<table eId="prefix__table_1">
|
152
152
|
<tr>
|
153
153
|
<td>
|
154
154
|
<p>foo<eol/>bar<eol/><eol/>baz</p>
|
@@ -173,7 +173,7 @@ EOS
|
|
173
173
|
|}
|
174
174
|
EOS
|
175
175
|
|
176
|
-
to_xml(node, "
|
176
|
+
to_xml(node, "prefix__").should == '<table eId="prefix__table_1">
|
177
177
|
<tr>
|
178
178
|
<th>
|
179
179
|
<p>foo<eol/>three</p>
|
@@ -195,7 +195,7 @@ EOS
|
|
195
195
|
|}
|
196
196
|
EOS
|
197
197
|
|
198
|
-
to_xml(node, "
|
198
|
+
to_xml(node, "prefix__").should == '<table eId="prefix__table_1">
|
199
199
|
<tr>
|
200
200
|
<td>
|
201
201
|
<p>cell</p>
|
@@ -223,13 +223,13 @@ Heres a table:
|
|
223
223
|
EOS
|
224
224
|
|
225
225
|
xml = to_xml(node)
|
226
|
-
xml.should == '<section
|
226
|
+
xml.should == '<section eId="sec_10">
|
227
227
|
<num>10.</num>
|
228
228
|
<heading>A section title</heading>
|
229
|
-
<
|
229
|
+
<hcontainer eId="sec_10__hcontainer_1" name="hcontainer">
|
230
230
|
<content>
|
231
231
|
<p>Heres a table:</p>
|
232
|
-
<table
|
232
|
+
<table eId="sec_10__hcontainer_1__table_1">
|
233
233
|
<tr>
|
234
234
|
<td>
|
235
235
|
<p>r1c1</p>
|
@@ -248,7 +248,7 @@ EOS
|
|
248
248
|
</tr>
|
249
249
|
</table>
|
250
250
|
</content>
|
251
|
-
</
|
251
|
+
</hcontainer>
|
252
252
|
</section>'
|
253
253
|
end
|
254
254
|
|
@@ -269,12 +269,13 @@ EOS
|
|
269
269
|
|
270
270
|
xml = to_xml(node, "")
|
271
271
|
today = Time.now.strftime('%Y-%m-%d')
|
272
|
-
xml.should == '<
|
273
|
-
<
|
272
|
+
xml.should == '<attachment eId="att_1">
|
273
|
+
<heading>Schedule 1</heading>
|
274
|
+
<doc name="schedule">
|
274
275
|
<meta>
|
275
276
|
<identification source="#slaw">
|
276
277
|
<FRBRWork>
|
277
|
-
<FRBRthis value="/za/act/1980/01
|
278
|
+
<FRBRthis value="/za/act/1980/01/!schedule1"/>
|
278
279
|
<FRBRuri value="/za/act/1980/01"/>
|
279
280
|
<FRBRalias value="Schedule 1"/>
|
280
281
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
@@ -282,14 +283,14 @@ EOS
|
|
282
283
|
<FRBRcountry value="za"/>
|
283
284
|
</FRBRWork>
|
284
285
|
<FRBRExpression>
|
285
|
-
<FRBRthis value="/za/act/1980/01/eng
|
286
|
+
<FRBRthis value="/za/act/1980/01/eng@/!schedule1"/>
|
286
287
|
<FRBRuri value="/za/act/1980/01/eng@"/>
|
287
288
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
288
289
|
<FRBRauthor href="#council"/>
|
289
290
|
<FRBRlanguage language="eng"/>
|
290
291
|
</FRBRExpression>
|
291
292
|
<FRBRManifestation>
|
292
|
-
<FRBRthis value="/za/act/1980/01/eng
|
293
|
+
<FRBRthis value="/za/act/1980/01/eng@/!schedule1"/>
|
293
294
|
<FRBRuri value="/za/act/1980/01/eng@"/>
|
294
295
|
<FRBRdate date="' + today + '" name="Generation"/>
|
295
296
|
<FRBRauthor href="#slaw"/>
|
@@ -297,35 +298,32 @@ EOS
|
|
297
298
|
</identification>
|
298
299
|
</meta>
|
299
300
|
<mainBody>
|
300
|
-
<hcontainer
|
301
|
-
<
|
302
|
-
|
303
|
-
<
|
304
|
-
<
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
</
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
</
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
</table>
|
323
|
-
</content>
|
324
|
-
</paragraph>
|
301
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
302
|
+
<content>
|
303
|
+
<p>Heres a table:</p>
|
304
|
+
<table eId="hcontainer_1__table_1">
|
305
|
+
<tr>
|
306
|
+
<td>
|
307
|
+
<p>r1c1</p>
|
308
|
+
</td>
|
309
|
+
<td>
|
310
|
+
<p>r1c2</p>
|
311
|
+
</td>
|
312
|
+
</tr>
|
313
|
+
<tr>
|
314
|
+
<td>
|
315
|
+
<p>r2c1</p>
|
316
|
+
</td>
|
317
|
+
<td>
|
318
|
+
<p>r2c2</p>
|
319
|
+
</td>
|
320
|
+
</tr>
|
321
|
+
</table>
|
322
|
+
</content>
|
325
323
|
</hcontainer>
|
326
324
|
</mainBody>
|
327
325
|
</doc>
|
328
|
-
</
|
326
|
+
</attachment>'
|
329
327
|
end
|
330
328
|
|
331
329
|
it 'should ignore an escaped table' do
|
@@ -336,14 +334,14 @@ EOS
|
|
336
334
|
|}
|
337
335
|
EOS
|
338
336
|
|
339
|
-
to_xml(node).should == '<
|
337
|
+
to_xml(node).should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
340
338
|
<content>
|
341
339
|
<p>{|</p>
|
342
340
|
<p>| r1c1</p>
|
343
341
|
<p>| r1c2</p>
|
344
342
|
<p>|}</p>
|
345
343
|
</content>
|
346
|
-
</
|
344
|
+
</hcontainer>'
|
347
345
|
end
|
348
346
|
|
349
347
|
it 'should allow a table as part of a subsection' do
|
@@ -353,10 +351,10 @@ EOS
|
|
353
351
|
|}
|
354
352
|
EOS
|
355
353
|
|
356
|
-
to_xml(node, '', 0).should == '<subsection
|
354
|
+
to_xml(node, '', 0).should == '<subsection eId="subsec_1">
|
357
355
|
<num>(1)</num>
|
358
356
|
<content>
|
359
|
-
<table
|
357
|
+
<table eId="subsec_1__table_1">
|
360
358
|
<tr>
|
361
359
|
<td>
|
362
360
|
<p>foo</p>
|
@@ -376,7 +374,7 @@ EOS
|
|
376
374
|
|}
|
377
375
|
EOS
|
378
376
|
|
379
|
-
to_xml(node, '', 0).should == '<table
|
377
|
+
to_xml(node, '', 0).should == '<table eId="table_1">
|
380
378
|
<tr>
|
381
379
|
<td>
|
382
380
|
<p>a <ref href="/a/b">link</ref> in a table</p>
|
@@ -396,7 +394,7 @@ EOS
|
|
396
394
|
|}
|
397
395
|
EOS
|
398
396
|
|
399
|
-
to_xml(node, '', 0).should == '<table
|
397
|
+
to_xml(node, '', 0).should == '<table eId="table_1">
|
400
398
|
<tr>
|
401
399
|
<td>
|
402
400
|
<p>a > b</p>
|
data/spec/za/postprocess_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe Slaw::Grammars::ZA::Postprocess do
|
|
12
12
|
context 'schedule_aliases' do
|
13
13
|
it 'should include all text in schedule aliases' do
|
14
14
|
xml = '
|
15
|
-
<akomaNtoso xmlns
|
15
|
+
<akomaNtoso xmlns="http://docs.oasis-open.org/legaldocml/ns/akn/3.0">
|
16
16
|
<components>
|
17
17
|
<component id="component-firstschedule">
|
18
18
|
<doc name="firstschedule">
|
@@ -64,7 +64,7 @@ describe Slaw::Grammars::ZA::Postprocess do
|
|
64
64
|
|
65
65
|
it 'should have a decent alias when there is an empty heading' do
|
66
66
|
xml = '
|
67
|
-
<akomaNtoso xmlns
|
67
|
+
<akomaNtoso xmlns="http://docs.oasis-open.org/legaldocml/ns/akn/3.0">
|
68
68
|
<components>
|
69
69
|
<component id="component-firstschedule">
|
70
70
|
<doc name="firstschedule">
|
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:
|
4
|
+
version: 10.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Kempe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -150,10 +150,12 @@ files:
|
|
150
150
|
- lib/slaw/parse/error.rb
|
151
151
|
- lib/slaw/parse/grammar_helpers.rb
|
152
152
|
- lib/slaw/schemas/akomantoso20.xsd
|
153
|
+
- lib/slaw/schemas/akomantoso30.xsd
|
153
154
|
- lib/slaw/schemas/xml.xsd
|
154
155
|
- lib/slaw/version.rb
|
155
156
|
- lib/slaw/xml_support.rb
|
156
157
|
- slaw.gemspec
|
158
|
+
- spec/counters_spec.rb
|
157
159
|
- spec/extract/extractor_spec.rb
|
158
160
|
- spec/fixtures/community-fire-safety.xml
|
159
161
|
- spec/generator_spec.rb
|
@@ -191,6 +193,7 @@ signing_key:
|
|
191
193
|
specification_version: 4
|
192
194
|
summary: A lightweight library for using Akoma Ntoso acts in Ruby.
|
193
195
|
test_files:
|
196
|
+
- spec/counters_spec.rb
|
194
197
|
- spec/extract/extractor_spec.rb
|
195
198
|
- spec/fixtures/community-fire-safety.xml
|
196
199
|
- spec/generator_spec.rb
|