slaw 0.8.1 → 0.8.2

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
  SHA1:
3
- metadata.gz: ab4d37da9ebc5aadc6da5bb3b14a9d786541b187
4
- data.tar.gz: 3fdf535965572c529ceaa60bcfa8e95ff3ba76bd
3
+ metadata.gz: ebc9c571ef0b0a1ef1bff4a209bac844df2d22a3
4
+ data.tar.gz: 6052a4641c800a8510ec02aeddc6653cb482a349
5
5
  SHA512:
6
- metadata.gz: 0b08087358bb70d8b17c276fed6501d5ddc67fe84114d5b066409fcd9825a81312dfbac68ec4add9f4481e9e3c44864beebf58a20cdb455d6134fb7751aab07d
7
- data.tar.gz: d8a2983bb30778dbfee1d07822552d7efa9a0207ed30e2f1b10f7f52de671d3684dbc1a7adc82da9229e0f05f52300c5f1e151612459e40efe8df094d0c8eff7
6
+ metadata.gz: d57425bab077cc85397b0c05bd2f68d187e64278f4758006d9679aa00ef002a519071a960e3703b1bd608b2ab4bccac544e3d7254869ea7f47840d4420e066d0
7
+ data.tar.gz: fe7372c0aee508e481d5c2665747030a1b26e11d00e912311424d79c6cf30438db81dbe4577ab14aae6efb99aaa8f33dc30d605c1691a9c48b632354c63d0817
data/README.md CHANGED
@@ -216,6 +216,10 @@ Akoma Ntoso `component` elements at the end of the XML document, with a name of
216
216
 
217
217
  ## Changelog
218
218
 
219
+ ### 0.8.2
220
+
221
+ * Schedules can be empty (#10)
222
+
219
223
  ### 0.8.1
220
224
 
221
225
  * Schedules can have both a title and a heading, permitting schedules titled "First Schedule" and not just "Schedule 1"
data/lib/slaw/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Slaw
2
- VERSION = "0.8.1"
2
+ VERSION = "0.8.2"
3
3
  end
@@ -66,7 +66,7 @@ module Slaw
66
66
 
67
67
  rule schedule
68
68
  schedule_title
69
- body
69
+ body:body?
70
70
  <Schedule>
71
71
  end
72
72
 
@@ -136,7 +136,7 @@ module Slaw
136
136
  end
137
137
 
138
138
  rule schedule_title
139
- space? schedule_title_prefix space? "\""? num:alphanums? "\""? [ \t:-]* title:(content)?
139
+ space? schedule_title_prefix space? "\""? num:alphanums? "\""? [ \t:.-]* title:(content)?
140
140
  heading:(newline space? content)?
141
141
  eol
142
142
  end
@@ -474,7 +474,7 @@ module Slaw
474
474
  # just use article because we don't use it anywhere else.
475
475
  b.article(id: id) { |b|
476
476
  b.heading(heading) if heading
477
- body.children.elements.each { |e| e.to_xml(b) }
477
+ body.children.elements.each { |e| e.to_xml(b) } if body.is_a? Body
478
478
  }
479
479
  }
480
480
  }
data/spec/za/act_spec.rb CHANGED
@@ -31,7 +31,7 @@ describe Slaw::ActGenerator do
31
31
  # General body
32
32
 
33
33
  describe 'body' do
34
- it 'should handle general content before chapters' do
34
+ it 'should handle general content before sections' do
35
35
  node = parse :body, <<EOS
36
36
  Some content before the section
37
37
 
@@ -56,7 +56,7 @@ EOS
56
56
  </body>'
57
57
  end
58
58
 
59
- it 'should handle blocklists before chapters' do
59
+ it 'should handle blocklists before sections' do
60
60
  node = parse :body, <<EOS
61
61
  Some content before the section
62
62
 
@@ -1235,6 +1235,66 @@ EOS
1235
1235
  Schedule 1 - First Schedule
1236
1236
  Schedule Heading
1237
1237
 
1238
+ Subject to approval in terms of this By-Law, the erection:
1239
+ 1. Foo
1240
+ 2. Bar
1241
+ EOS
1242
+ s = to_xml(node)
1243
+ today = Time.now.strftime('%Y-%m-%d')
1244
+ s.should == '<component id="component-schedule1">
1245
+ <doc name="schedule1">
1246
+ <meta>
1247
+ <identification source="#slaw">
1248
+ <FRBRWork>
1249
+ <FRBRthis value="/za/act/1980/01/schedule1"/>
1250
+ <FRBRuri value="/za/act/1980/01"/>
1251
+ <FRBRalias value="First Schedule"/>
1252
+ <FRBRdate date="1980-01-01" name="Generation"/>
1253
+ <FRBRauthor href="#council"/>
1254
+ <FRBRcountry value="za"/>
1255
+ </FRBRWork>
1256
+ <FRBRExpression>
1257
+ <FRBRthis value="/za/act/1980/01/eng@/schedule1"/>
1258
+ <FRBRuri value="/za/act/1980/01/eng@"/>
1259
+ <FRBRdate date="1980-01-01" name="Generation"/>
1260
+ <FRBRauthor href="#council"/>
1261
+ <FRBRlanguage language="eng"/>
1262
+ </FRBRExpression>
1263
+ <FRBRManifestation>
1264
+ <FRBRthis value="/za/act/1980/01/eng@/schedule1"/>
1265
+ <FRBRuri value="/za/act/1980/01/eng@"/>
1266
+ <FRBRdate date="' + today + '" name="Generation"/>
1267
+ <FRBRauthor href="#slaw"/>
1268
+ </FRBRManifestation>
1269
+ </identification>
1270
+ </meta>
1271
+ <mainBody>
1272
+ <article id="schedule1">
1273
+ <heading>Schedule Heading</heading>
1274
+ <paragraph id="paragraph-0">
1275
+ <content>
1276
+ <p>Subject to approval in terms of this By-Law, the erection:</p>
1277
+ </content>
1278
+ </paragraph>
1279
+ <section id="section-1">
1280
+ <num>1.</num>
1281
+ <heading>Foo</heading>
1282
+ </section>
1283
+ <section id="section-2">
1284
+ <num>2.</num>
1285
+ <heading>Bar</heading>
1286
+ </section>
1287
+ </article>
1288
+ </mainBody>
1289
+ </doc>
1290
+ </component>'
1291
+ end
1292
+
1293
+ it 'should handle a schedule with dot in the number' do
1294
+ node = parse :schedules, <<EOS
1295
+ Schedule 1. First Schedule
1296
+ Schedule Heading
1297
+
1238
1298
  Subject to approval in terms of this By-Law, the erection:
1239
1299
  1. Foo
1240
1300
  2. Bar
@@ -1484,6 +1544,15 @@ EOS
1484
1544
  EOS
1485
1545
  .strip
1486
1546
  end
1547
+
1548
+ it 'should not get confused by schedule headings in TOC' do
1549
+ parse :schedules_container, <<EOS
1550
+ Schedule 1. Summoning and procedure of Joint Sittings of Senate and House of Assembly.
1551
+ Schedule 2. Oaths.
1552
+ Schedule 3. Matters which shall continue to be regulated by Swazi Law and Custom.
1553
+ Schedule 4. Specially entrenched provisions and entrenched provisions.
1554
+ EOS
1555
+ end
1487
1556
  end
1488
1557
 
1489
1558
  #-------------------------------------------------------------------------------
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.8.1
4
+ version: 0.8.2
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-09-17 00:00:00.000000000 Z
11
+ date: 2015-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler