metanorma-gb 1.1.5 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +12 -10
- data/appveyor.yml +7 -2
- data/lib/asciidoctor/gb/biblio.rng +44 -15
- data/lib/asciidoctor/gb/converter.rb +1 -1
- data/lib/asciidoctor/gb/front.rb +47 -32
- data/lib/asciidoctor/gb/gbstandard.rng +11 -147
- data/lib/asciidoctor/gb/isodoc.rng +128 -71
- data/lib/asciidoctor/gb/isostandard.rng +29 -304
- data/lib/asciidoctor/gb/reqt.rng +5 -0
- data/lib/asciidoctor/gb/section_input.rb +1 -1
- data/lib/asciidoctor/gb/validate.rb +24 -6
- data/lib/isodoc/gb/{gbhtmlrender.rb → gbbaseconvert.rb} +64 -50
- data/lib/isodoc/gb/gbhtmlconvert.rb +26 -45
- data/lib/isodoc/gb/gbwordconvert.rb +40 -51
- data/lib/isodoc/gb/metadata.rb +15 -15
- data/lib/metanorma/gb/version.rb +1 -1
- data/metanorma-gb.gemspec +3 -2
- metadata +8 -9
- data/lib/isodoc/gb/gbwordrender.rb +0 -243
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faa5a74a5e395476f72512ceb84fa2f53d6b135241265e5818eeb81f414dc1ae
|
4
|
+
data.tar.gz: 9cda1dcf6ada3b0bffa425978378d7f77e09a4087dde2e8cfa7fe7a8b59b4978
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4af0b6817d3406eaab0822a454ac290f7178cf8bfb3acc4840548d3cf09fc74ddd2b447ec43ef36047c0260c711ae813da52c762de8fe4da8ed8ce5fb45b266c
|
7
|
+
data.tar.gz: 3ce009a898bde748c8ecd7fd0335670fe88d383c5c45087327077601a62dcb4dada8cc241afe1f4bf0148a220ea2828e47868ff941f955c6e5c87b9722b442b5
|
data/.travis.yml
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Auto-generated !!! Do not edit it manually
|
2
|
+
# use ci-master https://github.com/metanorma/metanorma-build-scripts
|
3
3
|
language: ruby
|
4
|
+
cache: bundler
|
5
|
+
os:
|
6
|
+
- linux
|
7
|
+
- osx
|
4
8
|
rvm:
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
- unset _JAVA_OPTIONS
|
9
|
+
- 2.5
|
10
|
+
- 2.4
|
11
|
+
- ruby-head
|
12
|
+
before_install:
|
13
|
+
- gem install bundler -v 2.0.1
|
14
|
+
- bundle update
|
12
15
|
matrix:
|
13
16
|
allow_failures:
|
14
17
|
- rvm: ruby-head
|
15
|
-
|
data/appveyor.yml
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
+
# Auto-generated !!! Do not edit it manually
|
2
|
+
# use ci-master https://github.com/metanorma/metanorma-build-scripts
|
1
3
|
version: '{build}'
|
2
4
|
|
5
|
+
cache:
|
6
|
+
- vendor/bundle
|
7
|
+
|
3
8
|
environment:
|
4
9
|
matrix:
|
5
10
|
- RUBY_VERSION: 25
|
6
11
|
- RUBY_VERSION: 24
|
7
|
-
- RUBY_VERSION: 23
|
8
12
|
- RUBY_VERSION: _trunk
|
9
13
|
|
10
14
|
matrix:
|
@@ -17,6 +21,8 @@ install:
|
|
17
21
|
|
18
22
|
build_script:
|
19
23
|
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
24
|
+
- set GIT_TERMINAL_PROMPT=0
|
25
|
+
- bundle config --local path vendor/bundle
|
20
26
|
- bundle update
|
21
27
|
- bundle install
|
22
28
|
|
@@ -27,4 +33,3 @@ before_test:
|
|
27
33
|
|
28
34
|
test_script:
|
29
35
|
- bundle exec rake
|
30
|
-
|
@@ -35,7 +35,28 @@
|
|
35
35
|
</define>
|
36
36
|
<define name="status">
|
37
37
|
<element name="status">
|
38
|
-
<ref name="
|
38
|
+
<ref name="stage"/>
|
39
|
+
<optional>
|
40
|
+
<ref name="substage"/>
|
41
|
+
</optional>
|
42
|
+
<optional>
|
43
|
+
<ref name="iteration"/>
|
44
|
+
</optional>
|
45
|
+
</element>
|
46
|
+
</define>
|
47
|
+
<define name="stage">
|
48
|
+
<element name="stage">
|
49
|
+
<text/>
|
50
|
+
</element>
|
51
|
+
</define>
|
52
|
+
<define name="substage">
|
53
|
+
<element name="substage">
|
54
|
+
<text/>
|
55
|
+
</element>
|
56
|
+
</define>
|
57
|
+
<define name="iteration">
|
58
|
+
<element name="iteration">
|
59
|
+
<text/>
|
39
60
|
</element>
|
40
61
|
</define>
|
41
62
|
<define name="language">
|
@@ -523,9 +544,9 @@
|
|
523
544
|
<zeroOrMore>
|
524
545
|
<ref name="script"/>
|
525
546
|
</zeroOrMore>
|
526
|
-
<
|
547
|
+
<zeroOrMore>
|
527
548
|
<ref name="abstract"/>
|
528
|
-
</
|
549
|
+
</zeroOrMore>
|
529
550
|
<optional>
|
530
551
|
<ref name="status"/>
|
531
552
|
</optional>
|
@@ -636,22 +657,27 @@
|
|
636
657
|
<ref name="ISO8601Date"/>
|
637
658
|
</optional>
|
638
659
|
</define>
|
660
|
+
<define name="BibliographicDateType">
|
661
|
+
<choice>
|
662
|
+
<value>published</value>
|
663
|
+
<value>accessed</value>
|
664
|
+
<value>created</value>
|
665
|
+
<value>implemented</value>
|
666
|
+
<value>obsoleted</value>
|
667
|
+
<value>confirmed</value>
|
668
|
+
<value>updated</value>
|
669
|
+
<value>issued</value>
|
670
|
+
<value>transmitted</value>
|
671
|
+
<value>copied</value>
|
672
|
+
<value>unchanged</value>
|
673
|
+
<value>circulated</value>
|
674
|
+
</choice>
|
675
|
+
</define>
|
639
676
|
<define name="bdate">
|
640
677
|
<element name="date">
|
641
678
|
<attribute name="type">
|
642
679
|
<choice>
|
643
|
-
<
|
644
|
-
<value>accessed</value>
|
645
|
-
<value>created</value>
|
646
|
-
<value>implemented</value>
|
647
|
-
<value>obsoleted</value>
|
648
|
-
<value>confirmed</value>
|
649
|
-
<value>updated</value>
|
650
|
-
<value>issued</value>
|
651
|
-
<value>transmitted</value>
|
652
|
-
<value>copied</value>
|
653
|
-
<value>unchanged</value>
|
654
|
-
<value>circulated</value>
|
680
|
+
<ref name="BibliographicDateType"/>
|
655
681
|
<text/>
|
656
682
|
</choice>
|
657
683
|
</attribute>
|
@@ -805,6 +831,9 @@
|
|
805
831
|
</define>
|
806
832
|
<define name="biblionote">
|
807
833
|
<element name="note">
|
834
|
+
<optional>
|
835
|
+
<attribute name="type"/>
|
836
|
+
</optional>
|
808
837
|
<ref name="FormattedString"/>
|
809
838
|
</element>
|
810
839
|
</define>
|
@@ -207,7 +207,7 @@ module Asciidoctor
|
|
207
207
|
mand = xmldoc.at("//gbmandate")&.text || "mandatory"
|
208
208
|
idtext = @agencyclass.docidentifier(scope, prefix, mand, nil, id.text)
|
209
209
|
id.content = idtext&.gsub(/\ /, " ")
|
210
|
-
id = xmldoc.at("//bibdata/
|
210
|
+
id = xmldoc.at("//bibdata/ext/structuredidentifier/"\
|
211
211
|
"project-number") or return
|
212
212
|
idtext = @agencyclass.docidentifier(scope, prefix, mand, nil, id.text)
|
213
213
|
id.content = idtext&.gsub(/\ /, " ")
|
data/lib/asciidoctor/gb/front.rb
CHANGED
@@ -2,21 +2,14 @@
|
|
2
2
|
module Asciidoctor
|
3
3
|
module Gb
|
4
4
|
class Converter < ISO::Converter
|
5
|
-
def
|
5
|
+
def doctype(node)
|
6
6
|
type = node.attr("mandate") || "mandatory"
|
7
7
|
type = "standard" if type == "mandatory"
|
8
8
|
type = "recommendation" if type == "recommended"
|
9
9
|
type
|
10
10
|
end
|
11
11
|
|
12
|
-
def
|
13
|
-
xml.bibdata **attr_code(type: standard_type(node)) do |b|
|
14
|
-
metadata node, b
|
15
|
-
end
|
16
|
-
metadata_version(node, xml)
|
17
|
-
end
|
18
|
-
|
19
|
-
def metadata_author(node, xml)
|
12
|
+
def metadata_author_personal(node, xml)
|
20
13
|
author = node.attr("author") || return
|
21
14
|
author.split(/, ?/).each do |author|
|
22
15
|
xml.contributor do |c|
|
@@ -55,6 +48,7 @@ module Asciidoctor
|
|
55
48
|
end
|
56
49
|
|
57
50
|
def metadata_committee(node, xml)
|
51
|
+
return unless node.attr("technical-committee")
|
58
52
|
attrs = { type: node.attr("technical-committee-type") }
|
59
53
|
xml.gbcommittee **attr_code(attrs) do |a|
|
60
54
|
a << node.attr("technical-committee")
|
@@ -82,6 +76,11 @@ module Asciidoctor
|
|
82
76
|
end
|
83
77
|
end
|
84
78
|
|
79
|
+
def metadata_relations(node, xml)
|
80
|
+
metadata_equivalence(node, xml)
|
81
|
+
metadata_obsoletes(node, xml)
|
82
|
+
end
|
83
|
+
|
85
84
|
def metadata_obsoletes(node, xml)
|
86
85
|
std = node.attr("obsoletes") || return
|
87
86
|
m = /^(?<code>[^,]+),?(?<title>.*)$/.match std
|
@@ -158,14 +157,17 @@ module Asciidoctor
|
|
158
157
|
l && xml.plannumber { |plan| plan << l }
|
159
158
|
end
|
160
159
|
|
161
|
-
def
|
162
|
-
|
160
|
+
def metadata_author(node, xml)
|
161
|
+
metadata_author_personal(node, xml)
|
163
162
|
metadata_contributor1(node, xml, "author-committee", "author")
|
164
163
|
i = 2
|
165
164
|
while node.attr("author-committee_#{i}") do
|
166
165
|
metadata_contributor1(node, xml, "author-committee_#{i}", "author")
|
167
166
|
i += 1
|
168
167
|
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def metadata_publisher(node, xml)
|
169
171
|
metadata_contributor1(node, xml, "publisher", "publisher")
|
170
172
|
metadata_contributor1(node, xml, "authority", "authority")
|
171
173
|
metadata_contributor1(node, xml, "proposer", "proposer")
|
@@ -178,7 +180,11 @@ module Asciidoctor
|
|
178
180
|
dn = add_id_parts(node.attr("docnumber"), part, nil)
|
179
181
|
dn = id_stage_prefix(dn, node)
|
180
182
|
xml.docidentifier dn, **attr_code(type: "gb")
|
181
|
-
|
183
|
+
end
|
184
|
+
|
185
|
+
def structured_id(node, xml)
|
186
|
+
part = node.attr("partnumber")
|
187
|
+
xml.structuredidentifier do |i|
|
182
188
|
i.project_number node.attr("docnumber"),
|
183
189
|
**attr_code(part: part)
|
184
190
|
end
|
@@ -202,52 +208,61 @@ module Asciidoctor
|
|
202
208
|
dn
|
203
209
|
end
|
204
210
|
|
205
|
-
def
|
206
|
-
title node, xml
|
207
|
-
metadata_source(node, xml)
|
208
|
-
metadata_id(node, xml)
|
209
|
-
metadata_date(node, xml)
|
210
|
-
metadata_contributors(node, xml)
|
211
|
+
def metadata_language(node, xml)
|
211
212
|
xml.language (node.attr("language") || "zh")
|
213
|
+
end
|
214
|
+
|
215
|
+
def metadata_script(node, xml)
|
212
216
|
xml.script (node.attr("script") || "Hans")
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
metadata_ics(node, xml)
|
217
|
+
end
|
218
|
+
|
219
|
+
def metadata_ext(node, xml)
|
220
|
+
metadata_doctype(node, xml)
|
218
221
|
metadata_committee(node, xml)
|
222
|
+
metadata_ics(node, xml)
|
223
|
+
structured_id(node, xml)
|
219
224
|
metadata_gbtype(node, xml)
|
220
225
|
metadata_gblibraryids(node, xml)
|
221
226
|
end
|
222
227
|
|
228
|
+
def title_full(node, lang, t, at)
|
229
|
+
title = node.attr("title-main-#{lang}")
|
230
|
+
intro = node.attr("title-intro-#{lang}")
|
231
|
+
part = node.attr("title-part-#{lang}")
|
232
|
+
title = "#{intro} -- #{title}" if intro
|
233
|
+
title = "#{title} -- #{part}" if part
|
234
|
+
t.title **attr_code(at.merge(type: "main")) do |t1|
|
235
|
+
t1 << asciidoc_sub(title)
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
223
239
|
def title_intro(node, lang, t, at)
|
224
240
|
node.attr("title-intro-#{lang}") and
|
225
|
-
t.
|
241
|
+
t.title **attr_code(at.merge(type: "title-intro")) do |t1|
|
226
242
|
t1 << asciidoc_sub(node.attr("title-intro-#{lang}"))
|
227
243
|
end
|
228
244
|
end
|
229
245
|
|
230
246
|
def title_main(node, lang, t, at)
|
231
|
-
t.
|
247
|
+
t.title **attr_code(at.merge(type: "title-main")) do |t1|
|
232
248
|
t1 << asciidoc_sub(node.attr("title-main-#{lang}"))
|
233
249
|
end
|
234
250
|
end
|
235
251
|
|
236
252
|
def title_part(node, lang, t, at)
|
237
253
|
node.attr("title-part-#{lang}") and
|
238
|
-
t.
|
254
|
+
t.title **attr_code(at.merge(type: "title-part")) do |t1|
|
239
255
|
t1 << asciidoc_sub(node.attr("title-part-#{lang}"))
|
240
256
|
end
|
241
257
|
end
|
242
258
|
|
243
259
|
def title(node, xml)
|
244
260
|
["en", "zh"].each do |lang|
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
end
|
261
|
+
at = { language: lang, format: "plain" }
|
262
|
+
title_full(node, lang, xml, at)
|
263
|
+
title_intro(node, lang, xml, at)
|
264
|
+
title_main(node, lang, xml, at)
|
265
|
+
title_part(node, lang, xml, at)
|
251
266
|
end
|
252
267
|
end
|
253
268
|
end
|
@@ -10,22 +10,6 @@
|
|
10
10
|
<start>
|
11
11
|
<ref name="gb-standard"/>
|
12
12
|
</start>
|
13
|
-
<define name="language">
|
14
|
-
<element name="language">
|
15
|
-
<choice>
|
16
|
-
<value>zh</value>
|
17
|
-
<value>en</value>
|
18
|
-
</choice>
|
19
|
-
</element>
|
20
|
-
</define>
|
21
|
-
<define name="script">
|
22
|
-
<element name="script">
|
23
|
-
<choice>
|
24
|
-
<value>Hans</value>
|
25
|
-
<value>Latn</value>
|
26
|
-
</choice>
|
27
|
-
</element>
|
28
|
-
</define>
|
29
13
|
<define name="preferred">
|
30
14
|
<element name="preferred">
|
31
15
|
<ref name="ZhEnLocalizedString"/>
|
@@ -72,143 +56,17 @@
|
|
72
56
|
</zeroOrMore>
|
73
57
|
</element>
|
74
58
|
</define>
|
75
|
-
<define name="
|
59
|
+
<define name="BibDataExtensionType">
|
76
60
|
<optional>
|
77
|
-
<
|
78
|
-
<ref name="BibItemType"/>
|
79
|
-
</attribute>
|
61
|
+
<ref name="doctype"/>
|
80
62
|
</optional>
|
81
|
-
<optional>
|
82
|
-
<ref name="fetched"/>
|
83
|
-
</optional>
|
84
|
-
<choice>
|
85
|
-
<oneOrMore>
|
86
|
-
<ref name="btitle"/>
|
87
|
-
</oneOrMore>
|
88
|
-
<ref name="formattedref"/>
|
89
|
-
</choice>
|
90
|
-
<optional>
|
91
|
-
<ref name="bsource"/>
|
92
|
-
</optional>
|
93
|
-
<zeroOrMore>
|
94
|
-
<ref name="docidentifier"/>
|
95
|
-
</zeroOrMore>
|
96
|
-
<optional>
|
97
|
-
<ref name="docnumber"/>
|
98
|
-
</optional>
|
99
|
-
<zeroOrMore>
|
100
|
-
<ref name="bdate"/>
|
101
|
-
</zeroOrMore>
|
102
|
-
<zeroOrMore>
|
103
|
-
<ref name="contributor"/>
|
104
|
-
</zeroOrMore>
|
105
|
-
<optional>
|
106
|
-
<ref name="edition"/>
|
107
|
-
</optional>
|
108
|
-
<optional>
|
109
|
-
<ref name="version"/>
|
110
|
-
</optional>
|
111
|
-
<zeroOrMore>
|
112
|
-
<ref name="biblionote"/>
|
113
|
-
</zeroOrMore>
|
114
|
-
<zeroOrMore>
|
115
|
-
<ref name="language"/>
|
116
|
-
</zeroOrMore>
|
117
|
-
<zeroOrMore>
|
118
|
-
<ref name="script"/>
|
119
|
-
</zeroOrMore>
|
120
|
-
<optional>
|
121
|
-
<ref name="abstract"/>
|
122
|
-
</optional>
|
123
|
-
<optional>
|
124
|
-
<ref name="status"/>
|
125
|
-
</optional>
|
126
|
-
<optional>
|
127
|
-
<ref name="copyright"/>
|
128
|
-
</optional>
|
129
|
-
<zeroOrMore>
|
130
|
-
<ref name="docrelation"/>
|
131
|
-
</zeroOrMore>
|
132
|
-
<optional>
|
133
|
-
<ref name="editorialgroup"/>
|
134
|
-
</optional>
|
135
|
-
<zeroOrMore>
|
136
|
-
<ref name="ics"/>
|
137
|
-
</zeroOrMore>
|
138
63
|
<zeroOrMore>
|
139
64
|
<ref name="gbcommittee"/>
|
140
65
|
</zeroOrMore>
|
141
|
-
<optional>
|
142
|
-
<ref name="gbtype"/>
|
143
|
-
</optional>
|
144
|
-
<zeroOrMore>
|
145
|
-
<ref name="gbccs"/>
|
146
|
-
</zeroOrMore>
|
147
|
-
<optional>
|
148
|
-
<ref name="gbplannumber"/>
|
149
|
-
</optional>
|
150
|
-
</define>
|
151
|
-
<define name="BibData">
|
152
|
-
<optional>
|
153
|
-
<attribute name="type">
|
154
|
-
<ref name="BibItemType"/>
|
155
|
-
</attribute>
|
156
|
-
</optional>
|
157
|
-
<oneOrMore>
|
158
|
-
<ref name="btitle"/>
|
159
|
-
</oneOrMore>
|
160
|
-
<optional>
|
161
|
-
<ref name="formattedref"/>
|
162
|
-
</optional>
|
163
|
-
<optional>
|
164
|
-
<ref name="bsource"/>
|
165
|
-
</optional>
|
166
|
-
<zeroOrMore>
|
167
|
-
<ref name="docidentifier"/>
|
168
|
-
</zeroOrMore>
|
169
|
-
<optional>
|
170
|
-
<ref name="docnumber"/>
|
171
|
-
</optional>
|
172
|
-
<zeroOrMore>
|
173
|
-
<ref name="bdate"/>
|
174
|
-
</zeroOrMore>
|
175
|
-
<zeroOrMore>
|
176
|
-
<ref name="contributor"/>
|
177
|
-
</zeroOrMore>
|
178
|
-
<optional>
|
179
|
-
<ref name="edition"/>
|
180
|
-
</optional>
|
181
|
-
<optional>
|
182
|
-
<ref name="version"/>
|
183
|
-
</optional>
|
184
|
-
<zeroOrMore>
|
185
|
-
<ref name="biblionote"/>
|
186
|
-
</zeroOrMore>
|
187
|
-
<zeroOrMore>
|
188
|
-
<ref name="language"/>
|
189
|
-
</zeroOrMore>
|
190
|
-
<zeroOrMore>
|
191
|
-
<ref name="script"/>
|
192
|
-
</zeroOrMore>
|
193
|
-
<optional>
|
194
|
-
<ref name="abstract"/>
|
195
|
-
</optional>
|
196
|
-
<optional>
|
197
|
-
<ref name="status"/>
|
198
|
-
</optional>
|
199
|
-
<ref name="copyright"/>
|
200
|
-
<zeroOrMore>
|
201
|
-
<ref name="docrelation"/>
|
202
|
-
</zeroOrMore>
|
203
|
-
<optional>
|
204
|
-
<ref name="editorialgroup"/>
|
205
|
-
</optional>
|
206
66
|
<zeroOrMore>
|
207
67
|
<ref name="ics"/>
|
208
68
|
</zeroOrMore>
|
209
|
-
<
|
210
|
-
<ref name="gbcommittee"/>
|
211
|
-
</zeroOrMore>
|
69
|
+
<ref name="structuredidentifier"/>
|
212
70
|
<ref name="gbtype"/>
|
213
71
|
<oneOrMore>
|
214
72
|
<ref name="gbccs"/>
|
@@ -308,6 +166,9 @@
|
|
308
166
|
<zeroOrMore>
|
309
167
|
<ref name="termdocsource"/>
|
310
168
|
</zeroOrMore>
|
169
|
+
<optional>
|
170
|
+
<ref name="boilerplate"/>
|
171
|
+
</optional>
|
311
172
|
<ref name="preface"/>
|
312
173
|
<oneOrMore>
|
313
174
|
<ref name="sections"/>
|
@@ -355,8 +216,11 @@
|
|
355
216
|
<ref name="gbtopic"/>
|
356
217
|
</element>
|
357
218
|
</define>
|
358
|
-
<define name="
|
359
|
-
<
|
219
|
+
<define name="DocumentType">
|
220
|
+
<choice>
|
221
|
+
<value>standard</value>
|
222
|
+
<value>recommendation</value>
|
223
|
+
</choice>
|
360
224
|
</define>
|
361
225
|
<define name="gbscope">
|
362
226
|
<element name="gbscope">
|