metanorma-iso 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 +11 -9
- data/appveyor.yml +7 -2
- data/lib/asciidoctor/iso/biblio.rng +44 -15
- data/lib/asciidoctor/iso/cleanup.rb +1 -2
- data/lib/asciidoctor/iso/front.rb +45 -14
- data/lib/asciidoctor/iso/isodoc.rng +128 -71
- data/lib/asciidoctor/iso/isostandard.rng +29 -304
- data/lib/asciidoctor/iso/reqt.rng +5 -0
- data/lib/asciidoctor/iso/validate.rb +49 -8
- data/lib/isodoc/iso/base_convert.rb +190 -0
- data/lib/isodoc/iso/html_convert.rb +2 -165
- data/lib/isodoc/iso/i18n-en.yaml +11 -0
- data/lib/isodoc/iso/i18n-fr.yaml +10 -0
- data/lib/isodoc/iso/i18n-zh-Hans.yaml +8 -0
- data/lib/isodoc/iso/metadata.rb +71 -8
- data/lib/isodoc/iso/word_convert.rb +3 -168
- data/lib/metanorma/iso/version.rb +1 -1
- data/metanorma-iso.gemspec +4 -4
- data/spec/asciidoctor-iso/base_spec.rb +210 -24
- data/spec/asciidoctor-iso/refs_spec.rb +3 -382
- data/spec/asciidoctor-iso/validate_spec.rb +81 -0
- data/spec/assets/iso.doc +27 -26
- data/spec/assets/iso.html +1 -1
- data/spec/isodoc/metadata_spec.rb +28 -26
- data/spec/isodoc/postproc_spec.rb +7 -7
- data/spec/spec_helper.rb +4 -5
- metadata +25 -22
- data/docs/styling-output-html.adoc +0 -37
@@ -4,36 +4,6 @@
|
|
4
4
|
<start>
|
5
5
|
<ref name="iso-standard"/>
|
6
6
|
</start>
|
7
|
-
<define name="language">
|
8
|
-
<element name="language">
|
9
|
-
<choice>
|
10
|
-
<value>en</value>
|
11
|
-
<value>fr</value>
|
12
|
-
</choice>
|
13
|
-
</element>
|
14
|
-
</define>
|
15
|
-
<define name="script">
|
16
|
-
<element name="script">
|
17
|
-
<value>Latn</value>
|
18
|
-
</element>
|
19
|
-
</define>
|
20
|
-
<!-- add type to docidentifier in isodoc? -->
|
21
|
-
<define name="docidentifier">
|
22
|
-
<element name="docidentifier">
|
23
|
-
<optional>
|
24
|
-
<attribute name="type"/>
|
25
|
-
</optional>
|
26
|
-
<choice>
|
27
|
-
<text/>
|
28
|
-
<group>
|
29
|
-
<ref name="documentnumber"/>
|
30
|
-
<optional>
|
31
|
-
<ref name="tc-documentnumber"/>
|
32
|
-
</optional>
|
33
|
-
</group>
|
34
|
-
</choice>
|
35
|
-
</element>
|
36
|
-
</define>
|
37
7
|
<define name="organization">
|
38
8
|
<element name="organization">
|
39
9
|
<ref name="orgname"/>
|
@@ -63,190 +33,24 @@
|
|
63
33
|
</optional>
|
64
34
|
</element>
|
65
35
|
</define>
|
66
|
-
<define name="
|
67
|
-
<optional>
|
68
|
-
<attribute name="type">
|
69
|
-
<ref name="BibItemType"/>
|
70
|
-
</attribute>
|
71
|
-
</optional>
|
72
|
-
<optional>
|
73
|
-
<ref name="fetched"/>
|
74
|
-
</optional>
|
75
|
-
<choice>
|
76
|
-
<oneOrMore>
|
77
|
-
<ref name="btitle"/>
|
78
|
-
</oneOrMore>
|
79
|
-
<ref name="formattedref"/>
|
80
|
-
</choice>
|
81
|
-
<zeroOrMore>
|
82
|
-
<ref name="bsource"/>
|
83
|
-
</zeroOrMore>
|
84
|
-
<zeroOrMore>
|
85
|
-
<ref name="docidentifier"/>
|
86
|
-
</zeroOrMore>
|
87
|
-
<optional>
|
88
|
-
<ref name="docnumber"/>
|
89
|
-
</optional>
|
90
|
-
<zeroOrMore>
|
91
|
-
<ref name="bdate"/>
|
92
|
-
</zeroOrMore>
|
93
|
-
<zeroOrMore>
|
94
|
-
<ref name="contributor"/>
|
95
|
-
</zeroOrMore>
|
96
|
-
<optional>
|
97
|
-
<ref name="edition"/>
|
98
|
-
</optional>
|
99
|
-
<optional>
|
100
|
-
<ref name="version"/>
|
101
|
-
</optional>
|
102
|
-
<zeroOrMore>
|
103
|
-
<ref name="biblionote"/>
|
104
|
-
</zeroOrMore>
|
105
|
-
<zeroOrMore>
|
106
|
-
<ref name="language"/>
|
107
|
-
</zeroOrMore>
|
108
|
-
<zeroOrMore>
|
109
|
-
<ref name="script"/>
|
110
|
-
</zeroOrMore>
|
111
|
-
<zeroOrMore>
|
112
|
-
<ref name="abstract"/>
|
113
|
-
</zeroOrMore>
|
114
|
-
<optional>
|
115
|
-
<ref name="status"/>
|
116
|
-
</optional>
|
117
|
-
<optional>
|
118
|
-
<ref name="copyright"/>
|
119
|
-
</optional>
|
120
|
-
<zeroOrMore>
|
121
|
-
<ref name="docrelation"/>
|
122
|
-
</zeroOrMore>
|
123
|
-
<zeroOrMore>
|
124
|
-
<ref name="series"/>
|
125
|
-
</zeroOrMore>
|
126
|
-
<optional>
|
127
|
-
<ref name="medium"/>
|
128
|
-
</optional>
|
129
|
-
<zeroOrMore>
|
130
|
-
<ref name="bplace"/>
|
131
|
-
</zeroOrMore>
|
132
|
-
<zeroOrMore>
|
133
|
-
<ref name="extent"/>
|
134
|
-
</zeroOrMore>
|
135
|
-
<zeroOrMore>
|
136
|
-
<ref name="accesslocation"/>
|
137
|
-
</zeroOrMore>
|
138
|
-
<optional>
|
139
|
-
<ref name="bclassification"/>
|
140
|
-
</optional>
|
141
|
-
<optional>
|
142
|
-
<ref name="validity"/>
|
143
|
-
</optional>
|
144
|
-
<optional>
|
145
|
-
<ref name="editorialgroup"/>
|
146
|
-
</optional>
|
147
|
-
<zeroOrMore>
|
148
|
-
<ref name="ics"/>
|
149
|
-
</zeroOrMore>
|
150
|
-
<optional>
|
151
|
-
<ref name="allParts"/>
|
152
|
-
</optional>
|
153
|
-
</define>
|
154
|
-
<define name="BibData">
|
155
|
-
<optional>
|
156
|
-
<attribute name="type">
|
157
|
-
<ref name="BibItemType"/>
|
158
|
-
</attribute>
|
159
|
-
</optional>
|
160
|
-
<oneOrMore>
|
161
|
-
<ref name="btitle"/>
|
162
|
-
</oneOrMore>
|
163
|
-
<optional>
|
164
|
-
<ref name="formattedref"/>
|
165
|
-
</optional>
|
166
|
-
<zeroOrMore>
|
167
|
-
<ref name="bsource"/>
|
168
|
-
</zeroOrMore>
|
169
|
-
<zeroOrMore>
|
170
|
-
<ref name="docidentifier"/>
|
171
|
-
</zeroOrMore>
|
172
|
-
<optional>
|
173
|
-
<ref name="docnumber"/>
|
174
|
-
</optional>
|
175
|
-
<zeroOrMore>
|
176
|
-
<ref name="bdate"/>
|
177
|
-
</zeroOrMore>
|
178
|
-
<zeroOrMore>
|
179
|
-
<ref name="contributor"/>
|
180
|
-
</zeroOrMore>
|
181
|
-
<optional>
|
182
|
-
<ref name="edition"/>
|
183
|
-
</optional>
|
184
|
-
<optional>
|
185
|
-
<ref name="version"/>
|
186
|
-
</optional>
|
187
|
-
<zeroOrMore>
|
188
|
-
<ref name="biblionote"/>
|
189
|
-
</zeroOrMore>
|
190
|
-
<zeroOrMore>
|
191
|
-
<ref name="language"/>
|
192
|
-
</zeroOrMore>
|
193
|
-
<zeroOrMore>
|
194
|
-
<ref name="script"/>
|
195
|
-
</zeroOrMore>
|
196
|
-
<zeroOrMore>
|
197
|
-
<ref name="abstract"/>
|
198
|
-
</zeroOrMore>
|
199
|
-
<optional>
|
200
|
-
<ref name="status"/>
|
201
|
-
</optional>
|
202
|
-
<ref name="copyright"/>
|
203
|
-
<zeroOrMore>
|
204
|
-
<ref name="docrelation"/>
|
205
|
-
</zeroOrMore>
|
206
|
-
<zeroOrMore>
|
207
|
-
<ref name="series"/>
|
208
|
-
</zeroOrMore>
|
36
|
+
<define name="BibDataExtensionType">
|
209
37
|
<optional>
|
210
|
-
<ref name="
|
211
|
-
</optional>
|
212
|
-
<zeroOrMore>
|
213
|
-
<ref name="bplace"/>
|
214
|
-
</zeroOrMore>
|
215
|
-
<zeroOrMore>
|
216
|
-
<ref name="extent"/>
|
217
|
-
</zeroOrMore>
|
218
|
-
<zeroOrMore>
|
219
|
-
<ref name="accesslocation"/>
|
220
|
-
</zeroOrMore>
|
221
|
-
<optional>
|
222
|
-
<ref name="bclassification"/>
|
223
|
-
</optional>
|
224
|
-
<optional>
|
225
|
-
<ref name="validity"/>
|
38
|
+
<ref name="doctype"/>
|
226
39
|
</optional>
|
227
40
|
<ref name="editorialgroup"/>
|
228
41
|
<zeroOrMore>
|
229
42
|
<ref name="ics"/>
|
230
43
|
</zeroOrMore>
|
231
|
-
<
|
232
|
-
<ref name="allParts"/>
|
233
|
-
</optional>
|
44
|
+
<ref name="structuredidentifier"/>
|
234
45
|
</define>
|
235
46
|
<define name="bdate">
|
236
47
|
<element name="date">
|
237
48
|
<attribute name="type">
|
238
49
|
<choice>
|
239
|
-
<
|
240
|
-
<
|
241
|
-
<value>created</value>
|
242
|
-
<value>implemented</value>
|
243
|
-
<value>obsoleted</value>
|
244
|
-
<value>confirmed</value>
|
245
|
-
<value>updated</value>
|
246
|
-
<value>issued</value>
|
50
|
+
<ref name="BibliographicDateType"/>
|
51
|
+
<text/>
|
247
52
|
</choice>
|
248
53
|
</attribute>
|
249
|
-
<!-- ( ( bfrom, bto? ) | date_on ) -->
|
250
54
|
<choice>
|
251
55
|
<group>
|
252
56
|
<element name="from">
|
@@ -267,47 +71,6 @@
|
|
267
71
|
</choice>
|
268
72
|
</element>
|
269
73
|
</define>
|
270
|
-
<define name="biblionote">
|
271
|
-
<element name="note">
|
272
|
-
<optional>
|
273
|
-
<!-- Biblio date notes can be footnoted -->
|
274
|
-
<attribute name="reference"/>
|
275
|
-
</optional>
|
276
|
-
<ref name="FormattedString"/>
|
277
|
-
</element>
|
278
|
-
</define>
|
279
|
-
<define name="status">
|
280
|
-
<element name="status">
|
281
|
-
<choice>
|
282
|
-
<ref name="FormattedString"/>
|
283
|
-
<group>
|
284
|
-
<ref name="stage"/>
|
285
|
-
<optional>
|
286
|
-
<ref name="substage"/>
|
287
|
-
</optional>
|
288
|
-
<optional>
|
289
|
-
<ref name="iteration"/>
|
290
|
-
</optional>
|
291
|
-
</group>
|
292
|
-
</choice>
|
293
|
-
</element>
|
294
|
-
</define>
|
295
|
-
<define name="btitle">
|
296
|
-
<element name="title">
|
297
|
-
<choice>
|
298
|
-
<ref name="FormattedString"/>
|
299
|
-
<group>
|
300
|
-
<optional>
|
301
|
-
<ref name="title-intro"/>
|
302
|
-
</optional>
|
303
|
-
<ref name="title-main"/>
|
304
|
-
<optional>
|
305
|
-
<ref name="title-part"/>
|
306
|
-
</optional>
|
307
|
-
</group>
|
308
|
-
</choice>
|
309
|
-
</element>
|
310
|
-
</define>
|
311
74
|
<define name="sections">
|
312
75
|
<element name="sections">
|
313
76
|
<ref name="clause"/>
|
@@ -752,6 +515,16 @@
|
|
752
515
|
</optional>
|
753
516
|
</element>
|
754
517
|
</define>
|
518
|
+
<define name="DocumentType">
|
519
|
+
<choice>
|
520
|
+
<value>international-standard</value>
|
521
|
+
<value>technical-specification</value>
|
522
|
+
<value>technical-report</value>
|
523
|
+
<value>publicly-available-specification</value>
|
524
|
+
<value>international-workshop-agreement</value>
|
525
|
+
<value>guide</value>
|
526
|
+
</choice>
|
527
|
+
</define>
|
755
528
|
</include>
|
756
529
|
<!-- end overrides -->
|
757
530
|
<!--
|
@@ -764,6 +537,9 @@
|
|
764
537
|
<zeroOrMore>
|
765
538
|
<ref name="termdocsource"/>
|
766
539
|
</zeroOrMore>
|
540
|
+
<optional>
|
541
|
+
<ref name="boilerplate"/>
|
542
|
+
</optional>
|
767
543
|
<ref name="preface"/>
|
768
544
|
<oneOrMore>
|
769
545
|
<ref name="sections"/>
|
@@ -784,16 +560,6 @@
|
|
784
560
|
</oneOrMore>
|
785
561
|
</element>
|
786
562
|
</define>
|
787
|
-
<define name="BibItemType" combine="choice">
|
788
|
-
<choice>
|
789
|
-
<value>international-standard</value>
|
790
|
-
<value>technical-specification</value>
|
791
|
-
<value>technical-report</value>
|
792
|
-
<value>publicly-available-specification</value>
|
793
|
-
<value>international-workshop-agreement</value>
|
794
|
-
<value>guide</value>
|
795
|
-
</choice>
|
796
|
-
</define>
|
797
563
|
<define name="editorialgroup">
|
798
564
|
<element name="editorialgroup">
|
799
565
|
<oneOrMore>
|
@@ -825,38 +591,17 @@
|
|
825
591
|
<ref name="Content-Section"/>
|
826
592
|
</element>
|
827
593
|
</define>
|
828
|
-
<define name="
|
829
|
-
<element name="
|
830
|
-
<
|
831
|
-
<
|
832
|
-
|
833
|
-
|
834
|
-
<
|
835
|
-
<
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
<value>95</value>
|
840
|
-
</choice>
|
841
|
-
</element>
|
842
|
-
</define>
|
843
|
-
<define name="substage">
|
844
|
-
<element name="substage">
|
845
|
-
<choice>
|
846
|
-
<value>00</value>
|
847
|
-
<value>20</value>
|
848
|
-
<value>60</value>
|
849
|
-
<value>90</value>
|
850
|
-
<value>92</value>
|
851
|
-
<value>93</value>
|
852
|
-
<value>98</value>
|
853
|
-
<value>99</value>
|
854
|
-
</choice>
|
855
|
-
</element>
|
856
|
-
</define>
|
857
|
-
<define name="iteration">
|
858
|
-
<element name="iteration">
|
859
|
-
<data type="int"/>
|
594
|
+
<define name="structuredidentifier">
|
595
|
+
<element name="structuredidentifier">
|
596
|
+
<optional>
|
597
|
+
<attribute name="type"/>
|
598
|
+
</optional>
|
599
|
+
<group>
|
600
|
+
<ref name="documentnumber"/>
|
601
|
+
<optional>
|
602
|
+
<ref name="tc-documentnumber"/>
|
603
|
+
</optional>
|
604
|
+
</group>
|
860
605
|
</element>
|
861
606
|
</define>
|
862
607
|
<define name="documentnumber">
|
@@ -910,26 +655,6 @@
|
|
910
655
|
<text/>
|
911
656
|
</element>
|
912
657
|
</define>
|
913
|
-
<define name="title-intro">
|
914
|
-
<element name="title-intro">
|
915
|
-
<ref name="FormattedString"/>
|
916
|
-
</element>
|
917
|
-
</define>
|
918
|
-
<define name="title-main">
|
919
|
-
<element name="title-main">
|
920
|
-
<ref name="FormattedString"/>
|
921
|
-
</element>
|
922
|
-
</define>
|
923
|
-
<define name="title-part">
|
924
|
-
<element name="title-part">
|
925
|
-
<ref name="FormattedString"/>
|
926
|
-
</element>
|
927
|
-
</define>
|
928
|
-
<define name="allParts">
|
929
|
-
<element name="allparts">
|
930
|
-
<data type="boolean"/>
|
931
|
-
</element>
|
932
|
-
</define>
|
933
658
|
<define name="clause-hanging-paragraph-with-footnote">
|
934
659
|
<element name="clause">
|
935
660
|
<optional>
|
@@ -11,8 +11,8 @@ module Asciidoctor
|
|
11
11
|
module ISO
|
12
12
|
class Converter < Standoc::Converter
|
13
13
|
def title_intro_validate(root)
|
14
|
-
title_intro_en = root.at("//title-intro
|
15
|
-
title_intro_fr = root.at("//title-intro
|
14
|
+
title_intro_en = root.at("//title[@type='title-intro' and @language='en']")
|
15
|
+
title_intro_fr = root.at("//title[@type='title-intro' and @language='fr']")
|
16
16
|
if title_intro_en.nil? && !title_intro_fr.nil?
|
17
17
|
warn "No English Title Intro!"
|
18
18
|
end
|
@@ -22,8 +22,8 @@ module Asciidoctor
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def title_main_validate(root)
|
25
|
-
title_main_en = root.at("//title-main
|
26
|
-
title_main_fr = root.at("//title-main
|
25
|
+
title_main_en = root.at("//title[@type='title-main' and @language='en']")
|
26
|
+
title_main_fr = root.at("//title[@type='title-main' and @language='fr']")
|
27
27
|
if title_main_en.nil? && !title_main_fr.nil?
|
28
28
|
warn "No English Title!"
|
29
29
|
end
|
@@ -33,8 +33,8 @@ module Asciidoctor
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def title_part_validate(root)
|
36
|
-
title_part_en = root.at("//title-part
|
37
|
-
title_part_fr = root.at("//title-part
|
36
|
+
title_part_en = root.at("//title[@type='title-part' and @language='en']")
|
37
|
+
title_part_fr = root.at("//title[@type='title-part' and @language='fr']")
|
38
38
|
(title_part_en.nil? && !title_part_fr.nil?) &&
|
39
39
|
warn("No English Title Part!")
|
40
40
|
(!title_part_en.nil? && title_part_fr.nil?) &&
|
@@ -53,11 +53,11 @@ module Asciidoctor
|
|
53
53
|
def title_names_type_validate(root)
|
54
54
|
doctypes = /International\sStandard | Technical\sSpecification |
|
55
55
|
Publicly\sAvailable\sSpecification | Technical\sReport | Guide /xi
|
56
|
-
title_main_en = root.at("//title-main
|
56
|
+
title_main_en = root.at("//title[@type='title-main' and @language='en']")
|
57
57
|
if !title_main_en.nil? && doctypes.match(title_main_en.text)
|
58
58
|
warn "Main Title may name document type"
|
59
59
|
end
|
60
|
-
title_intro_en = root.at("//title-intro
|
60
|
+
title_intro_en = root.at("//title[@type='title-intro' and @language='en']")
|
61
61
|
if !title_intro_en.nil? && doctypes.match(title_intro_en.text)
|
62
62
|
warn "Title Intro may name document type"
|
63
63
|
end
|
@@ -181,6 +181,46 @@ module Asciidoctor
|
|
181
181
|
end
|
182
182
|
end
|
183
183
|
|
184
|
+
def doctype_validate(xmldoc)
|
185
|
+
doctype = xmldoc&.at("//bibdata/ext/doctype")&.text
|
186
|
+
%w(international-standard technical-specification technical-report
|
187
|
+
publicly-available-specification international-workshop-agreement
|
188
|
+
guide).include? doctype or
|
189
|
+
warn "ISO Document Attributes: #{doctype} is not a recognised document type"
|
190
|
+
end
|
191
|
+
|
192
|
+
def script_validate(xmldoc)
|
193
|
+
script = xmldoc&.at("//bibdata/script")&.text
|
194
|
+
script == "Latn" or
|
195
|
+
warn "ISO Document Attributes: #{script} is not a recognised script"
|
196
|
+
end
|
197
|
+
|
198
|
+
def stage_validate(xmldoc)
|
199
|
+
stage = xmldoc&.at("//bibdata/status/stage")&.text
|
200
|
+
%w(00 10 20 30 40 50 60 90 95).include? stage or
|
201
|
+
warn "ISO Document Attributes: #{stage} is not a recognised stage"
|
202
|
+
end
|
203
|
+
|
204
|
+
def substage_validate(xmldoc)
|
205
|
+
substage = xmldoc&.at("//bibdata/status/substage")&.text or return
|
206
|
+
%w(00 20 60 90 92 93 98 99).include? substage or
|
207
|
+
warn "ISO Document Attributes: #{substage} is not a recognised substage"
|
208
|
+
end
|
209
|
+
|
210
|
+
def iteration_validate(xmldoc)
|
211
|
+
iteration = xmldoc&.at("//bibdata/status/iteration")&.text or return
|
212
|
+
/^\d+/.match(iteration) or
|
213
|
+
warn "ISO Document Attributes: #{iteration} is not a recognised iteration"
|
214
|
+
end
|
215
|
+
|
216
|
+
def bibdata_validate(doc)
|
217
|
+
doctype_validate(doc)
|
218
|
+
script_validate(doc)
|
219
|
+
stage_validate(doc)
|
220
|
+
substage_validate(doc)
|
221
|
+
iteration_validate(doc)
|
222
|
+
end
|
223
|
+
|
184
224
|
def content_validate(doc)
|
185
225
|
super
|
186
226
|
title_validate(doc.root)
|
@@ -191,6 +231,7 @@ module Asciidoctor
|
|
191
231
|
see_xrefs_validate(doc.root)
|
192
232
|
see_erefs_validate(doc.root)
|
193
233
|
locality_erefs_validate(doc.root)
|
234
|
+
bibdata_validate(doc.root)
|
194
235
|
end
|
195
236
|
|
196
237
|
def validate(doc)
|