asciidoctor-gb 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +7 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +18 -14
- data/asciidoctor-gb.gemspec +1 -0
- data/lib/asciidoctor-gb.rb +1 -0
- data/lib/asciidoctor/gb/biblio.rng +19 -3
- data/lib/asciidoctor/gb/converter.rb +3 -2
- data/lib/asciidoctor/gb/gbstandard.rng +10 -3
- data/lib/asciidoctor/gb/isodoc.rng +1 -1
- data/lib/asciidoctor/gb/isostandard.rng +63 -14
- data/lib/asciidoctor/gb/section_input.rb +2 -0
- data/lib/asciidoctor/gb/validate.rb +1 -1
- data/lib/asciidoctor/gb/version.rb +1 -1
- data/lib/isodoc/gb/agencies.rb +16 -8
- data/lib/isodoc/gb/gbcleanup.rb +6 -3
- data/lib/isodoc/gb/gbconvert.rb +22 -112
- data/lib/isodoc/gb/gbhtmlconvert.rb +73 -0
- data/lib/isodoc/gb/gbhtmlrender.rb +206 -0
- data/lib/isodoc/gb/gbwordconvert.rb +69 -6
- data/lib/isodoc/gb/gbwordrender.rb +206 -0
- data/lib/isodoc/gb/html/htmlstyle.scss +1 -1
- data/lib/isodoc/gb/metadata.rb +57 -56
- metadata +21 -7
- data/lib/isodoc/gb/block_output.rb +0 -86
- data/lib/isodoc/gb/i18n.rb +0 -20
- data/lib/isodoc/gb/section_output.rb +0 -57
- data/lib/isodoc/gb/xref_gen.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b75cd19574a490445f390f3e9d69d5bbeeca40695948561b7d9acf97f2037d8e
|
4
|
+
data.tar.gz: d1752a876bc91b6e41259ec7654871f09b6f05a10175524ffadc68f6d48703ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ab057c83e120e8b6a81159b72b093841e255597fe458b906397200c7f9a471de7947506c0292ae4a40bdfeb03914a15662c9da69289ebac7ba4cfda4c31761f
|
7
|
+
data.tar.gz: 39c61307b05a2ded3e0b34072caeb1c1294796537a3f1866f764c64e4b24a585ee9e52863bb53969efcc3bee9cdb90876867d2172a1ba8303eeb190c82cf8828
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
asciidoctor-gb (0.2.
|
4
|
+
asciidoctor-gb (0.2.4)
|
5
5
|
asciidoctor-iso (>= 0.7.9)
|
6
|
+
isodoc (>= 0.7.0)
|
6
7
|
twitter_cldr
|
7
8
|
|
8
9
|
GEM
|
@@ -12,11 +13,10 @@ GEM
|
|
12
13
|
httpclient (~> 2.8, >= 2.8.3)
|
13
14
|
json (>= 1.5.1)
|
14
15
|
asciidoctor (1.5.7.1)
|
15
|
-
asciidoctor-iso (0.
|
16
|
+
asciidoctor-iso (0.8.1)
|
16
17
|
asciidoctor (~> 1.5.7)
|
17
|
-
html2doc
|
18
18
|
isobib (~> 0.1.4)
|
19
|
-
isodoc (
|
19
|
+
isodoc (>= 0.7.0)
|
20
20
|
ruby-jing
|
21
21
|
asciimath (1.0.4)
|
22
22
|
ast (2.4.0)
|
@@ -26,9 +26,10 @@ GEM
|
|
26
26
|
coderay (1.1.2)
|
27
27
|
diff-lcs (1.3)
|
28
28
|
docile (1.3.1)
|
29
|
+
duplicate (1.1.1)
|
29
30
|
equivalent-xml (0.6.0)
|
30
31
|
nokogiri (>= 1.4.3)
|
31
|
-
ffi (1.9.
|
32
|
+
ffi (1.9.25)
|
32
33
|
formatador (0.2.5)
|
33
34
|
guard (2.14.2)
|
34
35
|
formatador (>= 0.2.4)
|
@@ -44,7 +45,7 @@ GEM
|
|
44
45
|
guard (~> 2.1)
|
45
46
|
guard-compat (~> 1.1)
|
46
47
|
rspec (>= 2.99.0, < 4.0)
|
47
|
-
html2doc (0.
|
48
|
+
html2doc (0.8.0)
|
48
49
|
asciimath
|
49
50
|
htmlentities (~> 4.3.4)
|
50
51
|
image_size
|
@@ -56,15 +57,16 @@ GEM
|
|
56
57
|
htmlentities (4.3.4)
|
57
58
|
httpclient (2.8.3)
|
58
59
|
image_size (2.0.0)
|
59
|
-
iso-bib-item (0.1.
|
60
|
+
iso-bib-item (0.1.5)
|
61
|
+
duplicate
|
60
62
|
isoics (~> 0.1.6)
|
61
63
|
nokogiri
|
62
|
-
isobib (0.1.
|
64
|
+
isobib (0.1.6)
|
63
65
|
algoliasearch
|
64
66
|
iso-bib-item (~> 0.1.2)
|
65
|
-
isodoc (0.
|
67
|
+
isodoc (0.7.1)
|
66
68
|
asciimath
|
67
|
-
html2doc
|
69
|
+
html2doc (>= 0.7.1)
|
68
70
|
htmlentities (~> 4.3.4)
|
69
71
|
image_size
|
70
72
|
liquid
|
@@ -76,6 +78,7 @@ GEM
|
|
76
78
|
thread_safe
|
77
79
|
uuidtools
|
78
80
|
isoics (0.1.6)
|
81
|
+
jaro_winkler (1.5.1)
|
79
82
|
json (2.1.0)
|
80
83
|
liquid (4.0.0)
|
81
84
|
listen (3.1.5)
|
@@ -89,7 +92,7 @@ GEM
|
|
89
92
|
mime-types-data (3.2016.0521)
|
90
93
|
mini_portile2 (2.3.0)
|
91
94
|
nenv (0.3.0)
|
92
|
-
nokogiri (1.8.
|
95
|
+
nokogiri (1.8.3)
|
93
96
|
mini_portile2 (~> 2.3.0)
|
94
97
|
notiffany (0.1.1)
|
95
98
|
nenv (~> 0.1)
|
@@ -98,7 +101,7 @@ GEM
|
|
98
101
|
parallel (1.12.1)
|
99
102
|
parser (2.5.1.0)
|
100
103
|
ast (~> 2.4.0)
|
101
|
-
powerpack (0.1.
|
104
|
+
powerpack (0.1.2)
|
102
105
|
pry (0.11.3)
|
103
106
|
coderay (~> 1.1.0)
|
104
107
|
method_source (~> 0.9.0)
|
@@ -121,7 +124,8 @@ GEM
|
|
121
124
|
diff-lcs (>= 1.2.0, < 2.0)
|
122
125
|
rspec-support (~> 3.7.0)
|
123
126
|
rspec-support (3.7.1)
|
124
|
-
rubocop (0.
|
127
|
+
rubocop (0.57.2)
|
128
|
+
jaro_winkler (~> 1.5.1)
|
125
129
|
parallel (~> 1.10)
|
126
130
|
parser (>= 2.5)
|
127
131
|
powerpack (~> 0.1)
|
@@ -153,7 +157,7 @@ GEM
|
|
153
157
|
tzinfo
|
154
158
|
tzinfo (1.2.5)
|
155
159
|
thread_safe (~> 0.1)
|
156
|
-
unicode-display_width (1.
|
160
|
+
unicode-display_width (1.4.0)
|
157
161
|
uuidtools (2.1.5)
|
158
162
|
|
159
163
|
PLATFORMS
|
data/asciidoctor-gb.gemspec
CHANGED
data/lib/asciidoctor-gb.rb
CHANGED
@@ -489,14 +489,30 @@
|
|
489
489
|
<value>issued</value>
|
490
490
|
</choice>
|
491
491
|
</attribute>
|
492
|
+
<!-- ( ( bfrom, bto? ) | date_on ) -->
|
492
493
|
<choice>
|
493
494
|
<group>
|
494
|
-
<
|
495
|
+
<element name="from">
|
496
|
+
<choice>
|
497
|
+
<data type="gYear"/>
|
498
|
+
<data type="date"/>
|
499
|
+
</choice>
|
500
|
+
</element>
|
495
501
|
<optional>
|
496
|
-
<
|
502
|
+
<element name="to">
|
503
|
+
<choice>
|
504
|
+
<data type="gYear"/>
|
505
|
+
<data type="date"/>
|
506
|
+
</choice>
|
507
|
+
</element>
|
497
508
|
</optional>
|
498
509
|
</group>
|
499
|
-
<
|
510
|
+
<element name="on">
|
511
|
+
<choice>
|
512
|
+
<data type="gYear"/>
|
513
|
+
<data type="date"/>
|
514
|
+
</choice>
|
515
|
+
</element>
|
500
516
|
</choice>
|
501
517
|
</element>
|
502
518
|
</define>
|
@@ -198,8 +198,9 @@ module Asciidoctor
|
|
198
198
|
mandate = xmldoc.at("//gbmandate")&.text || "mandatory"
|
199
199
|
lang = xmldoc.at("//language")&.text
|
200
200
|
agency = issuer.content
|
201
|
-
|
202
|
-
agency = "GB"
|
201
|
+
@agencyclass = IsoDoc::Gb::Agencies.new(lang, {}, "")
|
202
|
+
agency = @agencyclass.standard_agency1(scope, prefix, mandate) if agency == "GB"
|
203
|
+
agency = "GB" if agency.nil? || agency.empty?
|
203
204
|
owner = xmldoc.at("//copyright/owner/organization/name")
|
204
205
|
owner.content = agency
|
205
206
|
owner = xmldoc.at("//contributor[role/@type = 'issuer']/organization/name")
|
@@ -191,9 +191,9 @@
|
|
191
191
|
<zeroOrMore>
|
192
192
|
<ref name="ics"/>
|
193
193
|
</zeroOrMore>
|
194
|
-
<
|
194
|
+
<zeroOrMore>
|
195
195
|
<ref name="gbcommittee"/>
|
196
|
-
</
|
196
|
+
</zeroOrMore>
|
197
197
|
<ref name="gbtype"/>
|
198
198
|
<oneOrMore>
|
199
199
|
<ref name="gbccs"/>
|
@@ -308,7 +308,14 @@
|
|
308
308
|
</define>
|
309
309
|
<define name="gbccs">
|
310
310
|
<element name="ccs">
|
311
|
-
<
|
311
|
+
<element name="code">
|
312
|
+
<text/>
|
313
|
+
</element>
|
314
|
+
<optional>
|
315
|
+
<element name="text">
|
316
|
+
<text/>
|
317
|
+
</element>
|
318
|
+
</optional>
|
312
319
|
</element>
|
313
320
|
</define>
|
314
321
|
<define name="gbplannumber">
|
@@ -72,9 +72,9 @@
|
|
72
72
|
</oneOrMore>
|
73
73
|
<ref name="formattedref"/>
|
74
74
|
</choice>
|
75
|
-
<
|
75
|
+
<zeroOrMore>
|
76
76
|
<ref name="bsource"/>
|
77
|
-
</
|
77
|
+
</zeroOrMore>
|
78
78
|
<zeroOrMore>
|
79
79
|
<ref name="docidentifier"/>
|
80
80
|
</zeroOrMore>
|
@@ -96,9 +96,9 @@
|
|
96
96
|
<zeroOrMore>
|
97
97
|
<ref name="script"/>
|
98
98
|
</zeroOrMore>
|
99
|
-
<
|
99
|
+
<zeroOrMore>
|
100
100
|
<ref name="abstract"/>
|
101
|
-
</
|
101
|
+
</zeroOrMore>
|
102
102
|
<optional>
|
103
103
|
<ref name="status"/>
|
104
104
|
</optional>
|
@@ -114,6 +114,9 @@
|
|
114
114
|
<zeroOrMore>
|
115
115
|
<ref name="ics"/>
|
116
116
|
</zeroOrMore>
|
117
|
+
<optional>
|
118
|
+
<ref name="allParts"/>
|
119
|
+
</optional>
|
117
120
|
</define>
|
118
121
|
<define name="BibData">
|
119
122
|
<optional>
|
@@ -127,9 +130,9 @@
|
|
127
130
|
<optional>
|
128
131
|
<ref name="formattedref"/>
|
129
132
|
</optional>
|
130
|
-
<
|
133
|
+
<zeroOrMore>
|
131
134
|
<ref name="bsource"/>
|
132
|
-
</
|
135
|
+
</zeroOrMore>
|
133
136
|
<zeroOrMore>
|
134
137
|
<ref name="docidentifier"/>
|
135
138
|
</zeroOrMore>
|
@@ -151,9 +154,9 @@
|
|
151
154
|
<zeroOrMore>
|
152
155
|
<ref name="script"/>
|
153
156
|
</zeroOrMore>
|
154
|
-
<
|
157
|
+
<zeroOrMore>
|
155
158
|
<ref name="abstract"/>
|
156
|
-
</
|
159
|
+
</zeroOrMore>
|
157
160
|
<optional>
|
158
161
|
<ref name="status"/>
|
159
162
|
</optional>
|
@@ -165,13 +168,49 @@
|
|
165
168
|
<zeroOrMore>
|
166
169
|
<ref name="ics"/>
|
167
170
|
</zeroOrMore>
|
171
|
+
<optional>
|
172
|
+
<ref name="allParts"/>
|
173
|
+
</optional>
|
168
174
|
</define>
|
169
|
-
<define name="
|
170
|
-
<element name="
|
175
|
+
<define name="bdate">
|
176
|
+
<element name="date">
|
177
|
+
<attribute name="type">
|
178
|
+
<choice>
|
179
|
+
<value>published</value>
|
180
|
+
<value>accessed</value>
|
181
|
+
<value>created</value>
|
182
|
+
<value>implemented</value>
|
183
|
+
<value>obsoleted</value>
|
184
|
+
<value>confirmed</value>
|
185
|
+
<value>updated</value>
|
186
|
+
<value>issued</value>
|
187
|
+
</choice>
|
188
|
+
</attribute>
|
189
|
+
<!-- ( ( bfrom, bto? ) | date_on ) -->
|
171
190
|
<choice>
|
172
|
-
<
|
173
|
-
|
174
|
-
|
191
|
+
<group>
|
192
|
+
<element name="from">
|
193
|
+
<choice>
|
194
|
+
<data type="gYear"/>
|
195
|
+
<data type="date"/>
|
196
|
+
</choice>
|
197
|
+
</element>
|
198
|
+
<optional>
|
199
|
+
<element name="to">
|
200
|
+
<choice>
|
201
|
+
<data type="gYear"/>
|
202
|
+
<data type="date"/>
|
203
|
+
</choice>
|
204
|
+
</element>
|
205
|
+
</optional>
|
206
|
+
</group>
|
207
|
+
<element name="on">
|
208
|
+
<choice>
|
209
|
+
<data type="gYear"/>
|
210
|
+
<data type="date"/>
|
211
|
+
<value>--</value>
|
212
|
+
</choice>
|
213
|
+
</element>
|
175
214
|
</choice>
|
176
215
|
</element>
|
177
216
|
</define>
|
@@ -819,6 +858,11 @@
|
|
819
858
|
<ref name="FormattedString"/>
|
820
859
|
</element>
|
821
860
|
</define>
|
861
|
+
<define name="allParts">
|
862
|
+
<element name="allParts">
|
863
|
+
<data type="boolean"/>
|
864
|
+
</element>
|
865
|
+
</define>
|
822
866
|
<define name="clause-hanging-paragraph-with-footnote">
|
823
867
|
<element name="clause">
|
824
868
|
<optional>
|
@@ -872,7 +916,12 @@
|
|
872
916
|
</define>
|
873
917
|
<define name="ics">
|
874
918
|
<element name="ics">
|
875
|
-
<
|
919
|
+
<element name="code">
|
920
|
+
<text/>
|
921
|
+
</element>
|
922
|
+
<element name="text">
|
923
|
+
<text/>
|
924
|
+
</element>
|
876
925
|
</element>
|
877
926
|
</define>
|
878
927
|
<define name="term-clause">
|
@@ -44,6 +44,8 @@ module Asciidoctor
|
|
44
44
|
else
|
45
45
|
if @term_def then term_def_subclause_parse(a, xml, node)
|
46
46
|
elsif @biblio then bibliography_parse(a, xml, node)
|
47
|
+
elsif node.attr("style") == "bibliography" && node.level == 1
|
48
|
+
bibliography_parse(a, xml, node)
|
47
49
|
elsif node.attr("style") == "appendix" && node.level == 1
|
48
50
|
annex_parse(a, xml, node)
|
49
51
|
else
|
data/lib/isodoc/gb/agencies.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
-
require "isodoc"
|
2
|
-
|
3
1
|
module IsoDoc
|
4
2
|
module Gb
|
5
|
-
class
|
3
|
+
class Agencies
|
4
|
+
def initialize(lang, labels, issuer)
|
5
|
+
@lang = lang
|
6
|
+
@labels = labels
|
7
|
+
@issuer = issuer
|
8
|
+
end
|
9
|
+
|
6
10
|
SECTOR = { "zh" => {
|
7
11
|
AQ: { industry: "安全生产", admin: "国家安全生产管理局" },
|
8
12
|
BB: { industry: "包装", admin: "国家发改委" },
|
@@ -270,8 +274,8 @@ module IsoDoc
|
|
270
274
|
when "local"
|
271
275
|
"#{LOCAL&.dig(@lang, prefix.to_sym) || 'XXXX'}#{@labels["local_standard"]}"
|
272
276
|
when "enterprise"
|
273
|
-
issuer = get_metadata[:issuer]
|
274
|
-
"#{issuer}#{@labels["enterprise_standard"]}"
|
277
|
+
#issuer = get_metadata[:issuer]
|
278
|
+
"#{@issuer}#{@labels["enterprise_standard"]}"
|
275
279
|
when "social-group" then @labels["social_standard"]
|
276
280
|
when "professional" then "PROFESSIONAL STANDARD" # TODO
|
277
281
|
end
|
@@ -280,14 +284,17 @@ module IsoDoc
|
|
280
284
|
def standard_agency1(scope, prefix, mandate)
|
281
285
|
case scope
|
282
286
|
when "national"
|
283
|
-
NATIONAL&.dig(@lang, gb_mandate_suffix(prefix, mandate).to_sym,
|
287
|
+
ret = NATIONAL&.dig(@lang, gb_mandate_suffix(prefix, mandate).to_sym,
|
284
288
|
:admin) || nil
|
289
|
+
ret = ret.join(" ") if ret && ret.is_a?(Array)
|
290
|
+
ret
|
285
291
|
when "sector"
|
286
292
|
SECTOR&.dig(@lang, prefix.to_sym, :admin) || nil
|
287
293
|
when "local"
|
288
294
|
LOCAL&.dig(@lang, prefix.to_sym) || nil
|
289
295
|
when "enterprise", "social-group"
|
290
|
-
get_metadata[:issuer] || nil
|
296
|
+
#get_metadata[:issuer] || nil
|
297
|
+
@issuer || nil
|
291
298
|
when "professional" then "PROFESSIONAL STANDARD" # TODO
|
292
299
|
end
|
293
300
|
end
|
@@ -302,7 +309,8 @@ module IsoDoc
|
|
302
309
|
when "local"
|
303
310
|
"#{LOCAL&.dig(@lang, prefix.to_sym) || 'XXXX'}#{@labels["local_issuer"]}"
|
304
311
|
when "enterprise", "social-group"
|
305
|
-
get_metadata[:issuer]
|
312
|
+
#get_metadata[:issuer]
|
313
|
+
@issuer
|
306
314
|
when "professional" then "PROFESSIONAL STANDARD" # TODO
|
307
315
|
end
|
308
316
|
end
|