slaw 0.6.7 → 0.6.8

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3ffdf08fe85d90cfacaa3c1f054cd907a19b257a
4
- data.tar.gz: b0b1f5870e4c6e55b3a9e08d979386be93bf6ebd
3
+ metadata.gz: 8eeb58782b2816f1d5a79ff2ca9c58a01b31ae98
4
+ data.tar.gz: 263785f7925b2f7634b32823e421748e75bc7c71
5
5
  SHA512:
6
- metadata.gz: d2f4e281a3f03af67164b34c932956a53f5c63baf9befe1acce7b739b5d4e2d30e2aea588a8c55f4720c66281db3c6a00695c9007a5e15b6e5746f87c71f5dd2
7
- data.tar.gz: f47c88f70b3a7c4ce16baa09c97d3e7812665b2ecf8bc570b9b782028257a1d3eebca65d5366aeb03b41ba33b5d2e34d2010d0570a4075a343a4758fe5c067c3
6
+ metadata.gz: 6faaf2748a1b641f8e7f375d08ef070a36d1e3a1d1c25e3ecda4af0e18e5d7f488f831bf3859857f95c95725605c4d9127bfb7ff19c5e394dfde002dc309bd7a
7
+ data.tar.gz: fd534bb5d9b6d8fee1d004c30c0657df1ca2ab6625a938c0a1ad6aad03c22bd399c9b2e3dbb53cddbd06be9a834990b18f050bc71a2393d16117d88cb44928d2
@@ -141,10 +141,16 @@ module Slaw
141
141
  prev_format
