slaw 5.0.0 → 6.0.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 +6 -0
- data/lib/slaw/grammars/za/act.treetop +2 -0
- data/lib/slaw/grammars/za/postprocess.rb +28 -0
- data/lib/slaw/parse/blocklists.rb +5 -0
- data/lib/slaw/parse/builder.rb +1 -16
- data/lib/slaw/parse/grammar_helpers.rb +8 -0
- data/lib/slaw/version.rb +1 -1
- data/spec/parse/blocklists_spec.rb +714 -0
- data/spec/parse/builder_spec.rb +0 -708
- data/spec/za/postprocess_spec.rb +117 -0
- metadata +7 -2
@@ -0,0 +1,117 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'slaw'
|
4
|
+
require 'slaw/grammars/za/postprocess'
|
5
|
+
|
6
|
+
describe Slaw::Grammars::ZA::Postprocess do
|
7
|
+
subject {
|
8
|
+
class Subject
|
9
|
+
include Slaw::Grammars::ZA::Postprocess
|
10
|
+
end.new
|
11
|
+
}
|
12
|
+
context 'schedule_aliases' do
|
13
|
+
it 'should include all text in schedule aliases' do
|
14
|
+
xml = '
|
15
|
+
<akomaNtoso xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.akomantoso.org/2.0" xsi:schemaLocation="http://www.akomantoso.org/2.0 akomantoso20.xsd">
|
16
|
+
<components>
|
17
|
+
<component id="component-firstschedule">
|
18
|
+
<doc name="firstschedule">
|
19
|
+
<meta>
|
20
|
+
<identification source="#slaw">
|
21
|
+
<FRBRWork>
|
22
|
+
<FRBRthis value="/za/act/1980/01/firstschedule"/>
|
23
|
+
<FRBRuri value="/za/act/1980/01"/>
|
24
|
+
<FRBRalias value="First Schedule"/>
|
25
|
+
<FRBRdate date="1980-01-01" name="Generation"/>
|
26
|
+
<FRBRauthor href="#council"/>
|
27
|
+
<FRBRcountry value="za"/>
|
28
|
+
</FRBRWork>
|
29
|
+
<FRBRExpression>
|
30
|
+
<FRBRthis value="/za/act/1980/01/eng@/firstschedule"/>
|
31
|
+
<FRBRuri value="/za/act/1980/01/eng@"/>
|
32
|
+
<FRBRdate date="1980-01-01" name="Generation"/>
|
33
|
+
<FRBRauthor href="#council"/>
|
34
|
+
<FRBRlanguage language="eng"/>
|
35
|
+
</FRBRExpression>
|
36
|
+
<FRBRManifestation>
|
37
|
+
<FRBRthis value="/za/act/1980/01/eng@/firstschedule"/>
|
38
|
+
<FRBRuri value="/za/act/1980/01/eng@"/>
|
39
|
+
<FRBRdate date="2019-01-01" name="Generation"/>
|
40
|
+
<FRBRauthor href="#slaw"/>
|
41
|
+
</FRBRManifestation>
|
42
|
+
</identification>
|
43
|
+
</meta>
|
44
|
+
<mainBody>
|
45
|
+
<hcontainer id="firstschedule" name="schedule">
|
46
|
+
<heading>First Schedule <remark status="editorial">[remark]</remark></heading>
|
47
|
+
<subheading>Subheading <remark status="editorial">[another]</remark></subheading>
|
48
|
+
<paragraph id="firstschedule.paragraph0">
|
49
|
+
<content>
|
50
|
+
<p>Subject to approval in terms of this By-Law.</p>
|
51
|
+
</content>
|
52
|
+
</paragraph>
|
53
|
+
</hcontainer>
|
54
|
+
</mainBody>
|
55
|
+
</doc>
|
56
|
+
</component>
|
57
|
+
</components>
|
58
|
+
</akomaNtoso>'
|
59
|
+
doc = xml2doc(xml)
|
60
|
+
subject.schedule_aliases(doc)
|
61
|
+
|
62
|
+
doc.xpath('//xmlns:doc/xmlns:meta//xmlns:FRBRWork/xmlns:FRBRalias')[0]['value'].should == 'First Schedule [remark]'
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'should have a decent alias when there is an empty heading' do
|
66
|
+
xml = '
|
67
|
+
<akomaNtoso xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.akomantoso.org/2.0" xsi:schemaLocation="http://www.akomantoso.org/2.0 akomantoso20.xsd">
|
68
|
+
<components>
|
69
|
+
<component id="component-firstschedule">
|
70
|
+
<doc name="firstschedule">
|
71
|
+
<meta>
|
72
|
+
<identification source="#slaw">
|
73
|
+
<FRBRWork>
|
74
|
+
<FRBRthis value="/za/act/1980/01/firstschedule"/>
|
75
|
+
<FRBRuri value="/za/act/1980/01"/>
|
76
|
+
<FRBRalias value="Schedule"/>
|
77
|
+
<FRBRdate date="1980-01-01" name="Generation"/>
|
78
|
+
<FRBRauthor href="#council"/>
|
79
|
+
<FRBRcountry value="za"/>
|
80
|
+
</FRBRWork>
|
81
|
+
<FRBRExpression>
|
82
|
+
<FRBRthis value="/za/act/1980/01/eng@/firstschedule"/>
|
83
|
+
<FRBRuri value="/za/act/1980/01/eng@"/>
|
84
|
+
<FRBRdate date="1980-01-01" name="Generation"/>
|
85
|
+
<FRBRauthor href="#council"/>
|
86
|
+
<FRBRlanguage language="eng"/>
|
87
|
+
</FRBRExpression>
|
88
|
+
<FRBRManifestation>
|
89
|
+
<FRBRthis value="/za/act/1980/01/eng@/firstschedule"/>
|
90
|
+
<FRBRuri value="/za/act/1980/01/eng@"/>
|
91
|
+
<FRBRdate date="2019-01-01" name="Generation"/>
|
92
|
+
<FRBRauthor href="#slaw"/>
|
93
|
+
</FRBRManifestation>
|
94
|
+
</identification>
|
95
|
+
</meta>
|
96
|
+
<mainBody>
|
97
|
+
<hcontainer id="firstschedule" name="schedule">
|
98
|
+
<heading/>
|
99
|
+
<subheading>Subheading <remark status="editorial">[another]</remark></subheading>
|
100
|
+
<paragraph id="firstschedule.paragraph0">
|
101
|
+
<content>
|
102
|
+
<p>Subject to approval in terms of this By-Law.</p>
|
103
|
+
</content>
|
104
|
+
</paragraph>
|
105
|
+
</hcontainer>
|
106
|
+
</mainBody>
|
107
|
+
</doc>
|
108
|
+
</component>
|
109
|
+
</components>
|
110
|
+
</akomaNtoso>'
|
111
|
+
doc = xml2doc(xml)
|
112
|
+
subject.schedule_aliases(doc)
|
113
|
+
|
114
|
+
doc.xpath('//xmlns:doc/xmlns:meta//xmlns:FRBRWork/xmlns:FRBRalias')[0]['value'].should == 'Schedule'
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
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: 6.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: 2019-
|
11
|
+
date: 2019-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -140,6 +140,7 @@ files:
|
|
140
140
|
- lib/slaw/grammars/za/act.treetop
|
141
141
|
- lib/slaw/grammars/za/act_nodes.rb
|
142
142
|
- lib/slaw/grammars/za/act_text.xsl
|
143
|
+
- lib/slaw/grammars/za/postprocess.rb
|
143
144
|
- lib/slaw/logging.rb
|
144
145
|
- lib/slaw/namespace.rb
|
145
146
|
- lib/slaw/parse/blocklists.rb
|
@@ -155,6 +156,7 @@ files:
|
|
155
156
|
- spec/extract/extractor_spec.rb
|
156
157
|
- spec/fixtures/community-fire-safety.xml
|
157
158
|
- spec/generator_spec.rb
|
159
|
+
- spec/parse/blocklists_spec.rb
|
158
160
|
- spec/parse/builder_spec.rb
|
159
161
|
- spec/parse/cleanser_spec.rb
|
160
162
|
- spec/spec_helper.rb
|
@@ -163,6 +165,7 @@ files:
|
|
163
165
|
- spec/za/act_inline_spec.rb
|
164
166
|
- spec/za/act_schedules_spec.rb
|
165
167
|
- spec/za/act_table_spec.rb
|
168
|
+
- spec/za/postprocess_spec.rb
|
166
169
|
homepage: https://github.com/longhotsummer/slaw
|
167
170
|
licenses:
|
168
171
|
- MIT
|
@@ -190,6 +193,7 @@ test_files:
|
|
190
193
|
- spec/extract/extractor_spec.rb
|
191
194
|
- spec/fixtures/community-fire-safety.xml
|
192
195
|
- spec/generator_spec.rb
|
196
|
+
- spec/parse/blocklists_spec.rb
|
193
197
|
- spec/parse/builder_spec.rb
|
194
198
|
- spec/parse/cleanser_spec.rb
|
195
199
|
- spec/spec_helper.rb
|
@@ -198,3 +202,4 @@ test_files:
|
|
198
202
|
- spec/za/act_inline_spec.rb
|
199
203
|
- spec/za/act_schedules_spec.rb
|
200
204
|
- spec/za/act_table_spec.rb
|
205
|
+
- spec/za/postprocess_spec.rb
|