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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7e4e1c31f5269c58542a2c1d056a1ab82511bb5a
4
- data.tar.gz: 4ac75f3fb309e8fcab15a18044f124d541b0defd
2
+ SHA256:
3
+ metadata.gz: b75cd19574a490445f390f3e9d69d5bbeeca40695948561b7d9acf97f2037d8e
4
+ data.tar.gz: d1752a876bc91b6e41259ec7654871f09b6f05a10175524ffadc68f6d48703ed
5
5
  SHA512:
6
- metadata.gz: c5a7b32e894db4ab6b2d57e6482b6692f19e399a20f2a3ba957d42dbd821fca194da991d96a43057312d64ad01553c0d66974a80cefffa4f86930907deb85ee7
7
- data.tar.gz: 3e0d8fd448fbbe7d5501f48f4bdb5f422aa783b5eaf569f052717bd2793c792f394a66104bcc6cd4f9b62dde5b041baade2a5d2acd514796494a35a79872a0b4
6
+ metadata.gz: 6ab057c83e120e8b6a81159b72b093841e255597fe458b906397200c7f9a471de7947506c0292ae4a40bdfeb03914a15662c9da69289ebac7ba4cfda4c31761f
7
+ data.tar.gz: 39c61307b05a2ded3e0b34072caeb1c1294796537a3f1866f764c64e4b24a585ee9e52863bb53969efcc3bee9cdb90876867d2172a1ba8303eeb190c82cf8828
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.4.3
5
+ before_install:
6
+ - gem install bundler -v 1.16.1
7
+ - unset _JAVA_OPTIONS
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
3
+ #git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in asciidoctor-csd.gemspec
6
6
  gemspec
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- asciidoctor-gb (0.2.3)
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.7.9)
16
+ asciidoctor-iso (0.8.1)
16
17
  asciidoctor (~> 1.5.7)
17
- html2doc
18
18
  isobib (~> 0.1.4)
19
- isodoc (~> 0.6.2)
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.23)
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.7.1)
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.3)
60
+ iso-bib-item (0.1.5)
61
+ duplicate
60
62
  isoics (~> 0.1.6)
61
63
  nokogiri
62
- isobib (0.1.4)
64
+ isobib (0.1.6)
63
65
  algoliasearch
64
66
  iso-bib-item (~> 0.1.2)
65
- isodoc (0.6.2)
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.2)
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.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.56.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.3.3)
160
+ unicode-display_width (1.4.0)
157
161
  uuidtools (2.1.5)
158
162
 
159
163
  PLATFORMS
@@ -27,6 +27,7 @@ Gem::Specification.new do |spec|
27
27
  spec.require_paths = ["lib"]
28
28
 
29
29
  spec.add_dependency "asciidoctor-iso", ">= 0.7.9"
30
+ spec.add_dependency "isodoc", ">= 0.7.0"
30
31
  spec.add_dependency "twitter_cldr"
31
32
 
32
33
  spec.add_development_dependency "bundler", "~> 1.15"
@@ -2,4 +2,5 @@ require "asciidoctor" unless defined? Asciidoctor::Converter
2
2
  require_relative "asciidoctor/gb/converter"
3
3
  require_relative "asciidoctor/gb/version"
4
4
  require "isodoc/gb/gbconvert"
5
+ require "isodoc/gb/gbhtmlconvert"
5
6
  require "isodoc/gb/gbwordconvert"
@@ -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
- <ref name="bfrom"/>
495
+ <element name="from">
496
+ <choice>
497
+ <data type="gYear"/>
498
+ <data type="date"/>
499
+ </choice>
500
+ </element>
495
501
  <optional>
496
- <ref name="bto"/>
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
- <ref name="date_on"/>
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
- agency = IsoDoc::Gb::Convert.new({}).standard_agency1(scope, prefix, mandate) if agency == "GB"
202
- agency = "GB" unless agency
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
- <oneOrMore>
194
+ <zeroOrMore>
195
195
  <ref name="gbcommittee"/>
196
- </oneOrMore>
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
- <text/>
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">
@@ -729,7 +729,7 @@
729
729
  </define>
730
730
  <define name="source">
731
731
  <element name="source">
732
- <data type="anyURI"/>
732
+ <ref name="TypedUri"/>
733
733
  </element>
734
734
  </define>
735
735
  <define name="em">
@@ -72,9 +72,9 @@
72
72
  </oneOrMore>
73
73
  <ref name="formattedref"/>
74
74
  </choice>
75
- <optional>
75
+ <zeroOrMore>
76
76
  <ref name="bsource"/>
77
- </optional>
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
- <optional>
99
+ <zeroOrMore>
100
100
  <ref name="abstract"/>
101
- </optional>
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
- <optional>
133
+ <zeroOrMore>
131
134
  <ref name="bsource"/>
132
- </optional>
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
- <optional>
157
+ <zeroOrMore>
155
158
  <ref name="abstract"/>
156
- </optional>
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="date_on">
170
- <element name="from">
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
- <data type="gYear"/>
173
- <data type="date"/>
174
- <value>--</value>
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
- <text/>
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
@@ -13,7 +13,7 @@ module Asciidoctor
13
13
  bilingual_terms_validate(doc.root)
14
14
  issuer_validate(doc.root)
15
15
  prefix_validate(doc.root)
16
- doc_converter(nil).gbtype_validate(doc.root)
16
+ @agencyclass.gbtype_validate(doc.root)
17
17
  end
18
18
 
19
19
  def prefix_validate(root)
@@ -1,5 +1,5 @@
1
1
  module Asciidoctor
2
2
  module Gb
3
- VERSION = "0.2.4"
3
+ VERSION = "0.2.5"
4
4
  end
5
5
  end
@@ -1,8 +1,12 @@
1
- require "isodoc"
2
-
3
1
  module IsoDoc
4
2
  module Gb
5
- class Convert < IsoDoc::Convert
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