metanorma-csd 1.1.4 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +15 -10
- data/appveyor.yml +7 -2
- data/lib/asciidoctor/csd/biblio.rng +44 -15
- data/lib/asciidoctor/csd/converter.rb +1 -0
- data/lib/asciidoctor/csd/csd.rng +6 -195
- data/lib/asciidoctor/csd/front.rb +2 -1
- data/lib/asciidoctor/csd/isodoc.rng +128 -71
- data/lib/asciidoctor/csd/isostandard.rng +29 -304
- data/lib/asciidoctor/csd/reqt.rng +5 -0
- data/lib/asciidoctor/csd/validate.rb +29 -0
- data/lib/asciidoctor/csd/validate_section.rb +1 -1
- data/lib/isodoc/csd/base_convert.rb +49 -0
- data/lib/isodoc/csd/html/html_csd_titlepage.html +3 -3
- data/lib/isodoc/csd/html/word_csd_titlepage.html +1 -1
- data/lib/isodoc/csd/html_convert.rb +2 -41
- data/lib/isodoc/csd/metadata.rb +1 -6
- data/lib/isodoc/csd/pdf_convert.rb +2 -41
- data/lib/isodoc/csd/word_convert.rb +2 -41
- data/lib/metanorma/csd/version.rb +1 -1
- data/metanorma-csd.gemspec +3 -2
- metadata +10 -9
- data/lib/asciidoctor/csd/pdf.js +0 -31
@@ -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>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Asciidoctor
|
2
|
+
module Csd
|
3
|
+
class Converter < Standoc::Converter
|
4
|
+
def content_validate(doc)
|
5
|
+
super
|
6
|
+
bibdata_validate(doc.root)
|
7
|
+
end
|
8
|
+
|
9
|
+
def bibdata_validate(doc)
|
10
|
+
doctype_validate(doc)
|
11
|
+
stage_validate(doc)
|
12
|
+
end
|
13
|
+
|
14
|
+
def doctype_validate(xmldoc)
|
15
|
+
doctype = xmldoc&.at("//bibdata/ext/doctype")&.text
|
16
|
+
%w(directive guide specification standard report administrative amendment
|
17
|
+
technical-corrigendum advisory).include? doctype or
|
18
|
+
warn "Document Attributes: #{doctype} is not a recognised document type"
|
19
|
+
end
|
20
|
+
|
21
|
+
def stage_validate(xmldoc)
|
22
|
+
stage = xmldoc&.at("//bibdata/status/stage")&.text
|
23
|
+
%w(proposal working-draft committee-draft draft-standard final-draft
|
24
|
+
published withdrawn).include? stage or
|
25
|
+
warn "Document Attributes: #{stage} is not a recognised status"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -4,7 +4,7 @@ module Asciidoctor
|
|
4
4
|
module Csd
|
5
5
|
class Converter < Standoc::Converter
|
6
6
|
def section_validate(doc)
|
7
|
-
advisory = doc.root.at("//bibdata[
|
7
|
+
advisory = doc.root.at("//bibdata/ext[doctype = 'advisory']")
|
8
8
|
symbols_validate(doc.root) unless advisory
|
9
9
|
sections_sequence_validate(doc.root) unless advisory
|
10
10
|
super
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "isodoc"
|
2
|
+
require_relative "metadata"
|
3
|
+
|
4
|
+
module IsoDoc
|
5
|
+
module Csd
|
6
|
+
module BaseConvert
|
7
|
+
def metadata_init(lang, script, labels)
|
8
|
+
@meta = Metadata.new(lang, script, labels)
|
9
|
+
end
|
10
|
+
|
11
|
+
def annex_name(annex, name, div)
|
12
|
+
div.h1 **{ class: "Annex" } do |t|
|
13
|
+
t << "#{anchor(annex['id'], :label)} "
|
14
|
+
t.br
|
15
|
+
t.b do |b|
|
16
|
+
name&.children&.each { |c2| parse(c2, b) }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def term_defs_boilerplate(div, source, term, preface)
|
22
|
+
if source.empty? && term.nil?
|
23
|
+
div << @no_terms_boilerplate
|
24
|
+
else
|
25
|
+
div << term_defs_boilerplate_cont(source, term)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def i18n_init(lang, script)
|
30
|
+
super
|
31
|
+
@annex_lbl = "Appendix"
|
32
|
+
end
|
33
|
+
|
34
|
+
def cleanup(docxml)
|
35
|
+
super
|
36
|
+
term_cleanup(docxml)
|
37
|
+
end
|
38
|
+
|
39
|
+
def term_cleanup(docxml)
|
40
|
+
docxml.xpath("//p[@class = 'Terms']").each do |d|
|
41
|
+
h2 = d.at("./preceding-sibling::*[@class = 'TermNum'][1]")
|
42
|
+
h2.add_child(" ")
|
43
|
+
h2.add_child(d.remove)
|
44
|
+
end
|
45
|
+
docxml
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|