142
142
  when /^\([ivx]+/
143
143
  NumberingFormat.i
144
- when /^\([a-z][a-z]/
144
+ when /^\([IVX]+/
145
+ NumberingFormat.I
146
+ when /^\([a-z]{2}/
145
147
  NumberingFormat.aa
146
- when /^\([a-z]+/i
148
+ when /^\([A-Z]{2}/
149
+ NumberingFormat.AA
150
+ when /^\([a-z]+/
147
151
  NumberingFormat.a
152
+ when /^\([A-Z]+/
153
+ NumberingFormat.A
148
154
  when /^\d+(\.\d+)+$/
149
155
  NumberingFormat.new(:'i.i', item.num.count('.'))
150
156
  else
@@ -175,13 +181,19 @@ module Slaw
175
181
  end
176
182
 
177
183
  @@a = NumberingFormat.new(:a, 0)
178
- @@i = NumberingFormat.new(:i, 1)
179
- @@aa = NumberingFormat.new(:aa, 2)
180
- @@unknown = NumberingFormat.new(:unknown, 3)
184
+ @@A = NumberingFormat.new(:a, 1)
185
+ @@i = NumberingFormat.new(:i, 2)
186
+ @@I = NumberingFormat.new(:I, 3)
187
+ @@aa = NumberingFormat.new(:aa, 4)
188
+ @@AA = NumberingFormat.new(:AA, 5)
189
+ @@unknown = NumberingFormat.new(:unknown, 9)
181
190
 
182
191
  def self.a; @@a; end
192
+ def self.A; @@A; end
183
193
  def self.i; @@i; end
194
+ def self.I; @@I; end
184
195
  def self.aa; @@aa; end
196
+ def self.AA; @@AA; end
185
197
  def self.unknown; @@unknown; end
186
198
  end
187
199
  end
data/lib/slaw/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Slaw
2
- VERSION = "0.6.7"
2
+ VERSION = "0.6.8"
3
3
  end
@@ -88,8 +88,6 @@ module Slaw
88
88
 
89
89
  rule section_title_content
90
90
  space !numbered_statement_prefix content eol
91
- # if a section title ends in a non-character or it's really long, it's probably section content
92
- !{ |s| s[2].text_value[-1] =~ /[^a-zA-z]/ or s[2].text_value.length > 100 }
93
91
  end
94
92
 
95
93
  rule schedule_heading
@@ -22,11 +22,6 @@ module Slaw
22
22
  b.meta { |b|
23
23
  write_identification(b)
24
24
 
25
- b.publication(date: '1980-01-01',
26
- name: 'Publication Name',
27
- number: 'XXXX',
28
- showAs: 'Publication Name')
29
-
30
25
  b.references(source: "#this") {
31
26
  b.TLCOrganization(id: 'slaw', href: 'https://github.com/longhotsummer/slaw', showAs: "Slaw")
32
27
  b.TLCOrganization(id: 'council', href: '/ontology/organization/za/council', showAs: "Council")
@@ -300,6 +300,98 @@ XML
300
300
  )
301
301
  end
302
302
 
303
+ # -------------------------------------------------------------------------
304
+ it 'should handle (I) correctly' do
305
+ doc = xml2doc(subsection(<<XML
306
+ <blockList id="section-28.3.list2">
307
+ <item id="section-28.3.list2.g">
308
+ <num>(g)</num>
309
+ <p>all memorial work up to 150 mm in thickness must be securely attached to the base;</p>
310
+ </item>
311
+ <item id="section-28.3.list2.h">
312
+ <num>(h)</num>
313
+ <p>all the components of memorial work must be completed before being brought into a cemetery;</p>
314
+ </item>
315
+ <item id="section-28.3.list2.i">
316
+ <num>(i)</num>
317
+ <p>item i</p>
318
+ </item>
319
+ <item id="section-28.3.list2.I">
320
+ <num>(I)</num>
321
+ <p>a subitem</p>
322
+ </item>
323
+ <item id="section-28.3.list2.II">
324
+ <num>(II)</num>
325
+ <p>another subitem</p>
326
+ </item>
327
+ <item id="section-28.3.list2.j">
328
+ <num>(j)</num>
329
+ <p>in all cases where memorial work rests on a base -</p>
330
+ </item>
331
+ <item id="section-28.3.list2.i">
332
+ <num>(i)</num>
333
+ <p>such memorial work must have a foundation;</p>
334
+ </item>
335
+ <item id="section-28.3.list2.ii">
336
+ <num>(ii)</num>
337
+ <p>such memorial work must be set with cement mortar;</p>
338
+ </item>
339
+ <item id="section-28.3.list2.iii">
340
+ <num>(iii)</num>
341
+ <p>the bottom base of a single memorial work must not be less than 900mm long 220 mm wide x 250 mm thick and that of a double memorial work not less than 2 286 mm long x 200 mm wide x 250 mm thick; and</p>
342
+ </item>
343
+ </blockList>
344
+ XML
345
+ ))
346
+
347
+ subject.nest_blocklists(doc)
348
+ doc.to_s.should == subsection(<<XML
349
+ <blockList id="section-28.3.list2">
350
+ <item id="section-28.3.list2.g">
351
+ <num>(g)</num>
352
+ <p>all memorial work up to 150 mm in thickness must be securely attached to the base;</p>
353
+ </item>
354
+ <item id="section-28.3.list2.h">
355
+ <num>(h)</num>
356
+ <p>all the components of memorial work must be completed before being brought into a cemetery;</p>
357
+ </item>
358
+ <item id="section-28.3.list2.i">
359
+ <num>(i)</num>
360
+ <blockList id="section-28.3.list2.i.list0">
361
+ <listIntroduction>item i</listIntroduction>
362
+ <item id="section-28.3.list2.i.list0.I">
363
+ <num>(I)</num>
364
+ <p>a subitem</p>
365
+ </item>
366
+ <item id="section-28.3.list2.i.list0.II">
367
+ <num>(II)</num>
368
+ <p>another subitem</p>
369
+ </item>
370
+ </blockList>
371
+ </item>
372
+ <item id="section-28.3.list2.j">
373
+ <num>(j)</num>
374
+ <blockList id="section-28.3.list2.j.list1">
375
+ <listIntroduction>in all cases where memorial work rests on a base -</listIntroduction>
376
+ <item id="section-28.3.list2.j.list1.i">
377
+ <num>(i)</num>
378
+ <p>such memorial work must have a foundation;</p>
379
+ </item>
380
+ <item id="section-28.3.list2.j.list1.ii">
381
+ <num>(ii)</num>
382
+ <p>such memorial work must be set with cement mortar;</p>
383
+ </item>
384
+ <item id="section-28.3.list2.j.list1.iii">
385
+ <num>(iii)</num>
386
+ <p>the bottom base of a single memorial work must not be less than 900mm long 220 mm wide x 250 mm thick and that of a double memorial work not less than 2 286 mm long x 200 mm wide x 250 mm thick; and</p>
387
+ </item>
388
+ </blockList>
389
+ </item>
390
+ </blockList>
391
+ XML
392
+ )
393
+ end
394
+
303
395
  # -------------------------------------------------------------------------
304
396
 
305
397
  it 'should handle deeply nested lists' do
data/spec/za/act_spec.rb CHANGED
@@ -505,23 +505,6 @@ EOS
505
505
  section.section_title.num.should == "2"
506
506
  end
507
507
 
508
- it 'should handle sections without titles' do
509
- subject.parser.options = {section_number_after_title: false}
510
- node = parse :act, <<EOS
511
- 1. No owner or occupier of any shop or business premises or vacant land, blah blah
512
- 2. Notwithstanding the provision of any other By-law or legislation no person shall—
513
- EOS
514
-
515
- section = node.elements[1].elements[0].elements[1].elements[0].elements[1].elements[0]
516
- section.section_title.title.should == "No owner or occupier of any shop or business premises or vacant land, blah blah"
517
- section.section_title.num.should == "1"
518
-
519
- section = node.elements[1].elements[0].elements[1].elements[0].elements[1].elements[1]
520
- section.section_title.title.should == ""
521
- section.section_title.num.should == "2"
522
- section.subsections.elements[0].statement.clauses.text_value.should == "Notwithstanding the provision of any other By-law or legislation no person shall—"
523
- end
524
-
525
508
  it 'should handle sections without titles and with subsections' do
526
509
  subject.parser.options = {section_number_after_title: false}
527
510
  node = parse :act, <<EOS
@@ -535,19 +518,6 @@ EOS
535
518
  section.subsections.elements[0].statement.num.should == "(1)"
536
519
  section.subsections.elements[0].statement.content.text_value.should == "Transporters must remove medical waste."
537
520
  end
538
-
539
- it 'should realise complex section titles are actually section content' do
540
- subject.parser.options = {section_number_after_title: false}
541
- node = parse :act, <<EOS
542
- 10. The owner of any premises which is let or sublet to more than one tenant, shall maintain at all times in a clean and sanitary condition every part of such premises as may be used in common by more than one tenant.
543
- 11. No person shall keep, cause or suffer to be kept any factory or trade premises so as to cause or give rise to smells or effluvia that constitute a health nuisance.
544
- EOS
545
-
546
- section = node.elements[1].elements[0].elements[1].elements[0].elements[1].elements[0]
547
- section.section_title.title.should == ""
548
- section.section_title.num.should == "10"
549
- section.subsections.elements[0].statement.clauses.text_value.should == "The owner of any premises which is let or sublet to more than one tenant, shall maintain at all times in a clean and sanitary condition every part of such premises as may be used in common by more than one tenant."
550
- end
551
521
  end
552
522
 
553
523
  #-------------------------------------------------------------------------------
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: 0.6.7
4
+ version: 0.6.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greg Kempe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-19 00:00:00.000000000 Z
11
+ date: 2015-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler