slaw 0.6.11 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/slaw/version.rb +1 -1
- data/lib/slaw/za/act.treetop +50 -13
- data/lib/slaw/za/act_nodes.rb +95 -88
- data/spec/za/act_spec.rb +549 -205
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abd66cac7464d7d0e76983e97002f39e0ad85b6e
|
4
|
+
data.tar.gz: 681cfe499a8e96bc7183415b2ab795e834efa48a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1cc2cdbb8626fe61e8f688100d2b1c32b12772aadd4166f766c346fa27c69549358696b50e06797968f52ec1a7e9ce28df75060b8f4648ceca55dd280581dac
|
7
|
+
data.tar.gz: 485ddceb9b8efd4b8f9275735603e8c1edcbce766b6c541d82c1a0801a53045b83da833ab5e057b628e533f31d1fc97f13b84c4e03441a06ef3c393922cfeda9
|
data/lib/slaw/version.rb
CHANGED
data/lib/slaw/za/act.treetop
CHANGED
@@ -15,8 +15,8 @@ module Slaw
|
|
15
15
|
empty_line*
|
16
16
|
preface:preface?
|
17
17
|
preamble:preamble?
|
18
|
-
|
19
|
-
schedules:
|
18
|
+
body
|
19
|
+
schedules:schedules_container? <Act>
|
20
20
|
end
|
21
21
|
|
22
22
|
rule preface
|
@@ -30,14 +30,20 @@ module Slaw
|
|
30
30
|
statements:naked_statement* <Preamble>
|
31
31
|
end
|
32
32
|
|
33
|
+
rule body
|
34
|
+
children:(chapter / part / section / block_paragraphs / subsection)+ <Body>
|
35
|
+
end
|
36
|
+
|
33
37
|
rule chapter
|
34
|
-
heading:chapter_heading
|
35
|
-
|
38
|
+
heading:chapter_heading
|
39
|
+
children:(part / section / block_paragraphs / subsection)+
|
40
|
+
<Chapter>
|
36
41
|
end
|
37
42
|
|
38
43
|
rule part
|
39
|
-
heading:part_heading
|
40
|
-
|
44
|
+
heading:part_heading
|
45
|
+
children:(section / block_paragraphs / subsection)+
|
46
|
+
<Part>
|
41
47
|
end
|
42
48
|
|
43
49
|
rule section
|
@@ -50,25 +56,56 @@ module Slaw
|
|
50
56
|
blocklist:blocklist? <Subsection>
|
51
57
|
end
|
52
58
|
|
59
|
+
rule schedules_container
|
60
|
+
schedules:schedules <ScheduleContainer>
|
61
|
+
end
|
62
|
+
|
53
63
|
rule schedules
|
54
|
-
|
64
|
+
children:schedule+ <GroupNode>
|
55
65
|
end
|
56
66
|
|
57
67
|
rule schedule
|
58
68
|
schedule_heading
|
59
|
-
|
69
|
+
body
|
70
|
+
<Schedule>
|
71
|
+
end
|
72
|
+
|
73
|
+
rule block_paragraphs
|
74
|
+
block_element+ <BlockParagraph>
|
75
|
+
end
|
76
|
+
|
77
|
+
rule block_element
|
78
|
+
(table / blocklist / naked_statement)
|
79
|
+
end
|
80
|
+
|
81
|
+
##########
|
82
|
+
# group elements
|
83
|
+
#
|
84
|
+
# these are used externally and provide support when parsing just
|
85
|
+
# a particular portion of a document
|
86
|
+
|
87
|
+
rule chapters
|
88
|
+
children:chapter+ <GroupNode>
|
89
|
+
end
|
90
|
+
|
91
|
+
rule parts
|
92
|
+
children:part+ <GroupNode>
|
93
|
+
end
|
94
|
+
|
95
|
+
rule sections
|
96
|
+
children:section+ <GroupNode>
|
60
97
|
end
|
61
98
|
|
62
99
|
##########
|
63
100
|
# headings
|
64
101
|
|
65
102
|
rule chapter_heading
|
66
|
-
space? chapter_heading_prefix heading:(
|
103
|
+
space? chapter_heading_prefix heading:(newline? content)? eol
|
67
104
|
<ChapterHeading>
|
68
105
|
end
|
69
106
|
|
70
107
|
rule part_heading
|
71
|
-
space? part_heading_prefix
|
108
|
+
space? part_heading_prefix heading:(newline? content)? eol
|
72
109
|
<PartHeading>
|
73
110
|
end
|
74
111
|
|
@@ -120,7 +157,7 @@ module Slaw
|
|
120
157
|
end
|
121
158
|
|
122
159
|
rule naked_statement
|
123
|
-
space? !(
|
160
|
+
space? !(chapter_heading / part_heading / section_title / schedule_heading) clauses eol
|
124
161
|
<NakedStatement>
|
125
162
|
end
|
126
163
|
|
@@ -160,11 +197,11 @@ module Slaw
|
|
160
197
|
# prefixes
|
161
198
|
|
162
199
|
rule part_heading_prefix
|
163
|
-
'part'i space alphanums
|
200
|
+
'part'i space alphanums [ :-]*
|
164
201
|
end
|
165
202
|
|
166
203
|
rule chapter_heading_prefix
|
167
|
-
'chapter'i space alphanums
|
204
|
+
'chapter'i space alphanums [ :-]*
|
168
205
|
end
|
169
206
|
|
170
207
|
rule schedule_heading_prefix
|
data/lib/slaw/za/act_nodes.rb
CHANGED
@@ -9,7 +9,7 @@ module Slaw
|
|
9
9
|
EXPRESSION_URI = "#{FRBR_URI}/eng@"
|
10
10
|
MANIFESTATION_URI = EXPRESSION_URI
|
11
11
|
|
12
|
-
def to_xml(b, idprefix)
|
12
|
+
def to_xml(b, idprefix=nil, i=0)
|
13
13
|
b.act(contains: "originalVersion") { |b|
|
14
14
|
write_meta(b)
|
15
15
|
write_preface(b)
|
@@ -26,7 +26,6 @@ module Slaw
|
|
26
26
|
b.references(source: "#this") {
|
27
27
|
b.TLCOrganization(id: 'slaw', href: 'https://github.com/longhotsummer/slaw', showAs: "Slaw")
|
28
28
|
b.TLCOrganization(id: 'council', href: '/ontology/organization/za/council', showAs: "Council")
|
29
|
-
b.TLCRole(id: 'author', href: '/ontology/role/author', showAs: 'Author')
|
30
29
|
}
|
31
30
|
}
|
32
31
|
end
|
@@ -39,21 +38,21 @@ module Slaw
|
|
39
38
|
b.FRBRuri(value: WORK_URI)
|
40
39
|
b.FRBRalias(value: 'Short Title')
|
41
40
|
b.FRBRdate(date: '1980-01-01', name: 'Generation')
|
42
|
-
b.FRBRauthor(href: '#council'
|
41
|
+
b.FRBRauthor(href: '#council')
|
43
42
|
b.FRBRcountry(value: 'za')
|
44
43
|
}
|
45
44
|
b.FRBRExpression { |b|
|
46
45
|
b.FRBRthis(value: "#{EXPRESSION_URI}/main")
|
47
46
|
b.FRBRuri(value: EXPRESSION_URI)
|
48
47
|
b.FRBRdate(date: '1980-01-01', name: 'Generation')
|
49
|
-
b.FRBRauthor(href: '#council'
|
48
|
+
b.FRBRauthor(href: '#council')
|
50
49
|
b.FRBRlanguage(language: 'eng')
|
51
50
|
}
|
52
51
|
b.FRBRManifestation { |b|
|
53
52
|
b.FRBRthis(value: "#{MANIFESTATION_URI}/main")
|
54
53
|
b.FRBRuri(value: MANIFESTATION_URI)
|
55
54
|
b.FRBRdate(date: Time.now.strftime('%Y-%m-%d'), name: 'Generation')
|
56
|
-
b.FRBRauthor(href: '#slaw'
|
55
|
+
b.FRBRauthor(href: '#slaw')
|
57
56
|
}
|
58
57
|
}
|
59
58
|
end
|
@@ -67,18 +66,32 @@ module Slaw
|
|
67
66
|
end
|
68
67
|
|
69
68
|
def write_body(b)
|
69
|
+
body.to_xml(b)
|
70
|
+
end
|
71
|
+
|
72
|
+
def write_schedules(b)
|
73
|
+
if schedules.text_value != ""
|
74
|
+
schedules.to_xml(b)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
class Body < Treetop::Runtime::SyntaxNode
|
80
|
+
def to_xml(b)
|
70
81
|
b.body { |b|
|
71
|
-
|
82
|
+
children.elements.each { |e| e.to_xml(b, '') }
|
72
83
|
}
|
73
84
|
end
|
85
|
+
end
|
74
86
|
|
75
|
-
|
76
|
-
|
87
|
+
class GroupNode < Treetop::Runtime::SyntaxNode
|
88
|
+
def to_xml(b, *args)
|
89
|
+
children.elements.each { |e| e.to_xml(b, *args) }
|
77
90
|
end
|
78
91
|
end
|
79
92
|
|
80
93
|
class Preface < Treetop::Runtime::SyntaxNode
|
81
|
-
def to_xml(b)
|
94
|
+
def to_xml(b, *args)
|
82
95
|
if text_value != ""
|
83
96
|
b.preface { |b|
|
84
97
|
statements.elements.each { |element|
|
@@ -92,7 +105,7 @@ module Slaw
|
|
92
105
|
end
|
93
106
|
|
94
107
|
class Preamble < Treetop::Runtime::SyntaxNode
|
95
|
-
def to_xml(b)
|
108
|
+
def to_xml(b, *args)
|
96
109
|
if text_value != ""
|
97
110
|
b.preamble { |b|
|
98
111
|
statements.elements.each { |e|
|
@@ -105,27 +118,21 @@ module Slaw
|
|
105
118
|
|
106
119
|
class Part < Treetop::Runtime::SyntaxNode
|
107
120
|
def num
|
108
|
-
heading.
|
121
|
+
heading.num
|
109
122
|
end
|
110
123
|
|
111
|
-
def to_xml(b)
|
112
|
-
|
113
|
-
if not heading.empty?
|
114
|
-
id = "part-#{num}"
|
115
|
-
|
116
|
-
# include a chapter number in the id if our parent has one
|
117
|
-
if parent and parent.parent.is_a?(Chapter) and parent.parent.num
|
118
|
-
id = "chapter-#{parent.parent.num}.#{id}"
|
119
|
-
end
|
124
|
+
def to_xml(b, *args)
|
125
|
+
id = "part-#{num}"
|
120
126
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
}
|
125
|
-
else
|
126
|
-
# no parts
|
127
|
-
sections.elements.each { |e| e.to_xml(b) }
|
127
|
+
# include a chapter number in the id if our parent has one
|
128
|
+
if parent and parent.parent.is_a?(Chapter) and parent.parent.num
|
129
|
+
id = "chapter-#{parent.parent.num}.#{id}"
|
128
130
|
end
|
131
|
+
|
132
|
+
b.part(id: id) { |b|
|
133
|
+
heading.to_xml(b)
|
134
|
+
children.elements.each_with_index { |e, i| e.to_xml(b, id + '.', i) }
|
135
|
+
}
|
129
136
|
end
|
130
137
|
end
|
131
138
|
|
@@ -135,38 +142,34 @@ module Slaw
|
|
135
142
|
end
|
136
143
|
|
137
144
|
def title
|
138
|
-
|
145
|
+
if heading.text_value and heading.respond_to? :content
|
146
|
+
heading.content.text_value
|
147
|
+
end
|
139
148
|
end
|
140
149
|
|
141
150
|
def to_xml(b)
|
142
151
|
b.num(num)
|
143
|
-
b.heading(title)
|
152
|
+
b.heading(title) if title
|
144
153
|
end
|
145
154
|
end
|
146
155
|
|
147
156
|
class Chapter < Treetop::Runtime::SyntaxNode
|
148
157
|
def num
|
149
|
-
heading.
|
158
|
+
heading.num
|
150
159
|
end
|
151
160
|
|
152
|
-
def to_xml(b)
|
153
|
-
|
154
|
-
if not heading.empty?
|
155
|
-
id = "chapter-#{num}"
|
156
|
-
|
157
|
-
# include a part number in the id if our parent has one
|
158
|
-
if parent and parent.parent.is_a?(Part) and parent.parent.num
|
159
|
-
id = "part-#{parent.parent.num}.#{id}"
|
160
|
-
end
|
161
|
+
def to_xml(b, *args)
|
162
|
+
id = "chapter-#{num}"
|
161
163
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
}
|
166
|
-
else
|
167
|
-
# no chapters
|
168
|
-
parts.elements.each { |e| e.to_xml(b) }
|
164
|
+
# include a part number in the id if our parent has one
|
165
|
+
if parent and parent.parent.is_a?(Part) and parent.parent.num
|
166
|
+
id = "part-#{parent.parent.num}.#{id}"
|
169
167
|
end
|
168
|
+
|
169
|
+
b.chapter(id: id) { |b|
|
170
|
+
heading.to_xml(b)
|
171
|
+
children.elements.each_with_index { |e, i| e.to_xml(b, id + '.', i) }
|
172
|
+
}
|
170
173
|
end
|
171
174
|
end
|
172
175
|
|
@@ -176,10 +179,8 @@ module Slaw
|
|
176
179
|
end
|
177
180
|
|
178
181
|
def title
|
179
|
-
if
|
182
|
+
if heading.text_value and heading.respond_to? :content
|
180
183
|
heading.content.text_value
|
181
|
-
elsif self.respond_to? :content
|
182
|
-
content.text_value
|
183
184
|
end
|
184
185
|
end
|
185
186
|
|
@@ -198,7 +199,7 @@ module Slaw
|
|
198
199
|
section_title.title
|
199
200
|
end
|
200
201
|
|
201
|
-
def to_xml(b)
|
202
|
+
def to_xml(b, *args)
|
202
203
|
id = "section-#{num}"
|
203
204
|
b.section(id: id) { |b|
|
204
205
|
b.num("#{num}.")
|
@@ -274,6 +275,16 @@ module Slaw
|
|
274
275
|
end
|
275
276
|
end
|
276
277
|
|
278
|
+
class BlockParagraph < Treetop::Runtime::SyntaxNode
|
279
|
+
def to_xml(b, idprefix='', i=0)
|
280
|
+
b.paragraph(id: "#{idprefix}paragraph-0") { |b|
|
281
|
+
b.content { |b|
|
282
|
+
elements.each_with_index { |e, i| e.to_xml(b, idprefix) }
|
283
|
+
}
|
284
|
+
}
|
285
|
+
end
|
286
|
+
end
|
287
|
+
|
277
288
|
class NumberedStatement < Treetop::Runtime::SyntaxNode
|
278
289
|
def num
|
279
290
|
numbered_statement_prefix.num.text_value
|
@@ -386,13 +397,9 @@ module Slaw
|
|
386
397
|
|
387
398
|
class ScheduleContainer < Treetop::Runtime::SyntaxNode
|
388
399
|
def to_xml(b)
|
389
|
-
return if schedules.elements.empty?
|
390
|
-
|
391
400
|
b.components { |b|
|
392
|
-
schedules.elements.each_with_index { |e, i|
|
393
|
-
|
394
|
-
e.to_xml(b, "", i+1)
|
395
|
-
}
|
401
|
+
schedules.children.elements.each_with_index { |e, i|
|
402
|
+
e.to_xml(b, "", i+1)
|
396
403
|
}
|
397
404
|
}
|
398
405
|
end
|
@@ -420,47 +427,47 @@ module Slaw
|
|
420
427
|
end
|
421
428
|
end
|
422
429
|
|
423
|
-
def to_xml(b, idprefix, i=1)
|
430
|
+
def to_xml(b, idprefix=nil, i=1)
|
424
431
|
n = num.nil? ? i : num
|
425
432
|
|
426
433
|
# component name
|
427
434
|
comp = "schedule#{n}"
|
428
435
|
id = "#{idprefix}schedule-#{n}"
|
429
436
|
|
430
|
-
b.
|
431
|
-
b.
|
432
|
-
b.
|
433
|
-
b.
|
434
|
-
b.
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
b.
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
b.
|
450
|
-
|
451
|
-
|
452
|
-
|
437
|
+
b.component(id: "component-#{id}") { |b|
|
438
|
+
b.doc_(name: "schedule#{n}") { |b|
|
439
|
+
b.meta { |b|
|
440
|
+
b.identification(source: "#slaw") { |b|
|
441
|
+
b.FRBRWork { |b|
|
442
|
+
b.FRBRthis(value: "#{Act::WORK_URI}/#{comp}")
|
443
|
+
b.FRBRuri(value: Act::WORK_URI)
|
444
|
+
b.FRBRalias(value: self.alias)
|
445
|
+
b.FRBRdate(date: '1980-01-01', name: 'Generation')
|
446
|
+
b.FRBRauthor(href: '#council')
|
447
|
+
b.FRBRcountry(value: 'za')
|
448
|
+
}
|
449
|
+
b.FRBRExpression { |b|
|
450
|
+
b.FRBRthis(value: "#{Act::EXPRESSION_URI}/#{comp}")
|
451
|
+
b.FRBRuri(value: Act::EXPRESSION_URI)
|
452
|
+
b.FRBRdate(date: '1980-01-01', name: 'Generation')
|
453
|
+
b.FRBRauthor(href: '#council')
|
454
|
+
b.FRBRlanguage(language: 'eng')
|
455
|
+
}
|
456
|
+
b.FRBRManifestation { |b|
|
457
|
+
b.FRBRthis(value: "#{Act::MANIFESTATION_URI}/#{comp}")
|
458
|
+
b.FRBRuri(value: Act::MANIFESTATION_URI)
|
459
|
+
b.FRBRdate(date: Time.now.strftime('%Y-%m-%d'), name: 'Generation')
|
460
|
+
b.FRBRauthor(href: '#slaw')
|
461
|
+
}
|
453
462
|
}
|
454
463
|
}
|
455
|
-
}
|
456
464
|
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
statements.elements.each { |e| e.to_xml(b, id + '.') }
|
465
|
+
b.mainBody { |b|
|
466
|
+
# there is no good AKN hierarchy container for schedules, so we
|
467
|
+
# just use article because we don't use it anywhere else.
|
468
|
+
b.article(id: id) { |b|
|
469
|
+
b.heading(heading) if heading
|
470
|
+
body.children.elements.each { |e| e.to_xml(b) }
|
464
471
|
}
|
465
472
|
}
|
466
473
|
}
|
data/spec/za/act_spec.rb
CHANGED
@@ -27,19 +27,85 @@ describe Slaw::ActGenerator do
|
|
27
27
|
b.doc.root.to_xml(encoding: 'UTF-8')
|
28
28
|
end
|
29
29
|
|
30
|
+
#-------------------------------------------------------------------------------
|
31
|
+
# General body
|
32
|
+
|
33
|
+
describe 'body' do
|
34
|
+
it 'should handle general content before chapters' do
|
35
|
+
node = parse :body, <<EOS
|
36
|
+
Some content before the section
|
37
|
+
|
38
|
+
1. Section
|
39
|
+
Hello there
|
40
|
+
EOS
|
41
|
+
to_xml(node).should == '<body>
|
42
|
+
<paragraph id="paragraph-0">
|
43
|
+
<content>
|
44
|
+
<p>Some content before the section</p>
|
45
|
+
</content>
|
46
|
+
</paragraph>
|
47
|
+
<section id="section-1">
|
48
|
+
<num>1.</num>
|
49
|
+
<heading>Section</heading>
|
50
|
+
<subsection id="section-1.subsection-0">
|
51
|
+
<content>
|
52
|
+
<p>Hello there</p>
|
53
|
+
</content>
|
54
|
+
</subsection>
|
55
|
+
</section>
|
56
|
+
</body>'
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'should handle blocklists before chapters' do
|
60
|
+
node = parse :body, <<EOS
|
61
|
+
Some content before the section
|
62
|
+
|
63
|
+
(a) foo
|
64
|
+
(b) bar
|
65
|
+
|
66
|
+
1. Section
|
67
|
+
Hello there
|
68
|
+
EOS
|
69
|
+
to_xml(node).should == '<body>
|
70
|
+
<paragraph id="paragraph-0">
|
71
|
+
<content>
|
72
|
+
<p>Some content before the section</p>
|
73
|
+
<blockList id="list0">
|
74
|
+
<item id="list0.a">
|
75
|
+
<num>(a)</num>
|
76
|
+
<p>foo</p>
|
77
|
+
</item>
|
78
|
+
<item id="list0.b">
|
79
|
+
<num>(b)</num>
|
80
|
+
<p>bar</p>
|
81
|
+
</item>
|
82
|
+
</blockList>
|
83
|
+
</content>
|
84
|
+
</paragraph>
|
85
|
+
<section id="section-1">
|
86
|
+
<num>1.</num>
|
87
|
+
<heading>Section</heading>
|
88
|
+
<subsection id="section-1.subsection-0">
|
89
|
+
<content>
|
90
|
+
<p>Hello there</p>
|
91
|
+
</content>
|
92
|
+
</subsection>
|
93
|
+
</section>
|
94
|
+
</body>'
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
30
98
|
#-------------------------------------------------------------------------------
|
31
99
|
# Chapters
|
32
100
|
#
|
33
101
|
describe 'chapters' do
|
34
102
|
it 'should handle chapter headers' do
|
35
103
|
node = parse :chapter, <<EOS
|
36
|
-
ChaPTEr 2
|
104
|
+
ChaPTEr 2 -
|
37
105
|
The Chapter Heading
|
38
106
|
1. Section
|
39
107
|
Hello there
|
40
108
|
EOS
|
41
|
-
node.num.should == "2"
|
42
|
-
node.heading.title.should == 'The Chapter Heading'
|
43
109
|
to_xml(node).should == '<chapter id="chapter-2">
|
44
110
|
<num>2</num>
|
45
111
|
<heading>The Chapter Heading</heading>
|
@@ -52,6 +118,79 @@ EOS
|
|
52
118
|
</content>
|
53
119
|
</subsection>
|
54
120
|
</section>
|
121
|
+
</chapter>'
|
122
|
+
end
|
123
|
+
|
124
|
+
it 'should handle chapters without titles' do
|
125
|
+
node = parse :chapter, <<EOS
|
126
|
+
ChaPTEr 2:
|
127
|
+
|
128
|
+
1. Section
|
129
|
+
Hello there
|
130
|
+
EOS
|
131
|
+
to_xml(node).should == '<chapter id="chapter-2">
|
132
|
+
<num>2</num>
|
133
|
+
<section id="section-1">
|
134
|
+
<num>1.</num>
|
135
|
+
<heading>Section</heading>
|
136
|
+
<subsection id="section-1.subsection-0">
|
137
|
+
<content>
|
138
|
+
<p>Hello there</p>
|
139
|
+
</content>
|
140
|
+
</subsection>
|
141
|
+
</section>
|
142
|
+
</chapter>'
|
143
|
+
end
|
144
|
+
|
145
|
+
it 'should handle general content at the start of a chapter' do
|
146
|
+
node = parse :chapter, <<EOS
|
147
|
+
Chapter 2
|
148
|
+
The Chapter Heading
|
149
|
+
|
150
|
+
Some lines at the start of the chapter.
|
151
|
+
EOS
|
152
|
+
node.num.should == "2"
|
153
|
+
node.heading.title.should == 'The Chapter Heading'
|
154
|
+
to_xml(node).should == '<chapter id="chapter-2">
|
155
|
+
<num>2</num>
|
156
|
+
<heading>The Chapter Heading</heading>
|
157
|
+
<paragraph id="chapter-2.paragraph-0">
|
158
|
+
<content>
|
159
|
+
<p>Some lines at the start of the chapter.</p>
|
160
|
+
</content>
|
161
|
+
</paragraph>
|
162
|
+
</chapter>'
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'should handle general content at the start of a chapter with other content' do
|
166
|
+
node = parse :chapter, <<EOS
|
167
|
+
Chapter 2 - The Chapter Heading
|
168
|
+
|
169
|
+
Some lines at the start of the chapter.
|
170
|
+
|
171
|
+
1. Section 1
|
172
|
+
|
173
|
+
Section text.
|
174
|
+
EOS
|
175
|
+
node.num.should == "2"
|
176
|
+
node.heading.title.should == 'The Chapter Heading'
|
177
|
+
to_xml(node).should == '<chapter id="chapter-2">
|
178
|
+
<num>2</num>
|
179
|
+
<heading>The Chapter Heading</heading>
|
180
|
+
<paragraph id="chapter-2.paragraph-0">
|
181
|
+
<content>
|
182
|
+
<p>Some lines at the start of the chapter.</p>
|
183
|
+
</content>
|
184
|
+
</paragraph>
|
185
|
+
<section id="section-1">
|
186
|
+
<num>1.</num>
|
187
|
+
<heading>Section 1</heading>
|
188
|
+
<subsection id="section-1.subsection-0">
|
189
|
+
<content>
|
190
|
+
<p>Section text.</p>
|
191
|
+
</content>
|
192
|
+
</subsection>
|
193
|
+
</section>
|
55
194
|
</chapter>'
|
56
195
|
end
|
57
196
|
end
|
@@ -67,8 +206,6 @@ The Part Heading
|
|
67
206
|
1. Section
|
68
207
|
Hello there
|
69
208
|
EOS
|
70
|
-
node.num.should == "2"
|
71
|
-
node.heading.title.should == 'The Part Heading'
|
72
209
|
to_xml(node).should == '<part id="part-2">
|
73
210
|
<num>2</num>
|
74
211
|
<heading>The Part Heading</heading>
|
@@ -90,8 +227,6 @@ Part 2 - The Part Heading
|
|
90
227
|
1. Section
|
91
228
|
Hello there
|
92
229
|
EOS
|
93
|
-
node.num.should == "2"
|
94
|
-
node.heading.title.should == 'The Part Heading'
|
95
230
|
to_xml(node).should == '<part id="part-2">
|
96
231
|
<num>2</num>
|
97
232
|
<heading>The Part Heading</heading>
|
@@ -113,8 +248,6 @@ Part 2: The Part Heading
|
|
113
248
|
1. Section
|
114
249
|
Hello there
|
115
250
|
EOS
|
116
|
-
node.num.should == "2"
|
117
|
-
node.heading.title.should == 'The Part Heading'
|
118
251
|
to_xml(node).should == '<part id="part-2">
|
119
252
|
<num>2</num>
|
120
253
|
<heading>The Part Heading</heading>
|
@@ -130,22 +263,80 @@ EOS
|
|
130
263
|
</part>'
|
131
264
|
end
|
132
265
|
|
266
|
+
it 'should handle part headers without titles' do
|
267
|
+
node = parse :part, <<EOS
|
268
|
+
Part 2:
|
269
|
+
|
270
|
+
1. Section
|
271
|
+
Hello there
|
272
|
+
EOS
|
273
|
+
to_xml(node).should == '<part id="part-2">
|
274
|
+
<num>2</num>
|
275
|
+
<section id="section-1">
|
276
|
+
<num>1.</num>
|
277
|
+
<heading>Section</heading>
|
278
|
+
<subsection id="section-1.subsection-0">
|
279
|
+
<content>
|
280
|
+
<p>Hello there</p>
|
281
|
+
</content>
|
282
|
+
</subsection>
|
283
|
+
</section>
|
284
|
+
</part>'
|
285
|
+
end
|
286
|
+
|
133
287
|
it 'should handle parts and odd section numbers' do
|
134
288
|
subject.parser.options = {section_number_after_title: false}
|
135
|
-
node = parse :
|
289
|
+
node = parse :parts, <<EOS
|
136
290
|
PART 1
|
137
291
|
PREVENTION AND SUPPRESSION OF HEALTH NUISANCES
|
138
292
|
1.
|
139
293
|
No owner or occupier of any shop or business premises or vacant land adjoining a shop or business premises shall cause a health nuisance.
|
140
294
|
EOS
|
295
|
+
to_xml(node).should == '<part id="part-1">
|
296
|
+
<num>1</num>
|
297
|
+
<heading>PREVENTION AND SUPPRESSION OF HEALTH NUISANCES</heading>
|
298
|
+
<section id="section-1">
|
299
|
+
<num>1.</num>
|
300
|
+
<heading/>
|
301
|
+
<subsection id="section-1.subsection-0">
|
302
|
+
<content>
|
303
|
+
<p>No owner or occupier of any shop or business premises or vacant land adjoining a shop or business premises shall cause a health nuisance.</p>
|
304
|
+
</content>
|
305
|
+
</subsection>
|
306
|
+
</section>
|
307
|
+
</part>'
|
308
|
+
end
|
309
|
+
|
310
|
+
it 'should handle general content after the part heading' do
|
311
|
+
node = parse :part, <<EOS
|
312
|
+
Part 2
|
313
|
+
The Part Heading
|
141
314
|
|
142
|
-
|
143
|
-
part.heading.num.should == "1"
|
144
|
-
part.heading.title.should == "PREVENTION AND SUPPRESSION OF HEALTH NUISANCES"
|
315
|
+
Some text before the part.
|
145
316
|
|
146
|
-
|
147
|
-
|
148
|
-
|
317
|
+
1. Section
|
318
|
+
Hello there
|
319
|
+
EOS
|
320
|
+
node.num.should == "2"
|
321
|
+
node.heading.title.should == 'The Part Heading'
|
322
|
+
to_xml(node).should == '<part id="part-2">
|
323
|
+
<num>2</num>
|
324
|
+
<heading>The Part Heading</heading>
|
325
|
+
<paragraph id="part-2.paragraph-0">
|
326
|
+
<content>
|
327
|
+
<p>Some text before the part.</p>
|
328
|
+
</content>
|
329
|
+
</paragraph>
|
330
|
+
<section id="section-1">
|
331
|
+
<num>1.</num>
|
332
|
+
<heading>Section</heading>
|
333
|
+
<subsection id="section-1.subsection-0">
|
334
|
+
<content>
|
335
|
+
<p>Hello there</p>
|
336
|
+
</content>
|
337
|
+
</subsection>
|
338
|
+
</section>
|
339
|
+
</part>'
|
149
340
|
end
|
150
341
|
end
|
151
342
|
|
@@ -414,44 +605,48 @@ EOS
|
|
414
605
|
EOS
|
415
606
|
|
416
607
|
today = Time.now.strftime('%Y-%m-%d')
|
417
|
-
to_xml(node, "").should == '<
|
418
|
-
<
|
419
|
-
<
|
420
|
-
<
|
421
|
-
<
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
<
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
<
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
<
|
445
|
-
<
|
446
|
-
|
447
|
-
<
|
448
|
-
<
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
</
|
608
|
+
to_xml(node, "").should == '<component id="component-schedule-1">
|
609
|
+
<doc name="schedule1">
|
610
|
+
<meta>
|
611
|
+
<identification source="#slaw">
|
612
|
+
<FRBRWork>
|
613
|
+
<FRBRthis value="/za/act/1980/01/schedule1"/>
|
614
|
+
<FRBRuri value="/za/act/1980/01"/>
|
615
|
+
<FRBRalias value="Schedule 1"/>
|
616
|
+
<FRBRdate date="1980-01-01" name="Generation"/>
|
617
|
+
<FRBRauthor href="#council"/>
|
618
|
+
<FRBRcountry value="za"/>
|
619
|
+
</FRBRWork>
|
620
|
+
<FRBRExpression>
|
621
|
+
<FRBRthis value="/za/act/1980/01/eng@/schedule1"/>
|
622
|
+
<FRBRuri value="/za/act/1980/01/eng@"/>
|
623
|
+
<FRBRdate date="1980-01-01" name="Generation"/>
|
624
|
+
<FRBRauthor href="#council"/>
|
625
|
+
<FRBRlanguage language="eng"/>
|
626
|
+
</FRBRExpression>
|
627
|
+
<FRBRManifestation>
|
628
|
+
<FRBRthis value="/za/act/1980/01/eng@/schedule1"/>
|
629
|
+
<FRBRuri value="/za/act/1980/01/eng@"/>
|
630
|
+
<FRBRdate date="' + today + '" name="Generation"/>
|
631
|
+
<FRBRauthor href="#slaw"/>
|
632
|
+
</FRBRManifestation>
|
633
|
+
</identification>
|
634
|
+
</meta>
|
635
|
+
<mainBody>
|
636
|
+
<article id="schedule-1">
|
637
|
+
<heading>A Title</heading>
|
638
|
+
<paragraph id="paragraph-0">
|
639
|
+
<content>
|
640
|
+
<p>
|
641
|
+
<remark status="editorial">[Schedule 1 added by Act 23 of 2004]</remark>
|
642
|
+
</p>
|
643
|
+
<p>Some content</p>
|
644
|
+
</content>
|
645
|
+
</paragraph>
|
646
|
+
</article>
|
647
|
+
</mainBody>
|
648
|
+
</doc>
|
649
|
+
</component>'
|
455
650
|
end
|
456
651
|
end
|
457
652
|
|
@@ -503,27 +698,26 @@ baz
|
|
503
698
|
<FRBRuri value="/za/act/1980/01"/>
|
504
699
|
<FRBRalias value="Short Title"/>
|
505
700
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
506
|
-
<FRBRauthor href="#council"
|
701
|
+
<FRBRauthor href="#council"/>
|
507
702
|
<FRBRcountry value="za"/>
|
508
703
|
</FRBRWork>
|
509
704
|
<FRBRExpression>
|
510
705
|
<FRBRthis value="/za/act/1980/01/eng@/main"/>
|
511
706
|
<FRBRuri value="/za/act/1980/01/eng@"/>
|
512
707
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
513
|
-
<FRBRauthor href="#council"
|
708
|
+
<FRBRauthor href="#council"/>
|
514
709
|
<FRBRlanguage language="eng"/>
|
515
710
|
</FRBRExpression>
|
516
711
|
<FRBRManifestation>
|
517
712
|
<FRBRthis value="/za/act/1980/01/eng@/main"/>
|
518
713
|
<FRBRuri value="/za/act/1980/01/eng@"/>
|
519
714
|
<FRBRdate date="' + today + '" name="Generation"/>
|
520
|
-
<FRBRauthor href="#slaw"
|
715
|
+
<FRBRauthor href="#slaw"/>
|
521
716
|
</FRBRManifestation>
|
522
717
|
</identification>
|
523
718
|
<references source="#this">
|
524
719
|
<TLCOrganization id="slaw" href="https://github.com/longhotsummer/slaw" showAs="Slaw"/>
|
525
720
|
<TLCOrganization id="council" href="/ontology/organization/za/council" showAs="Council"/>
|
526
|
-
<TLCRole id="author" href="/ontology/role/author" showAs="Author"/>
|
527
721
|
</references>
|
528
722
|
</meta>
|
529
723
|
<preface>
|
@@ -696,58 +890,99 @@ EOS
|
|
696
890
|
context 'sections' do
|
697
891
|
it 'should handle section numbers after title' do
|
698
892
|
subject.parser.options = {section_number_after_title: true}
|
699
|
-
node = parse :
|
893
|
+
node = parse :section, <<EOS
|
700
894
|
Section
|
701
895
|
1. (1) hello
|
702
896
|
EOS
|
703
897
|
|
704
|
-
|
705
|
-
|
706
|
-
|
898
|
+
s = to_xml(node)
|
899
|
+
s.should == '<section id="section-1">
|
900
|
+
<num>1.</num>
|
901
|
+
<heading>Section</heading>
|
902
|
+
<subsection id="section-1.1">
|
903
|
+
<num>(1)</num>
|
904
|
+
<content>
|
905
|
+
<p>hello</p>
|
906
|
+
</content>
|
907
|
+
</subsection>
|
908
|
+
</section>'
|
707
909
|
end
|
708
910
|
|
709
911
|
it 'should handle section numbers before title' do
|
710
912
|
subject.parser.options = {section_number_after_title: false}
|
711
|
-
node = parse :
|
913
|
+
node = parse :section, <<EOS
|
712
914
|
1. Section
|
713
915
|
(1) hello
|
714
916
|
EOS
|
715
|
-
|
716
|
-
section =
|
717
|
-
|
718
|
-
|
917
|
+
s = to_xml(node)
|
918
|
+
s.should == '<section id="section-1">
|
919
|
+
<num>1.</num>
|
920
|
+
<heading>Section</heading>
|
921
|
+
<subsection id="section-1.1">
|
922
|
+
<num>(1)</num>
|
923
|
+
<content>
|
924
|
+
<p>hello</p>
|
925
|
+
</content>
|
926
|
+
</subsection>
|
927
|
+
</section>'
|
719
928
|
end
|
720
929
|
|
721
930
|
it 'should handle section numbers without a dot' do
|
722
931
|
subject.parser.options = {section_number_after_title: false}
|
723
|
-
node = parse :
|
932
|
+
node = parse :body, <<EOS
|
724
933
|
1 A section
|
725
934
|
(1) hello
|
726
935
|
2 Another section
|
727
936
|
(2) Another line
|
728
937
|
EOS
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
938
|
+
s = to_xml(node)
|
939
|
+
s.should == '<body>
|
940
|
+
<section id="section-1">
|
941
|
+
<num>1.</num>
|
942
|
+
<heading>A section</heading>
|
943
|
+
<subsection id="section-1.1">
|
944
|
+
<num>(1)</num>
|
945
|
+
<content>
|
946
|
+
<p>hello</p>
|
947
|
+
</content>
|
948
|
+
</subsection>
|
949
|
+
</section>
|
950
|
+
<section id="section-2">
|
951
|
+
<num>2.</num>
|
952
|
+
<heading>Another section</heading>
|
953
|
+
<subsection id="section-2.2">
|
954
|
+
<num>(2)</num>
|
955
|
+
<content>
|
956
|
+
<p>Another line</p>
|
957
|
+
</content>
|
958
|
+
</subsection>
|
959
|
+
</section>
|
960
|
+
</body>'
|
737
961
|
end
|
738
962
|
|
739
963
|
it 'should handle sections without titles and with subsections' do
|
740
964
|
subject.parser.options = {section_number_after_title: false}
|
741
|
-
node = parse :
|
965
|
+
node = parse :section, <<EOS
|
742
966
|
10. (1) Transporters must remove medical waste.
|
743
967
|
(2) Without limiting generality, stuff.
|
744
968
|
EOS
|
745
|
-
|
746
|
-
section =
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
969
|
+
s = to_xml(node)
|
970
|
+
s.should == '<section id="section-10">
|
971
|
+
<num>10.</num>
|
972
|
+
<heading/>
|
973
|
+
<subsection id="section-10.1">
|
974
|
+
<num>(1)</num>
|
975
|
+
<content>
|
976
|
+
<p>Transporters must remove medical waste.</p>
|
977
|
+
</content>
|
978
|
+
</subsection>
|
979
|
+
<subsection id="section-10.2">
|
980
|
+
<num>(2)</num>
|
981
|
+
<content>
|
982
|
+
<p>Without limiting generality, stuff.</p>
|
983
|
+
</content>
|
984
|
+
</subsection>
|
985
|
+
</section>'
|
751
986
|
end
|
752
987
|
end
|
753
988
|
|
@@ -762,43 +997,58 @@ Subject to approval in terms of this By-Law, the erection:
|
|
762
997
|
1. Foo
|
763
998
|
2. Bar
|
764
999
|
EOS
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
1000
|
+
s = to_xml(node)
|
1001
|
+
today = Time.now.strftime('%Y-%m-%d')
|
1002
|
+
s.should == '<component id="component-schedule-1">
|
1003
|
+
<doc name="schedule1">
|
1004
|
+
<meta>
|
1005
|
+
<identification source="#slaw">
|
1006
|
+
<FRBRWork>
|
1007
|
+
<FRBRthis value="/za/act/1980/01/schedule1"/>
|
1008
|
+
<FRBRuri value="/za/act/1980/01"/>
|
1009
|
+
<FRBRalias value="Schedule"/>
|
1010
|
+
<FRBRdate date="1980-01-01" name="Generation"/>
|
1011
|
+
<FRBRauthor href="#council"/>
|
1012
|
+
<FRBRcountry value="za"/>
|
1013
|
+
</FRBRWork>
|
1014
|
+
<FRBRExpression>
|
1015
|
+
<FRBRthis value="/za/act/1980/01/eng@/schedule1"/>
|
1016
|
+
<FRBRuri value="/za/act/1980/01/eng@"/>
|
1017
|
+
<FRBRdate date="1980-01-01" name="Generation"/>
|
1018
|
+
<FRBRauthor href="#council"/>
|
1019
|
+
<FRBRlanguage language="eng"/>
|
1020
|
+
</FRBRExpression>
|
1021
|
+
<FRBRManifestation>
|
1022
|
+
<FRBRthis value="/za/act/1980/01/eng@/schedule1"/>
|
1023
|
+
<FRBRuri value="/za/act/1980/01/eng@"/>
|
1024
|
+
<FRBRdate date="' + today + '" name="Generation"/>
|
1025
|
+
<FRBRauthor href="#slaw"/>
|
1026
|
+
</FRBRManifestation>
|
1027
|
+
</identification>
|
1028
|
+
</meta>
|
1029
|
+
<mainBody>
|
1030
|
+
<article id="schedule-1">
|
1031
|
+
<paragraph id="paragraph-0">
|
1032
|
+
<content>
|
1033
|
+
<p>Subject to approval in terms of this By-Law, the erection:</p>
|
1034
|
+
</content>
|
1035
|
+
</paragraph>
|
1036
|
+
<section id="section-1">
|
1037
|
+
<num>1.</num>
|
1038
|
+
<heading>Foo</heading>
|
1039
|
+
</section>
|
1040
|
+
<section id="section-2">
|
1041
|
+
<num>2.</num>
|
1042
|
+
<heading>Bar</heading>
|
1043
|
+
</section>
|
1044
|
+
</article>
|
1045
|
+
</mainBody>
|
1046
|
+
</doc>
|
1047
|
+
</component>'
|
798
1048
|
end
|
799
1049
|
|
800
1050
|
it 'should serialise many schedules correctly' do
|
801
|
-
node = parse :
|
1051
|
+
node = parse :schedules_container, <<EOS
|
802
1052
|
Schedule "2"
|
803
1053
|
A Title
|
804
1054
|
1. Foo
|
@@ -813,7 +1063,7 @@ EOS
|
|
813
1063
|
today = Time.now.strftime('%Y-%m-%d')
|
814
1064
|
s.should == <<EOS
|
815
1065
|
<components>
|
816
|
-
<component id="component-
|
1066
|
+
<component id="component-schedule-2">
|
817
1067
|
<doc name="schedule2">
|
818
1068
|
<meta>
|
819
1069
|
<identification source="#slaw">
|
@@ -822,36 +1072,40 @@ EOS
|
|
822
1072
|
<FRBRuri value="/za/act/1980/01"/>
|
823
1073
|
<FRBRalias value="Schedule 2"/>
|
824
1074
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
825
|
-
<FRBRauthor href="#council"
|
1075
|
+
<FRBRauthor href="#council"/>
|
826
1076
|
<FRBRcountry value="za"/>
|
827
1077
|
</FRBRWork>
|
828
1078
|
<FRBRExpression>
|
829
1079
|
<FRBRthis value="/za/act/1980/01/eng@/schedule2"/>
|
830
1080
|
<FRBRuri value="/za/act/1980/01/eng@"/>
|
831
1081
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
832
|
-
<FRBRauthor href="#council"
|
1082
|
+
<FRBRauthor href="#council"/>
|
833
1083
|
<FRBRlanguage language="eng"/>
|
834
1084
|
</FRBRExpression>
|
835
1085
|
<FRBRManifestation>
|
836
1086
|
<FRBRthis value="/za/act/1980/01/eng@/schedule2"/>
|
837
1087
|
<FRBRuri value="/za/act/1980/01/eng@"/>
|
838
1088
|
<FRBRdate date="#{today}" name="Generation"/>
|
839
|
-
<FRBRauthor href="#slaw"
|
1089
|
+
<FRBRauthor href="#slaw"/>
|
840
1090
|
</FRBRManifestation>
|
841
1091
|
</identification>
|
842
1092
|
</meta>
|
843
1093
|
<mainBody>
|
844
1094
|
<article id="schedule-2">
|
845
1095
|
<heading>A Title</heading>
|
846
|
-
<
|
847
|
-
<
|
848
|
-
<
|
849
|
-
</
|
1096
|
+
<section id="section-1">
|
1097
|
+
<num>1.</num>
|
1098
|
+
<heading>Foo</heading>
|
1099
|
+
</section>
|
1100
|
+
<section id="section-2">
|
1101
|
+
<num>2.</num>
|
1102
|
+
<heading>Bar</heading>
|
1103
|
+
</section>
|
850
1104
|
</article>
|
851
1105
|
</mainBody>
|
852
1106
|
</doc>
|
853
1107
|
</component>
|
854
|
-
<component id="component-
|
1108
|
+
<component id="component-schedule-3">
|
855
1109
|
<doc name="schedule3">
|
856
1110
|
<meta>
|
857
1111
|
<identification source="#slaw">
|
@@ -860,31 +1114,33 @@ EOS
|
|
860
1114
|
<FRBRuri value="/za/act/1980/01"/>
|
861
1115
|
<FRBRalias value="Schedule 3"/>
|
862
1116
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
863
|
-
<FRBRauthor href="#council"
|
1117
|
+
<FRBRauthor href="#council"/>
|
864
1118
|
<FRBRcountry value="za"/>
|
865
1119
|
</FRBRWork>
|
866
1120
|
<FRBRExpression>
|
867
1121
|
<FRBRthis value="/za/act/1980/01/eng@/schedule3"/>
|
868
1122
|
<FRBRuri value="/za/act/1980/01/eng@"/>
|
869
1123
|
<FRBRdate date="1980-01-01" name="Generation"/>
|
870
|
-
<FRBRauthor href="#council"
|
1124
|
+
<FRBRauthor href="#council"/>
|
871
1125
|
<FRBRlanguage language="eng"/>
|
872
1126
|
</FRBRExpression>
|
873
1127
|
<FRBRManifestation>
|
874
1128
|
<FRBRthis value="/za/act/1980/01/eng@/schedule3"/>
|
875
1129
|
<FRBRuri value="/za/act/1980/01/eng@"/>
|
876
1130
|
<FRBRdate date="#{today}" name="Generation"/>
|
877
|
-
<FRBRauthor href="#slaw"
|
1131
|
+
<FRBRauthor href="#slaw"/>
|
878
1132
|
</FRBRManifestation>
|
879
1133
|
</identification>
|
880
1134
|
</meta>
|
881
1135
|
<mainBody>
|
882
1136
|
<article id="schedule-3">
|
883
1137
|
<heading>Another Title</heading>
|
884
|
-
<
|
885
|
-
<
|
886
|
-
|
887
|
-
|
1138
|
+
<paragraph id="paragraph-0">
|
1139
|
+
<content>
|
1140
|
+
<p>Baz</p>
|
1141
|
+
<p>Boom</p>
|
1142
|
+
</content>
|
1143
|
+
</paragraph>
|
888
1144
|
</article>
|
889
1145
|
</mainBody>
|
890
1146
|
</doc>
|
@@ -906,51 +1162,135 @@ EOS
|
|
906
1162
|
s = to_xml(node)
|
907
1163
|
today = Time.now.strftime('%Y-%m-%d')
|
908
1164
|
s.should == <<EOS
|
909
|
-
<
|
910
|
-
<
|
911
|
-
<
|
912
|
-
<
|
913
|
-
<
|
914
|
-
<
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
<
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
<
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
<
|
938
|
-
<
|
1165
|
+
<component id="component-schedule-1">
|
1166
|
+
<doc name="schedule1">
|
1167
|
+
<meta>
|
1168
|
+
<identification source="#slaw">
|
1169
|
+
<FRBRWork>
|
1170
|
+
<FRBRthis value="/za/act/1980/01/schedule1"/>
|
1171
|
+
<FRBRuri value="/za/act/1980/01"/>
|
1172
|
+
<FRBRalias value="Schedule 1"/>
|
1173
|
+
<FRBRdate date="1980-01-01" name="Generation"/>
|
1174
|
+
<FRBRauthor href="#council"/>
|
1175
|
+
<FRBRcountry value="za"/>
|
1176
|
+
</FRBRWork>
|
1177
|
+
<FRBRExpression>
|
1178
|
+
<FRBRthis value="/za/act/1980/01/eng@/schedule1"/>
|
1179
|
+
<FRBRuri value="/za/act/1980/01/eng@"/>
|
1180
|
+
<FRBRdate date="1980-01-01" name="Generation"/>
|
1181
|
+
<FRBRauthor href="#council"/>
|
1182
|
+
<FRBRlanguage language="eng"/>
|
1183
|
+
</FRBRExpression>
|
1184
|
+
<FRBRManifestation>
|
1185
|
+
<FRBRthis value="/za/act/1980/01/eng@/schedule1"/>
|
1186
|
+
<FRBRuri value="/za/act/1980/01/eng@"/>
|
1187
|
+
<FRBRdate date="#{today}" name="Generation"/>
|
1188
|
+
<FRBRauthor href="#slaw"/>
|
1189
|
+
</FRBRManifestation>
|
1190
|
+
</identification>
|
1191
|
+
</meta>
|
1192
|
+
<mainBody>
|
1193
|
+
<article id="schedule-1">
|
1194
|
+
<paragraph id="paragraph-0">
|
939
1195
|
<content>
|
940
1196
|
<p>Other than as is set out hereinbelow, no signs other than locality bound signs, temporary signs including loose portable sign, estate agents signs, newspaper headline posters and posters (the erection of which must comply with the appropriate schedules pertinent thereto) shall be erected on Municipal owned land.</p>
|
941
|
-
<p>1. Foo</p>
|
942
|
-
<p>2. Bar</p>
|
943
1197
|
</content>
|
944
|
-
</
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
</
|
1198
|
+
</paragraph>
|
1199
|
+
<section id="section-1">
|
1200
|
+
<num>1.</num>
|
1201
|
+
<heading>Foo</heading>
|
1202
|
+
</section>
|
1203
|
+
<section id="section-2">
|
1204
|
+
<num>2.</num>
|
1205
|
+
<heading>Bar</heading>
|
1206
|
+
</section>
|
1207
|
+
</article>
|
1208
|
+
</mainBody>
|
1209
|
+
</doc>
|
1210
|
+
</component>
|
1211
|
+
EOS
|
1212
|
+
.strip
|
1213
|
+
end
|
1214
|
+
|
1215
|
+
it 'should support rich parts, chapters and sections in a schedule' do
|
1216
|
+
node = parse :schedules, <<EOS
|
1217
|
+
Schedule 1
|
1218
|
+
Forms
|
1219
|
+
|
1220
|
+
Part I
|
1221
|
+
Form of authentication statement
|
1222
|
+
|
1223
|
+
This printed impression has been carefully compared by me with the bill which was passed by Parliament and found by me to be a true copy of the bill.
|
1224
|
+
|
1225
|
+
Part II
|
1226
|
+
Form of statement of the President’s assent.
|
1227
|
+
|
1228
|
+
I signify my assent to the bill and a whole bunch of other stuff.
|
1229
|
+
EOS
|
1230
|
+
|
1231
|
+
s = to_xml(node)
|
1232
|
+
today = Time.now.strftime('%Y-%m-%d')
|
1233
|
+
s.should == <<EOS
|
1234
|
+
<component id="component-schedule-1">
|
1235
|
+
<doc name="schedule1">
|
1236
|
+
<meta>
|
1237
|
+
<identification source="#slaw">
|
1238
|
+
<FRBRWork>
|
1239
|
+
<FRBRthis value="/za/act/1980/01/schedule1"/>
|
1240
|
+
<FRBRuri value="/za/act/1980/01"/>
|
1241
|
+
<FRBRalias value="Schedule 1"/>
|
1242
|
+
<FRBRdate date="1980-01-01" name="Generation"/>
|
1243
|
+
<FRBRauthor href="#council"/>
|
1244
|
+
<FRBRcountry value="za"/>
|
1245
|
+
</FRBRWork>
|
1246
|
+
<FRBRExpression>
|
1247
|
+
<FRBRthis value="/za/act/1980/01/eng@/schedule1"/>
|
1248
|
+
<FRBRuri value="/za/act/1980/01/eng@"/>
|
1249
|
+
<FRBRdate date="1980-01-01" name="Generation"/>
|
1250
|
+
<FRBRauthor href="#council"/>
|
1251
|
+
<FRBRlanguage language="eng"/>
|
1252
|
+
</FRBRExpression>
|
1253
|
+
<FRBRManifestation>
|
1254
|
+
<FRBRthis value="/za/act/1980/01/eng@/schedule1"/>
|
1255
|
+
<FRBRuri value="/za/act/1980/01/eng@"/>
|
1256
|
+
<FRBRdate date="#{today}" name="Generation"/>
|
1257
|
+
<FRBRauthor href="#slaw"/>
|
1258
|
+
</FRBRManifestation>
|
1259
|
+
</identification>
|
1260
|
+
</meta>
|
1261
|
+
<mainBody>
|
1262
|
+
<article id="schedule-1">
|
1263
|
+
<heading>Forms</heading>
|
1264
|
+
<part id="part-I">
|
1265
|
+
<num>I</num>
|
1266
|
+
<heading>Form of authentication statement</heading>
|
1267
|
+
<paragraph id="part-I.paragraph-0">
|
1268
|
+
<content>
|
1269
|
+
<p>This printed impression has been carefully compared by me with the bill which was passed by Parliament and found by me to be a true copy of the bill.</p>
|
1270
|
+
</content>
|
1271
|
+
</paragraph>
|
1272
|
+
</part>
|
1273
|
+
<part id="part-II">
|
1274
|
+
<num>II</num>
|
1275
|
+
<heading>Form of statement of the President’s assent.</heading>
|
1276
|
+
<paragraph id="part-II.paragraph-0">
|
1277
|
+
<content>
|
1278
|
+
<p>I signify my assent to the bill and a whole bunch of other stuff.</p>
|
1279
|
+
</content>
|
1280
|
+
</paragraph>
|
1281
|
+
</part>
|
1282
|
+
</article>
|
1283
|
+
</mainBody>
|
1284
|
+
</doc>
|
1285
|
+
</component>
|
949
1286
|
EOS
|
950
1287
|
.strip
|
951
1288
|
end
|
952
1289
|
end
|
953
1290
|
|
1291
|
+
#-------------------------------------------------------------------------------
|
1292
|
+
# tables
|
1293
|
+
|
954
1294
|
describe 'tables' do
|
955
1295
|
it 'should parse basic tables' do
|
956
1296
|
node = parse :table, <<EOS
|
@@ -1022,44 +1362,48 @@ EOS
|
|
1022
1362
|
|
1023
1363
|
xml = to_xml(node, "")
|
1024
1364
|
today = Time.now.strftime('%Y-%m-%d')
|
1025
|
-
xml.should == '<
|
1026
|
-
<
|
1027
|
-
<
|
1028
|
-
<
|
1029
|
-
<
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
<
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
<
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
<
|
1053
|
-
<
|
1054
|
-
<
|
1055
|
-
|
1365
|
+
xml.should == '<component id="component-schedule-1">
|
1366
|
+
<doc name="schedule1">
|
1367
|
+
<meta>
|
1368
|
+
<identification source="#slaw">
|
1369
|
+
<FRBRWork>
|
1370
|
+
<FRBRthis value="/za/act/1980/01/schedule1"/>
|
1371
|
+
<FRBRuri value="/za/act/1980/01"/>
|
1372
|
+
<FRBRalias value="Schedule 1"/>
|
1373
|
+
<FRBRdate date="1980-01-01" name="Generation"/>
|
1374
|
+
<FRBRauthor href="#council"/>
|
1375
|
+
<FRBRcountry value="za"/>
|
1376
|
+
</FRBRWork>
|
1377
|
+
<FRBRExpression>
|
1378
|
+
<FRBRthis value="/za/act/1980/01/eng@/schedule1"/>
|
1379
|
+
<FRBRuri value="/za/act/1980/01/eng@"/>
|
1380
|
+
<FRBRdate date="1980-01-01" name="Generation"/>
|
1381
|
+
<FRBRauthor href="#council"/>
|
1382
|
+
<FRBRlanguage language="eng"/>
|
1383
|
+
</FRBRExpression>
|
1384
|
+
<FRBRManifestation>
|
1385
|
+
<FRBRthis value="/za/act/1980/01/eng@/schedule1"/>
|
1386
|
+
<FRBRuri value="/za/act/1980/01/eng@"/>
|
1387
|
+
<FRBRdate date="' + today + '" name="Generation"/>
|
1388
|
+
<FRBRauthor href="#slaw"/>
|
1389
|
+
</FRBRManifestation>
|
1390
|
+
</identification>
|
1391
|
+
</meta>
|
1392
|
+
<mainBody>
|
1393
|
+
<article id="schedule-1">
|
1394
|
+
<paragraph id="paragraph-0">
|
1395
|
+
<content>
|
1396
|
+
<p>Heres a table:</p>
|
1397
|
+
<table id="table0"><tr><td><p>r1c1</p></td>
|
1056
1398
|
<td><p>r1c2</p></td></tr>
|
1057
1399
|
<tr><td><p>r2c1</p></td>
|
1058
1400
|
<td><p>r2c2</p></td></tr></table>
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
</
|
1401
|
+
</content>
|
1402
|
+
</paragraph>
|
1403
|
+
</article>
|
1404
|
+
</mainBody>
|
1405
|
+
</doc>
|
1406
|
+
</component>'
|
1063
1407
|
end
|
1064
1408
|
end
|
1065
1409
|
|