slaw 10.0.0 → 10.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/README.md +21 -0
- data/lib/slaw/extract/extractor.rb +2 -9
- data/lib/slaw/grammars/counters.rb +18 -6
- data/lib/slaw/grammars/inlines.treetop +13 -1
- data/lib/slaw/grammars/inlines_nodes.rb +22 -1
- data/lib/slaw/grammars/za/act_nodes.rb +1 -1
- data/lib/slaw/grammars/za/act_text.xsl +12 -0
- data/lib/slaw/version.rb +1 -1
- data/slaw.gemspec +0 -1
- data/spec/counters_spec.rb +38 -0
- data/spec/za/act_block_spec.rb +51 -51
- data/spec/za/act_inline_spec.rb +60 -23
- data/spec/za/act_schedules_spec.rb +17 -17
- data/spec/za/act_table_spec.rb +3 -3
- metadata +7 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa5a1bf4a3098846a8f22ab9cff0c1a44f376407b9cc9c2f314ec69d9445c073
|
4
|
+
data.tar.gz: 918bc6711f33db010f38c80606a52c7f9ff446778230dcbeafa27d34abc5eceb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1231195c46118f5098b4b31deca137981d03dacdcdb57175c30779cd4abc0339a95d480d3d08962e8d8dfae8d6c67880c1f219867583fe3df15b531391b19086
|
7
|
+
data.tar.gz: 7bdbb9416a5c77eddab03eafef40b8aae830c2bcb71dc2cb4dc15f746be7404fd7122dbc242150e6ae90a9dca4f3a144f59013e3d36d5662de30f815aaf6ab00
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -86,6 +86,27 @@ You can create your own grammar by creating a gem that provides these files and
|
|
86
86
|
|
87
87
|
## Changelog
|
88
88
|
|
89
|
+
### 10.4.1 (14 April 2021)
|
90
|
+
|
91
|
+
* Handle escaping in inlines, so that forward slashes in link text are unescaped correctly, eg `[https:\/\/example.com](https://example.com)`
|
92
|
+
|
93
|
+
### 10.4.0 (9 April 2021)
|
94
|
+
|
95
|
+
* Remove dependency on mimemagic. Guess file type based on filename instead.
|
96
|
+
|
97
|
+
### 10.3.1 (11 January 2021)
|
98
|
+
|
99
|
+
* Strip ascii, unicode general and unicode supplemental punctuation from num elements when building eIds
|
100
|
+
|
101
|
+
### 10.2.0 (4 September 2020)
|
102
|
+
|
103
|
+
* support inline superscript `^^text^^`
|
104
|
+
* support inline subscript `_^text^_`
|
105
|
+
|
106
|
+
### 10.1.0 (18 June 2020)
|
107
|
+
|
108
|
+
* hcontainer elements have name attributes, to be compliant with AKN 3.0
|
109
|
+
|
89
110
|
### 10.0.0 (12 June 2020)
|
90
111
|
|
91
112
|
* BREAKING: Create XML with AKN 3 namespace (http://docs.oasis-open.org/legaldocml/ns/akn/3.0), AKN2 is no longer supported
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'mimemagic'
|
2
|
-
|
3
1
|
module Slaw
|
4
2
|
module Extract
|
5
3
|
|
@@ -13,15 +11,10 @@ module Slaw
|
|
13
11
|
#
|
14
12
|
# @return [String] extracted text
|
15
13
|
def extract_from_file(filename)
|
16
|
-
|
17
|
-
|
18
|
-
case mimetype && mimetype.type
|
19
|
-
when 'text/html'
|
14
|
+
if filename.end_with? '.html' or filename.end_with? '.htm'
|
20
15
|
extract_from_html(filename)
|
21
|
-
when 'text/plain', nil
|
22
|
-
extract_from_text(filename)
|
23
16
|
else
|
24
|
-
|
17
|
+
extract_from_text(filename)
|
25
18
|
end
|
26
19
|
end
|
27
20
|
|
@@ -24,20 +24,32 @@ module Slaw
|
|
24
24
|
# Clean a <num> value for use in an eId
|
25
25
|
# See https://docs.oasis-open.org/legaldocml/akn-nc/v1.0/os/akn-nc-v1.0-os.html#_Toc531692306
|
26
26
|
#
|
27
|
-
# The number part of the identifiers of such elements corresponds to the
|
27
|
+
# "The number part of the identifiers of such elements corresponds to the
|
28
28
|
# stripping of all final punctuation, meaningless separations as well as
|
29
29
|
# redundant characters in the content of the <num> element. The
|
30
|
-
# representation is case-sensitive
|
30
|
+
# representation is case-sensitive."
|
31
|
+
#
|
32
|
+
# Our algorithm is:
|
33
|
+
# 1. strip all leading and trailing whitespace and punctuation (using the unicode punctuation blocks)
|
34
|
+
# 2. strip all whitespace
|
35
|
+
# 3. replace all remaining punctuation with a hyphen.
|
36
|
+
#
|
37
|
+
# The General Punctuation block is \u2000-\u206F, and the Supplemental Punctuation block is \u2E00-\u2E7F.
|
31
38
|
#
|
32
39
|
# (i) -> i
|
33
40
|
# 1.2. -> 1-2
|
41
|
+
# “2.3“ -> 2-3
|
34
42
|
# 3a bis -> 3abis
|
35
43
|
def self.clean(num)
|
44
|
+
# leading whitespace and punctuation
|
45
|
+
num = num.gsub(/^[\s\u{2000}-\u{206f}\u{2e00}-\u{2e7f}!"#$%&'()*+,\-.\/:;<=>?@\[\]^_`{|}~]+/, '')
|
46
|
+
# trailing whitespace and punctuation
|
47
|
+
num.gsub!(/[\s\u{2000}-\u{206f}\u{2e00}-\u{2e7f}!"#$%&'()*+,\-.\/:;<=>?@\[\]^_`{|}~]+$/, '')
|
48
|
+
# whitespace
|
49
|
+
num.gsub!(/\s/, '')
|
50
|
+
# remaining punctuation to a hyphen
|
51
|
+
num.gsub!(/[\u{2000}-\u{206f}\u{2e00}-\u{2e7f}!"#$%&'()*+,\-.\/:;<=>?@\[\]^_`{|}~]+/, '-')
|
36
52
|
num
|
37
|
-
.gsub(/[ ()\[\]]/, '')
|
38
|
-
.gsub(/\.+$/, '')
|
39
|
-
.gsub(/^\.+/, '')
|
40
|
-
.gsub(/\.+/, '-')
|
41
53
|
end
|
42
54
|
end
|
43
55
|
end
|
@@ -20,7 +20,7 @@ module Slaw
|
|
20
20
|
end
|
21
21
|
|
22
22
|
rule inline_item
|
23
|
-
remark / image / ref / bold / italics / [^\n]
|
23
|
+
remark / image / ref / bold / italics / superscript / subscript / [^\n]
|
24
24
|
<InlineItem>
|
25
25
|
end
|
26
26
|
|
@@ -57,6 +57,18 @@ module Slaw
|
|
57
57
|
<Ref>
|
58
58
|
end
|
59
59
|
|
60
|
+
rule superscript
|
61
|
+
# ^^foo^^
|
62
|
+
'^^' content:(!'^^' inline_item)+ '^^'
|
63
|
+
<Superscript>
|
64
|
+
end
|
65
|
+
|
66
|
+
rule subscript
|
67
|
+
# _^foo^_
|
68
|
+
'_^' content:(!'^_' inline_item)+ '^_'
|
69
|
+
<Subscript>
|
70
|
+
end
|
71
|
+
|
60
72
|
end
|
61
73
|
end
|
62
74
|
end
|
@@ -37,7 +37,8 @@ module Slaw
|
|
37
37
|
|
38
38
|
class InlineItem < Treetop::Runtime::SyntaxNode
|
39
39
|
def to_xml(b, idprefix)
|
40
|
-
|
40
|
+
# handle escaped characters foo\/bar -> foo/bar
|
41
|
+
b.text(text_value.gsub(/\\(.)?/, '\1'))
|
41
42
|
end
|
42
43
|
end
|
43
44
|
|
@@ -71,6 +72,26 @@ module Slaw
|
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
75
|
+
class Superscript < Treetop::Runtime::SyntaxNode
|
76
|
+
def to_xml(b, idprefix)
|
77
|
+
b.sup { |b|
|
78
|
+
for e in content.elements
|
79
|
+
e.inline_item.to_xml(b, idprefix)
|
80
|
+
end
|
81
|
+
}
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
class Subscript < Treetop::Runtime::SyntaxNode
|
86
|
+
def to_xml(b, idprefix)
|
87
|
+
b.sub { |b|
|
88
|
+
for e in content.elements
|
89
|
+
e.inline_item.to_xml(b, idprefix)
|
90
|
+
end
|
91
|
+
}
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
74
95
|
end
|
75
96
|
end
|
76
97
|
end
|
@@ -314,7 +314,7 @@ module Slaw
|
|
314
314
|
id = "#{idprefix}hcontainer_#{cnt}"
|
315
315
|
idprefix = "#{id}__"
|
316
316
|
|
317
|
-
b.hcontainer(eId: id) { |b|
|
317
|
+
b.hcontainer(eId: id, name: 'hcontainer') { |b|
|
318
318
|
b.content { |b|
|
319
319
|
elements.each_with_index { |e, i| e.to_xml(b, idprefix, i) }
|
320
320
|
}
|
@@ -275,6 +275,18 @@
|
|
275
275
|
<xsl:text>**</xsl:text>
|
276
276
|
</xsl:template>
|
277
277
|
|
278
|
+
<xsl:template match="a:sup">
|
279
|
+
<xsl:text>^^</xsl:text>
|
280
|
+
<xsl:apply-templates />
|
281
|
+
<xsl:text>^^</xsl:text>
|
282
|
+
</xsl:template>
|
283
|
+
|
284
|
+
<xsl:template match="a:sub">
|
285
|
+
<xsl:text>_^</xsl:text>
|
286
|
+
<xsl:apply-templates />
|
287
|
+
<xsl:text>^_</xsl:text>
|
288
|
+
</xsl:template>
|
289
|
+
|
278
290
|
<xsl:template match="a:eol">
|
279
291
|
<xsl:text> </xsl:text>
|
280
292
|
</xsl:template>
|
data/lib/slaw/version.rb
CHANGED
data/slaw.gemspec
CHANGED
@@ -0,0 +1,38 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
|
5
|
+
require 'slaw'
|
6
|
+
|
7
|
+
describe Slaw::Grammars::Counters do
|
8
|
+
describe '#clean' do
|
9
|
+
it 'should remove leading and trailing punctuation' do
|
10
|
+
described_class.clean("").should == ""
|
11
|
+
described_class.clean(" ").should == ""
|
12
|
+
described_class.clean("( )").should == ""
|
13
|
+
described_class.clean("(123.4-5)").should == "123-4-5"
|
14
|
+
described_class.clean("(312.32.7)").should == "312-32-7"
|
15
|
+
described_class.clean("(312_32_7)").should == "312-32-7"
|
16
|
+
described_class.clean("(6)").should == "6"
|
17
|
+
described_class.clean("[16]").should == "16"
|
18
|
+
described_class.clean("(i)").should == "i"
|
19
|
+
described_class.clean("[i]").should == "i"
|
20
|
+
described_class.clean("(2bis)").should == "2bis"
|
21
|
+
described_class.clean('"1.2.').should == "1-2"
|
22
|
+
described_class.clean("1.2.").should == "1-2"
|
23
|
+
described_class.clean("“2.3").should == "2-3"
|
24
|
+
described_class.clean("2,3").should == "2-3"
|
25
|
+
described_class.clean("2,3, 4,").should == "2-3-4"
|
26
|
+
described_class.clean("3a bis").should == "3abis"
|
27
|
+
described_class.clean("3é").should == "3é"
|
28
|
+
described_class.clean(" -3a--4,9").should == "3a-4-9"
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should handle non-arabic numerals' do
|
32
|
+
# hebrew aleph
|
33
|
+
described_class.clean("(א)").should == "א"
|
34
|
+
# chinese 3
|
35
|
+
described_class.clean("(三)").should == "三"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/spec/za/act_block_spec.rb
CHANGED
@@ -46,7 +46,7 @@ Hello there
|
|
46
46
|
CROSSHEADING crossheading
|
47
47
|
EOS
|
48
48
|
to_xml(node).should == '<body>
|
49
|
-
<hcontainer eId="hcontainer_1">
|
49
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
50
50
|
<content>
|
51
51
|
<p>Some content before the section</p>
|
52
52
|
</content>
|
@@ -54,7 +54,7 @@ EOS
|
|
54
54
|
<section eId="sec_1">
|
55
55
|
<num>1.</num>
|
56
56
|
<heading>Section</heading>
|
57
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
57
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
58
58
|
<content>
|
59
59
|
<p>Hello there</p>
|
60
60
|
</content>
|
@@ -81,7 +81,7 @@ Hello there
|
|
81
81
|
CROSSHEADING crossheading
|
82
82
|
EOS
|
83
83
|
to_xml(node).should == '<body>
|
84
|
-
<hcontainer eId="hcontainer_1">
|
84
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
85
85
|
<content>
|
86
86
|
<p>Some content before the section</p>
|
87
87
|
<blockList eId="hcontainer_1__list_1" renest="true">
|
@@ -102,7 +102,7 @@ EOS
|
|
102
102
|
<section eId="sec_1">
|
103
103
|
<num>1.</num>
|
104
104
|
<heading>Section</heading>
|
105
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
105
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
106
106
|
<content>
|
107
107
|
<p>Hello there</p>
|
108
108
|
</content>
|
@@ -118,13 +118,13 @@ EOS
|
|
118
118
|
node = parse :body, <<EOS
|
119
119
|
\\1. ignored
|
120
120
|
|
121
|
-
\\CROSSHEADING
|
121
|
+
\\CROSSHEADING cross\\heading
|
122
122
|
|
123
|
-
1.
|
123
|
+
1. Sec\\tion
|
124
124
|
\\Chapter 2 ignored
|
125
125
|
EOS
|
126
126
|
to_xml(node).should == '<body>
|
127
|
-
<hcontainer eId="hcontainer_1">
|
127
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
128
128
|
<content>
|
129
129
|
<p>1. ignored</p>
|
130
130
|
<p>CROSSHEADING crossheading</p>
|
@@ -133,7 +133,7 @@ EOS
|
|
133
133
|
<section eId="sec_1">
|
134
134
|
<num>1.</num>
|
135
135
|
<heading>Section</heading>
|
136
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
136
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
137
137
|
<content>
|
138
138
|
<p>Chapter 2 ignored</p>
|
139
139
|
</content>
|
@@ -152,7 +152,7 @@ Some content before the section
|
|
152
152
|
Hello there
|
153
153
|
EOS
|
154
154
|
to_xml(node).should == '<body>
|
155
|
-
<hcontainer eId="hcontainer_1">
|
155
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
156
156
|
<content>
|
157
157
|
<p>Some content before the section</p>
|
158
158
|
</content>
|
@@ -160,7 +160,7 @@ EOS
|
|
160
160
|
<section eId="sec_1">
|
161
161
|
<num>1.</num>
|
162
162
|
<heading>Section</heading>
|
163
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
163
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
164
164
|
<content>
|
165
165
|
<p>Hello there</p>
|
166
166
|
</content>
|
@@ -212,7 +212,7 @@ EOS
|
|
212
212
|
<section eId="sec_1">
|
213
213
|
<num>1.</num>
|
214
214
|
<heading>Section</heading>
|
215
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
215
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
216
216
|
<content>
|
217
217
|
<p>Hello there</p>
|
218
218
|
</content>
|
@@ -233,7 +233,7 @@ EOS
|
|
233
233
|
<section eId="sec_1">
|
234
234
|
<num>1.</num>
|
235
235
|
<heading>Section</heading>
|
236
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
236
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
237
237
|
<content>
|
238
238
|
<p>Hello there</p>
|
239
239
|
</content>
|
@@ -259,7 +259,7 @@ EOS
|
|
259
259
|
<hcontainer eId="chp_2__hcontainer_1" name="crossheading">
|
260
260
|
<heading>crossheading</heading>
|
261
261
|
</hcontainer>
|
262
|
-
<hcontainer eId="chp_2__hcontainer_2">
|
262
|
+
<hcontainer eId="chp_2__hcontainer_2" name="hcontainer">
|
263
263
|
<content>
|
264
264
|
<p>Some lines at the start of the chapter.</p>
|
265
265
|
</content>
|
@@ -282,7 +282,7 @@ EOS
|
|
282
282
|
to_xml(node).should == '<chapter eId="chp_2">
|
283
283
|
<num>2</num>
|
284
284
|
<heading>The Chapter Heading</heading>
|
285
|
-
<hcontainer eId="chp_2__hcontainer_1">
|
285
|
+
<hcontainer eId="chp_2__hcontainer_1" name="hcontainer">
|
286
286
|
<content>
|
287
287
|
<p>Some lines at the start of the chapter.</p>
|
288
288
|
</content>
|
@@ -290,7 +290,7 @@ EOS
|
|
290
290
|
<section eId="sec_1">
|
291
291
|
<num>1.</num>
|
292
292
|
<heading>Section 1</heading>
|
293
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
293
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
294
294
|
<content>
|
295
295
|
<p>Section text.</p>
|
296
296
|
</content>
|
@@ -312,7 +312,7 @@ EOS
|
|
312
312
|
<section eId="sec_1">
|
313
313
|
<num>1.</num>
|
314
314
|
<heading>Section</heading>
|
315
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
315
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
316
316
|
<content>
|
317
317
|
<p>Hello there</p>
|
318
318
|
</content>
|
@@ -335,7 +335,7 @@ EOS
|
|
335
335
|
<section eId="sec_1">
|
336
336
|
<num>1.</num>
|
337
337
|
<heading>Section</heading>
|
338
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
338
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
339
339
|
<content>
|
340
340
|
<p>Hello there</p>
|
341
341
|
</content>
|
@@ -357,7 +357,7 @@ EOS
|
|
357
357
|
<section eId="sec_1">
|
358
358
|
<num>1.</num>
|
359
359
|
<heading>Section</heading>
|
360
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
360
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
361
361
|
<content>
|
362
362
|
<p>Hello there</p>
|
363
363
|
</content>
|
@@ -394,7 +394,7 @@ EOS
|
|
394
394
|
to_xml(node).should == '<chapter eId="chp_2">
|
395
395
|
<num>2</num>
|
396
396
|
<heading>The Chapter</heading>
|
397
|
-
<hcontainer eId="chp_2__hcontainer_1">
|
397
|
+
<hcontainer eId="chp_2__hcontainer_1" name="hcontainer">
|
398
398
|
<content>
|
399
399
|
<table eId="chp_2__hcontainer_1__table_1">
|
400
400
|
<tr>
|
@@ -421,7 +421,7 @@ EOS
|
|
421
421
|
to_xml(node).should == '<chapter eId="chp_1">
|
422
422
|
<num>1</num>
|
423
423
|
<heading>The Chapter</heading>
|
424
|
-
<hcontainer eId="chp_1__hcontainer_1">
|
424
|
+
<hcontainer eId="chp_1__hcontainer_1" name="hcontainer">
|
425
425
|
<content>
|
426
426
|
<p>Stuff</p>
|
427
427
|
<p>Chapter 2 - Ignored</p>
|
@@ -449,7 +449,7 @@ EOS
|
|
449
449
|
<part eId="chp_1__part_1">
|
450
450
|
<num>1</num>
|
451
451
|
<heading>Chapter One Part One</heading>
|
452
|
-
<hcontainer eId="chp_1__part_1__hcontainer_1">
|
452
|
+
<hcontainer eId="chp_1__part_1__hcontainer_1" name="hcontainer">
|
453
453
|
<content>
|
454
454
|
<p>one-one</p>
|
455
455
|
</content>
|
@@ -458,7 +458,7 @@ EOS
|
|
458
458
|
<part eId="chp_1__part_2">
|
459
459
|
<num>2</num>
|
460
460
|
<heading>Chapter One Part Two</heading>
|
461
|
-
<hcontainer eId="chp_1__part_2__hcontainer_1">
|
461
|
+
<hcontainer eId="chp_1__part_2__hcontainer_1" name="hcontainer">
|
462
462
|
<content>
|
463
463
|
<p>one-two</p>
|
464
464
|
</content>
|
@@ -491,7 +491,7 @@ EOS
|
|
491
491
|
<section eId="sec_1">
|
492
492
|
<num>1.</num>
|
493
493
|
<heading>Section</heading>
|
494
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
494
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
495
495
|
<content>
|
496
496
|
<p>Hello there</p>
|
497
497
|
</content>
|
@@ -512,7 +512,7 @@ EOS
|
|
512
512
|
<section eId="sec_1">
|
513
513
|
<num>1.</num>
|
514
514
|
<heading>Section</heading>
|
515
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
515
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
516
516
|
<content>
|
517
517
|
<p>Hello there</p>
|
518
518
|
</content>
|
@@ -533,7 +533,7 @@ EOS
|
|
533
533
|
<section eId="sec_1">
|
534
534
|
<num>1.</num>
|
535
535
|
<heading>Section</heading>
|
536
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
536
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
537
537
|
<content>
|
538
538
|
<p>Hello there</p>
|
539
539
|
</content>
|
@@ -554,7 +554,7 @@ EOS
|
|
554
554
|
<section eId="sec_1">
|
555
555
|
<num>1.</num>
|
556
556
|
<heading>Section</heading>
|
557
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
557
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
558
558
|
<content>
|
559
559
|
<p>Hello there</p>
|
560
560
|
</content>
|
@@ -576,7 +576,7 @@ EOS
|
|
576
576
|
<section eId="sec_1">
|
577
577
|
<num>1.</num>
|
578
578
|
<heading>Section</heading>
|
579
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
579
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
580
580
|
<content>
|
581
581
|
<p>Hello there</p>
|
582
582
|
</content>
|
@@ -598,7 +598,7 @@ EOS
|
|
598
598
|
<section eId="sec_1">
|
599
599
|
<num>1.</num>
|
600
600
|
<heading>Section</heading>
|
601
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
601
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
602
602
|
<content>
|
603
603
|
<p>Hello there</p>
|
604
604
|
</content>
|
@@ -619,7 +619,7 @@ EOS
|
|
619
619
|
<section eId="sec_1">
|
620
620
|
<num>1.</num>
|
621
621
|
<heading>Section</heading>
|
622
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
622
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
623
623
|
<content>
|
624
624
|
<p>Hello there</p>
|
625
625
|
</content>
|
@@ -642,7 +642,7 @@ EOS
|
|
642
642
|
<section eId="sec_1">
|
643
643
|
<num>1.</num>
|
644
644
|
<heading/>
|
645
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
645
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
646
646
|
<content>
|
647
647
|
<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>
|
648
648
|
</content>
|
@@ -666,7 +666,7 @@ EOS
|
|
666
666
|
to_xml(node).should == '<part eId="part_2">
|
667
667
|
<num>2</num>
|
668
668
|
<heading>The Part Heading</heading>
|
669
|
-
<hcontainer eId="part_2__hcontainer_1">
|
669
|
+
<hcontainer eId="part_2__hcontainer_1" name="hcontainer">
|
670
670
|
<content>
|
671
671
|
<p>Some text before the part.</p>
|
672
672
|
</content>
|
@@ -674,7 +674,7 @@ EOS
|
|
674
674
|
<section eId="sec_1">
|
675
675
|
<num>1.</num>
|
676
676
|
<heading>Section</heading>
|
677
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
677
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
678
678
|
<content>
|
679
679
|
<p>Hello there</p>
|
680
680
|
</content>
|
@@ -709,7 +709,7 @@ EOS
|
|
709
709
|
<part eId="part_2">
|
710
710
|
<num>2</num>
|
711
711
|
<heading>The Part Heading</heading>
|
712
|
-
<hcontainer eId="part_2__hcontainer_1">
|
712
|
+
<hcontainer eId="part_2__hcontainer_1" name="hcontainer">
|
713
713
|
<content>
|
714
714
|
<p>Part 3 ignored</p>
|
715
715
|
</content>
|
@@ -736,7 +736,7 @@ EOS
|
|
736
736
|
<chapter eId="part_1__chp_1">
|
737
737
|
<num>1</num>
|
738
738
|
<heading>Part One Chapter One</heading>
|
739
|
-
<hcontainer eId="part_1__chp_1__hcontainer_1">
|
739
|
+
<hcontainer eId="part_1__chp_1__hcontainer_1" name="hcontainer">
|
740
740
|
<content>
|
741
741
|
<p>one-one</p>
|
742
742
|
</content>
|
@@ -745,7 +745,7 @@ EOS
|
|
745
745
|
<chapter eId="part_1__chp_2">
|
746
746
|
<num>2</num>
|
747
747
|
<heading>Part One Chapter Two</heading>
|
748
|
-
<hcontainer eId="part_1__chp_2__hcontainer_1">
|
748
|
+
<hcontainer eId="part_1__chp_2__hcontainer_1" name="hcontainer">
|
749
749
|
<content>
|
750
750
|
<p>one-two</p>
|
751
751
|
</content>
|
@@ -772,7 +772,7 @@ EOS
|
|
772
772
|
<section eId="sec_1">
|
773
773
|
<num>1.</num>
|
774
774
|
<heading>Section</heading>
|
775
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
775
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
776
776
|
<content>
|
777
777
|
<p>Hello there</p>
|
778
778
|
</content>
|
@@ -806,7 +806,7 @@ EOS
|
|
806
806
|
<section eId="sec_1">
|
807
807
|
<num>1.</num>
|
808
808
|
<heading>Section</heading>
|
809
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
809
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
810
810
|
<content>
|
811
811
|
<p>Hello</p>
|
812
812
|
</content>
|
@@ -819,7 +819,7 @@ EOS
|
|
819
819
|
<section eId="sec_2">
|
820
820
|
<num>2.</num>
|
821
821
|
<heading>Section</heading>
|
822
|
-
<hcontainer eId="sec_2__hcontainer_1">
|
822
|
+
<hcontainer eId="sec_2__hcontainer_1" name="hcontainer">
|
823
823
|
<content>
|
824
824
|
<p>Bye</p>
|
825
825
|
</content>
|
@@ -841,7 +841,7 @@ EOS
|
|
841
841
|
<section eId="sec_1">
|
842
842
|
<num>1.</num>
|
843
843
|
<heading>Section</heading>
|
844
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
844
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
845
845
|
<content>
|
846
846
|
<p>Hello there</p>
|
847
847
|
</content>
|
@@ -1417,7 +1417,7 @@ EOS
|
|
1417
1417
|
<p>this is in the preamble</p>
|
1418
1418
|
</preamble>'
|
1419
1419
|
to_xml(node.body).should == '<body>
|
1420
|
-
<hcontainer eId="hcontainer_1">
|
1420
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
1421
1421
|
<content>
|
1422
1422
|
<p>this is in the body</p>
|
1423
1423
|
</content>
|
@@ -1507,7 +1507,7 @@ this is actually in the body
|
|
1507
1507
|
EOS
|
1508
1508
|
|
1509
1509
|
to_xml(node.body).should == '<body>
|
1510
|
-
<hcontainer eId="hcontainer_1">
|
1510
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
1511
1511
|
<content>
|
1512
1512
|
<p>PREAMBLE</p>
|
1513
1513
|
<p>this is actually in the body</p>
|
@@ -1528,7 +1528,7 @@ this is actually in the body
|
|
1528
1528
|
EOS
|
1529
1529
|
|
1530
1530
|
to_xml(node.body).should == '<body>
|
1531
|
-
<hcontainer eId="hcontainer_1">
|
1531
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
1532
1532
|
<content>
|
1533
1533
|
<p>PREFACE</p>
|
1534
1534
|
<p>this is actually in the body</p>
|
@@ -1652,7 +1652,7 @@ EOS
|
|
1652
1652
|
s.should == '<section eId="sec_1">
|
1653
1653
|
<num>1.</num>
|
1654
1654
|
<heading>Section</heading>
|
1655
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
1655
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1656
1656
|
<content>
|
1657
1657
|
<blockList eId="sec_1__hcontainer_1__list_1" renest="true">
|
1658
1658
|
<item eId="sec_1__hcontainer_1__list_1__item_a">
|
@@ -1682,7 +1682,7 @@ EOS
|
|
1682
1682
|
s.should == '<section eId="sec_1">
|
1683
1683
|
<num>1.</num>
|
1684
1684
|
<heading>Section <b>bold</b> <ref href="/za/act/1990/1">foo</ref></heading>
|
1685
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
1685
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1686
1686
|
<content>
|
1687
1687
|
<p>something</p>
|
1688
1688
|
</content>
|
@@ -1703,7 +1703,7 @@ EOS
|
|
1703
1703
|
s.should == '<section eId="sec_1">
|
1704
1704
|
<num>1.</num>
|
1705
1705
|
<heading>Section <b>bold</b> <ref href="/za/act/1990/1">foo</ref></heading>
|
1706
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
1706
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1707
1707
|
<content>
|
1708
1708
|
<p>something</p>
|
1709
1709
|
</content>
|
@@ -1729,7 +1729,7 @@ EOS
|
|
1729
1729
|
to_xml(node, "").should == '<section eId="sec_1">
|
1730
1730
|
<num>1.</num>
|
1731
1731
|
<heading>Section</heading>
|
1732
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
1732
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1733
1733
|
<content>
|
1734
1734
|
<p>naked statement (c) blah</p>
|
1735
1735
|
<blockList eId="sec_1__hcontainer_1__list_1" renest="true">
|
@@ -1801,7 +1801,7 @@ EOS
|
|
1801
1801
|
to_xml(node, "").should == '<section eId="sec_1">
|
1802
1802
|
<num>1.</num>
|
1803
1803
|
<heading>Section</heading>
|
1804
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
1804
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1805
1805
|
<content>
|
1806
1806
|
<p>1. ignored</p>
|
1807
1807
|
<p>2. another line</p>
|
@@ -1823,7 +1823,7 @@ EOS
|
|
1823
1823
|
to_xml(node, "").should == '<section eId="sec_1">
|
1824
1824
|
<num>1.</num>
|
1825
1825
|
<heading>Section</heading>
|
1826
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
1826
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1827
1827
|
<content>
|
1828
1828
|
<p>stuff</p>
|
1829
1829
|
</content>
|
@@ -1926,7 +1926,7 @@ Text
|
|
1926
1926
|
<section eId="sec_1">
|
1927
1927
|
<num>1.</num>
|
1928
1928
|
<heading>Section 1</heading>
|
1929
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
1929
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1930
1930
|
<content>
|
1931
1931
|
<p>Text</p>
|
1932
1932
|
</content>
|
@@ -1989,7 +1989,7 @@ Text
|
|
1989
1989
|
<section eId="sec_1">
|
1990
1990
|
<num>1.</num>
|
1991
1991
|
<heading>Section 1</heading>
|
1992
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
1992
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
1993
1993
|
<content>
|
1994
1994
|
<p>Text</p>
|
1995
1995
|
</content>
|
@@ -2060,7 +2060,7 @@ EOS
|
|
2060
2060
|
<section eId="sec_1">
|
2061
2061
|
<num>1.</num>
|
2062
2062
|
<heading>Section</heading>
|
2063
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
2063
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
2064
2064
|
<content>
|
2065
2065
|
<p>LONGTITLE a long title</p>
|
2066
2066
|
</content>
|
data/spec/za/act_inline_spec.rb
CHANGED
@@ -61,7 +61,7 @@ describe Slaw::ActGenerator do
|
|
61
61
|
node = parse :generic_container, <<EOS
|
62
62
|
[[Section 2 amended by Act 23 of 2004]]
|
63
63
|
EOS
|
64
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
64
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
65
65
|
<content>
|
66
66
|
<p>
|
67
67
|
<remark status="editorial">[Section 2 amended by Act 23 of 2004]</remark>
|
@@ -74,7 +74,7 @@ EOS
|
|
74
74
|
node = parse :generic_container, <<EOS
|
75
75
|
This statement has an inline remark. [[Section 2 amended by Act 23 of 2004]]
|
76
76
|
EOS
|
77
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
77
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
78
78
|
<content>
|
79
79
|
<p>This statement has an inline remark. <remark status="editorial">[Section 2 amended by Act 23 of 2004]</remark></p>
|
80
80
|
</content>
|
@@ -97,7 +97,7 @@ EOS
|
|
97
97
|
node = parse :generic_container, <<EOS
|
98
98
|
This statement has an inline remark. [[Section 2 amended by Act 23 of 2004]]. And now some more. [[Another remark]] [[and another]]
|
99
99
|
EOS
|
100
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
100
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
101
101
|
<content>
|
102
102
|
<p>This statement has an inline remark. <remark status="editorial">[Section 2 amended by Act 23 of 2004]</remark>. And now some more. <remark status="editorial">[Another remark]</remark> <remark status="editorial">[and another]</remark></p>
|
103
103
|
</content>
|
@@ -114,7 +114,7 @@ EOS
|
|
114
114
|
to_xml(node).should == '<section eId="sec_1">
|
115
115
|
<num>1.</num>
|
116
116
|
<heading>Section title</heading>
|
117
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
117
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
118
118
|
<content>
|
119
119
|
<p>Some text is a long line.</p>
|
120
120
|
<p>
|
@@ -136,7 +136,7 @@ EOS
|
|
136
136
|
to_xml(node).should == '<section eId="sec_1">
|
137
137
|
<num>1.</num>
|
138
138
|
<heading>Section title</heading>
|
139
|
-
<hcontainer eId="sec_1__hcontainer_1">
|
139
|
+
<hcontainer eId="sec_1__hcontainer_1" name="hcontainer">
|
140
140
|
<content>
|
141
141
|
<p>Some text is a long line.</p>
|
142
142
|
</content>
|
@@ -197,7 +197,7 @@ EOS
|
|
197
197
|
</identification>
|
198
198
|
</meta>
|
199
199
|
<mainBody>
|
200
|
-
<hcontainer eId="hcontainer_1">
|
200
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
201
201
|
<content>
|
202
202
|
<p>
|
203
203
|
<remark status="editorial">[Schedule 1 added by Act 23 of 2004]</remark>
|
@@ -214,7 +214,7 @@ EOS
|
|
214
214
|
node = parse :generic_container, <<EOS
|
215
215
|
Remark [[with **bold** and //italics// and [a ref](/a/b)]].
|
216
216
|
EOS
|
217
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
217
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
218
218
|
<content>
|
219
219
|
<p>Remark <remark status="editorial">[with <b>bold</b> and <i>italics</i> and <ref href="/a/b">a ref</ref>]</remark>.</p>
|
220
220
|
</content>
|
@@ -230,7 +230,7 @@ EOS
|
|
230
230
|
node = parse :generic_container, <<EOS
|
231
231
|
Hello [there](/za/act/123) friend.
|
232
232
|
EOS
|
233
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
233
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
234
234
|
<content>
|
235
235
|
<p>Hello <ref href="/za/act/123">there</ref> friend.</p>
|
236
236
|
</content>
|
@@ -241,7 +241,7 @@ EOS
|
|
241
241
|
node = parse :generic_container, <<EOS
|
242
242
|
Hello [there](/za/act/123) friend [and](http://foo.bar.com/with space) you too.
|
243
243
|
EOS
|
244
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
244
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
245
245
|
<content>
|
246
246
|
<p>Hello <ref href="/za/act/123">there</ref> friend <ref href="http://foo.bar.com/with space">and</ref> you too.</p>
|
247
247
|
</content>
|
@@ -252,7 +252,7 @@ EOS
|
|
252
252
|
node = parse :generic_container, <<EOS
|
253
253
|
Hello ([there](/za/act/123)).
|
254
254
|
EOS
|
255
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
255
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
256
256
|
<content>
|
257
257
|
<p>Hello (<ref href="/za/act/123">there</ref>).</p>
|
258
258
|
</content>
|
@@ -263,7 +263,7 @@ EOS
|
|
263
263
|
node = parse :generic_container, <<EOS
|
264
264
|
Hello [there](/za/act/123)[[remark one]] my[friend](/za) [[remark 2]][end](/foo).
|
265
265
|
EOS
|
266
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
266
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
267
267
|
<content>
|
268
268
|
<p>Hello <ref href="/za/act/123">there</ref><remark status="editorial">[remark one]</remark> my<ref href="/za">friend</ref> <remark status="editorial">[remark 2]</remark><ref href="/foo">end</ref>.</p>
|
269
269
|
</content>
|
@@ -276,7 +276,7 @@ EOS
|
|
276
276
|
|
277
277
|
my](/za/act/123) friend.
|
278
278
|
EOS
|
279
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
279
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
280
280
|
<content>
|
281
281
|
<p>Hello [there</p>
|
282
282
|
<p>my](/za/act/123) friend.</p>
|
@@ -289,7 +289,7 @@ EOS
|
|
289
289
|
Hello [there](/za/act
|
290
290
|
/123) friend.
|
291
291
|
EOS
|
292
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
292
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
293
293
|
<content>
|
294
294
|
<p>Hello [there](/za/act</p>
|
295
295
|
<p>/123) friend.</p>
|
@@ -301,7 +301,7 @@ EOS
|
|
301
301
|
node = parse :generic_container, <<EOS
|
302
302
|
2.18.1 a traffic officer appointed in terms of section 3 of the Road Traffic [Act, No. 29 of 1989](/za/act/1989/29) or section 3A of the National Road Traffic [Act No. 93 of 1996](/za/act/1996/93) as the case may be;
|
303
303
|
EOS
|
304
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
304
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
305
305
|
<content>
|
306
306
|
<blockList eId="hcontainer_1__list_1" renest="true">
|
307
307
|
<item eId="hcontainer_1__list_1__item_2-18-1">
|
@@ -319,12 +319,23 @@ EOS
|
|
319
319
|
This statement has [[[a link in](/foo/bar) a remark]]
|
320
320
|
This statement has [[a [link in a remark](/foo/bar)]]
|
321
321
|
EOS
|
322
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
322
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
323
323
|
<content>
|
324
324
|
<p>This statement has <remark status="editorial">[a <ref href="/foo/bar">link in</ref> a remark]</remark></p>
|
325
325
|
<p>This statement has <remark status="editorial">[<ref href="/foo/bar">a link in</ref> a remark]</remark></p>
|
326
326
|
<p>This statement has <remark status="editorial">[a <ref href="/foo/bar">link in a remark</ref>]</remark></p>
|
327
327
|
</content>
|
328
|
+
</hcontainer>'
|
329
|
+
end
|
330
|
+
|
331
|
+
it 'should handle escapes in links' do
|
332
|
+
node = parse :generic_container, <<EOS
|
333
|
+
Visit the site [https:\\/\\/example.com](https://example.com) for more.
|
334
|
+
EOS
|
335
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
336
|
+
<content>
|
337
|
+
<p>Visit the site <ref href="https://example.com">https://example.com</ref> for more.</p>
|
338
|
+
</content>
|
328
339
|
</hcontainer>'
|
329
340
|
end
|
330
341
|
end
|
@@ -337,7 +348,7 @@ EOS
|
|
337
348
|
node = parse :generic_container, <<EOS
|
338
349
|
Hello ![title](media/foo.png) friend.
|
339
350
|
EOS
|
340
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
351
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
341
352
|
<content>
|
342
353
|
<p>Hello <img src="media/foo.png" alt="title"/> friend.</p>
|
343
354
|
</content>
|
@@ -348,7 +359,7 @@ EOS
|
|
348
359
|
node = parse :generic_container, <<EOS
|
349
360
|
Hello ![title](media/foo.png) friend and ![](media/bar.png) a second.
|
350
361
|
EOS
|
351
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
362
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
352
363
|
<content>
|
353
364
|
<p>Hello <img src="media/foo.png" alt="title"/> friend and <img src="media/bar.png"/> a second.</p>
|
354
365
|
</content>
|
@@ -383,7 +394,7 @@ EOS
|
|
383
394
|
node = parse :generic_container, <<EOS
|
384
395
|
Hello **something bold** foo
|
385
396
|
EOS
|
386
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
397
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
387
398
|
<content>
|
388
399
|
<p>Hello <b>something bold</b> foo</p>
|
389
400
|
</content>
|
@@ -398,7 +409,7 @@ EOS
|
|
398
409
|
A **[link**](/a/b)**
|
399
410
|
A **[link**](/a/b)
|
400
411
|
EOS
|
401
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
412
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
402
413
|
<content>
|
403
414
|
<p>A <ref href="/a/b"><b>link</b></ref> with bold</p>
|
404
415
|
<p>This is <b>bold with <ref href="/a/b">a link</ref></b> end</p>
|
@@ -421,7 +432,7 @@ EOS
|
|
421
432
|
* * foo * *
|
422
433
|
** foo * *
|
423
434
|
EOS
|
424
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
435
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
425
436
|
<content>
|
426
437
|
<p>Hello **something</p>
|
427
438
|
<p>New line**</p>
|
@@ -442,7 +453,7 @@ EOS
|
|
442
453
|
node = parse :generic_container, <<EOS
|
443
454
|
Hello //something italics// foo
|
444
455
|
EOS
|
445
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
456
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
446
457
|
<content>
|
447
458
|
<p>Hello <i>something italics</i> foo</p>
|
448
459
|
</content>
|
@@ -458,7 +469,7 @@ EOS
|
|
458
469
|
A //[link//](/a/b)//
|
459
470
|
A //[link//](/a/b)
|
460
471
|
EOS
|
461
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
472
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
462
473
|
<content>
|
463
474
|
<p>A <ref href="/a/b"><i>link</i></ref> with italics</p>
|
464
475
|
<p>This is <i>italics with <ref href="/a/b">a link</ref></i> end</p>
|
@@ -482,7 +493,7 @@ EOS
|
|
482
493
|
/ / foo / /
|
483
494
|
// foo / /
|
484
495
|
EOS
|
485
|
-
to_xml(node, "").should == '<hcontainer eId="hcontainer_1">
|
496
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
486
497
|
<content>
|
487
498
|
<p>Hello //something</p>
|
488
499
|
<p>New line//</p>
|
@@ -498,4 +509,30 @@ EOS
|
|
498
509
|
end
|
499
510
|
end
|
500
511
|
|
512
|
+
describe 'superscript' do
|
513
|
+
it 'should handle superscript' do
|
514
|
+
node = parse :generic_container, <<EOS
|
515
|
+
Hello ^^super **bold** ^^ foo
|
516
|
+
EOS
|
517
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
518
|
+
<content>
|
519
|
+
<p>Hello <sup>super <b>bold</b> </sup> foo</p>
|
520
|
+
</content>
|
521
|
+
</hcontainer>'
|
522
|
+
end
|
523
|
+
end
|
524
|
+
|
525
|
+
describe 'subscript' do
|
526
|
+
it 'should handle subscript' do
|
527
|
+
node = parse :generic_container, <<EOS
|
528
|
+
Hello _^sub **bold** ^_ foo
|
529
|
+
EOS
|
530
|
+
to_xml(node, "").should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
531
|
+
<content>
|
532
|
+
<p>Hello <sub>sub <b>bold</b> </sub> foo</p>
|
533
|
+
</content>
|
534
|
+
</hcontainer>'
|
535
|
+
end
|
536
|
+
end
|
537
|
+
|
501
538
|
end
|
@@ -129,7 +129,7 @@ EOS
|
|
129
129
|
</identification>
|
130
130
|
</meta>
|
131
131
|
<mainBody>
|
132
|
-
<hcontainer eId="hcontainer_1">
|
132
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
133
133
|
<content>
|
134
134
|
<p>Baz</p>
|
135
135
|
<p>Boom</p>
|
@@ -186,7 +186,7 @@ EOS
|
|
186
186
|
</identification>
|
187
187
|
</meta>
|
188
188
|
<mainBody>
|
189
|
-
<hcontainer eId="hcontainer_1">
|
189
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
190
190
|
<content>
|
191
191
|
<p>Subject to approval in terms of this By-Law, the erection:</p>
|
192
192
|
</content>
|
@@ -246,7 +246,7 @@ EOS
|
|
246
246
|
</identification>
|
247
247
|
</meta>
|
248
248
|
<mainBody>
|
249
|
-
<hcontainer eId="hcontainer_1">
|
249
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
250
250
|
<content>
|
251
251
|
<p>Subject to approval in terms of this By-Law, the erection:</p>
|
252
252
|
</content>
|
@@ -304,7 +304,7 @@ EOS
|
|
304
304
|
</identification>
|
305
305
|
</meta>
|
306
306
|
<mainBody>
|
307
|
-
<hcontainer eId="hcontainer_1">
|
307
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
308
308
|
<content>
|
309
309
|
<p>Subject to approval in terms of this By-Law, the erection:</p>
|
310
310
|
</content>
|
@@ -375,7 +375,7 @@ EOS
|
|
375
375
|
<part eId="part_I">
|
376
376
|
<num>I</num>
|
377
377
|
<heading>Form of authentication statement</heading>
|
378
|
-
<hcontainer eId="part_I__hcontainer_1">
|
378
|
+
<hcontainer eId="part_I__hcontainer_1" name="hcontainer">
|
379
379
|
<content>
|
380
380
|
<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>
|
381
381
|
</content>
|
@@ -384,7 +384,7 @@ EOS
|
|
384
384
|
<part eId="part_II">
|
385
385
|
<num>II</num>
|
386
386
|
<heading>Form of statement of the President’s assent.</heading>
|
387
|
-
<hcontainer eId="part_II__hcontainer_1">
|
387
|
+
<hcontainer eId="part_II__hcontainer_1" name="hcontainer">
|
388
388
|
<content>
|
389
389
|
<p>I signify my assent to the bill and a whole bunch of other stuff.</p>
|
390
390
|
</content>
|
@@ -447,7 +447,7 @@ EOS
|
|
447
447
|
</identification>
|
448
448
|
</meta>
|
449
449
|
<mainBody>
|
450
|
-
<hcontainer eId="hcontainer_1">
|
450
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
451
451
|
<content>
|
452
452
|
<p>Subject to approval in terms of this By-Law.</p>
|
453
453
|
<p>Schedule another</p>
|
@@ -499,7 +499,7 @@ EOS
|
|
499
499
|
</identification>
|
500
500
|
</meta>
|
501
501
|
<mainBody>
|
502
|
-
<hcontainer eId="hcontainer_1">
|
502
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
503
503
|
<content>
|
504
504
|
<p>Subject to approval in terms of this By-Law.</p>
|
505
505
|
</content>
|
@@ -550,7 +550,7 @@ EOS
|
|
550
550
|
</identification>
|
551
551
|
</meta>
|
552
552
|
<mainBody>
|
553
|
-
<hcontainer eId="hcontainer_1">
|
553
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
554
554
|
<content>
|
555
555
|
<p>Subject to approval in terms of this By-Law, the erection:</p>
|
556
556
|
</content>
|
@@ -608,7 +608,7 @@ EOS
|
|
608
608
|
</identification>
|
609
609
|
</meta>
|
610
610
|
<mainBody>
|
611
|
-
<hcontainer eId="hcontainer_1">
|
611
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
612
612
|
<content>
|
613
613
|
<p>Subject to approval in terms of this By-Law, the erection:</p>
|
614
614
|
</content>
|
@@ -665,7 +665,7 @@ EOS
|
|
665
665
|
</identification>
|
666
666
|
</meta>
|
667
667
|
<mainBody>
|
668
|
-
<hcontainer eId="hcontainer_1">
|
668
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
669
669
|
<content>
|
670
670
|
<p>Subject to approval in terms of this By-Law, the erection:</p>
|
671
671
|
</content>
|
@@ -770,7 +770,7 @@ EOS
|
|
770
770
|
</identification>
|
771
771
|
</meta>
|
772
772
|
<mainBody>
|
773
|
-
<hcontainer eId="hcontainer_1">
|
773
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
774
774
|
<content>
|
775
775
|
<p>Baz</p>
|
776
776
|
<p>Boom</p>
|
@@ -826,7 +826,7 @@ EOS
|
|
826
826
|
</identification>
|
827
827
|
</meta>
|
828
828
|
<mainBody>
|
829
|
-
<hcontainer eId="hcontainer_1">
|
829
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
830
830
|
<content>
|
831
831
|
<p>Subject to approval in terms of this By-Law, the erection:</p>
|
832
832
|
</content>
|
@@ -885,7 +885,7 @@ EOS
|
|
885
885
|
</identification>
|
886
886
|
</meta>
|
887
887
|
<mainBody>
|
888
|
-
<hcontainer eId="hcontainer_1">
|
888
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
889
889
|
<content>
|
890
890
|
<p>Subject to approval in terms of this By-Law, the erection:</p>
|
891
891
|
</content>
|
@@ -942,7 +942,7 @@ EOS
|
|
942
942
|
</identification>
|
943
943
|
</meta>
|
944
944
|
<mainBody>
|
945
|
-
<hcontainer eId="hcontainer_1">
|
945
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
946
946
|
<content>
|
947
947
|
<p>Subject to approval in terms of this By-Law, the erection:</p>
|
948
948
|
</content>
|
@@ -1001,7 +1001,7 @@ EOS
|
|
1001
1001
|
</identification>
|
1002
1002
|
</meta>
|
1003
1003
|
<mainBody>
|
1004
|
-
<hcontainer eId="hcontainer_1">
|
1004
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
1005
1005
|
<content>
|
1006
1006
|
<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>
|
1007
1007
|
</content>
|
@@ -1060,7 +1060,7 @@ EOS
|
|
1060
1060
|
</identification>
|
1061
1061
|
</meta>
|
1062
1062
|
<mainBody>
|
1063
|
-
<hcontainer eId="hcontainer_1">
|
1063
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
1064
1064
|
<content>
|
1065
1065
|
<p>Subject to approval in terms of this By-Law.</p>
|
1066
1066
|
</content>
|
data/spec/za/act_table_spec.rb
CHANGED
@@ -226,7 +226,7 @@ EOS
|
|
226
226
|
xml.should == '<section eId="sec_10">
|
227
227
|
<num>10.</num>
|
228
228
|
<heading>A section title</heading>
|
229
|
-
<hcontainer eId="sec_10__hcontainer_1">
|
229
|
+
<hcontainer eId="sec_10__hcontainer_1" name="hcontainer">
|
230
230
|
<content>
|
231
231
|
<p>Heres a table:</p>
|
232
232
|
<table eId="sec_10__hcontainer_1__table_1">
|
@@ -298,7 +298,7 @@ EOS
|
|
298
298
|
</identification>
|
299
299
|
</meta>
|
300
300
|
<mainBody>
|
301
|
-
<hcontainer eId="hcontainer_1">
|
301
|
+
<hcontainer eId="hcontainer_1" name="hcontainer">
|
302
302
|
<content>
|
303
303
|
<p>Heres a table:</p>
|
304
304
|
<table eId="hcontainer_1__table_1">
|
@@ -334,7 +334,7 @@ EOS
|
|
334
334
|
|}
|
335
335
|
EOS
|
336
336
|
|
337
|
-
to_xml(node).should == '<hcontainer eId="hcontainer_1">
|
337
|
+
to_xml(node).should == '<hcontainer eId="hcontainer_1" name="hcontainer">
|
338
338
|
<content>
|
339
339
|
<p>{|</p>
|
340
340
|
<p>| r1c1</p>
|
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: 10.
|
4
|
+
version: 10.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Kempe
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -94,20 +94,6 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.20'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: mimemagic
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0.2'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0.2'
|
111
97
|
description: Slaw is a lightweight library for rendering and generating Akoma Ntoso
|
112
98
|
acts from plain text and PDF documents.
|
113
99
|
email:
|
@@ -155,6 +141,7 @@ files:
|
|
155
141
|
- lib/slaw/version.rb
|
156
142
|
- lib/slaw/xml_support.rb
|
157
143
|
- slaw.gemspec
|
144
|
+
- spec/counters_spec.rb
|
158
145
|
- spec/extract/extractor_spec.rb
|
159
146
|
- spec/fixtures/community-fire-safety.xml
|
160
147
|
- spec/generator_spec.rb
|
@@ -172,7 +159,7 @@ homepage: https://github.com/longhotsummer/slaw
|
|
172
159
|
licenses:
|
173
160
|
- MIT
|
174
161
|
metadata: {}
|
175
|
-
post_install_message:
|
162
|
+
post_install_message:
|
176
163
|
rdoc_options: []
|
177
164
|
require_paths:
|
178
165
|
- lib
|
@@ -188,10 +175,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
188
175
|
version: '0'
|
189
176
|
requirements: []
|
190
177
|
rubygems_version: 3.0.3
|
191
|
-
signing_key:
|
178
|
+
signing_key:
|
192
179
|
specification_version: 4
|
193
180
|
summary: A lightweight library for using Akoma Ntoso acts in Ruby.
|
194
181
|
test_files:
|
182
|
+
- spec/counters_spec.rb
|
195
183
|
- spec/extract/extractor_spec.rb
|
196
184
|
- spec/fixtures/community-fire-safety.xml
|
197
185
|
- spec/generator_spec.rb
|