metanorma-un 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.github/workflows/macos.yml +39 -0
- data/.github/workflows/ubuntu.yml +39 -0
- data/.github/workflows/windows.yml +42 -0
- data/.gitignore +1 -0
- data/.hound.yml +3 -0
- data/.rubocop.yml +10 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +11 -0
- data/LICENSE +25 -0
- data/README.adoc +141 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/rspec +17 -0
- data/bin/setup +8 -0
- data/lib/asciidoctor/un.rb +7 -0
- data/lib/asciidoctor/un/basicdoc.rng +1059 -0
- data/lib/asciidoctor/un/biblio.rng +1142 -0
- data/lib/asciidoctor/un/boilerplate.xml +57 -0
- data/lib/asciidoctor/un/converter.rb +209 -0
- data/lib/asciidoctor/un/isodoc.rng +1028 -0
- data/lib/asciidoctor/un/reqt.rng +171 -0
- data/lib/asciidoctor/un/un.rng +242 -0
- data/lib/asciidoctor/un/validate.rb +22 -0
- data/lib/isodoc/un.rb +10 -0
- data/lib/isodoc/un/base_convert.rb +227 -0
- data/lib/isodoc/un/html/header.html +225 -0
- data/lib/isodoc/un/html/html_unece_intro.html +15 -0
- data/lib/isodoc/un/html/html_unece_plenary_titlepage.html +100 -0
- data/lib/isodoc/un/html/html_unece_titlepage.html +81 -0
- data/lib/isodoc/un/html/htmlstyle.scss +1174 -0
- data/lib/isodoc/un/html/logo.jpg +0 -0
- data/lib/isodoc/un/html/scripts.html +84 -0
- data/lib/isodoc/un/html/scripts.pdf.html +72 -0
- data/lib/isodoc/un/html/unece.scss +801 -0
- data/lib/isodoc/un/html/word_unece_intro.html +15 -0
- data/lib/isodoc/un/html/word_unece_plenary_titlepage.html +160 -0
- data/lib/isodoc/un/html/word_unece_titlepage.html +30 -0
- data/lib/isodoc/un/html/wordstyle.scss +1141 -0
- data/lib/isodoc/un/html_convert.rb +121 -0
- data/lib/isodoc/un/metadata.rb +115 -0
- data/lib/isodoc/un/pdf_convert.rb +133 -0
- data/lib/isodoc/un/word_convert.rb +180 -0
- data/lib/metanorma-un.rb +8 -0
- data/lib/metanorma/un.rb +12 -0
- data/lib/metanorma/un/UN_emblem_blue.svg +193 -0
- data/lib/metanorma/un/input.rb +18 -0
- data/lib/metanorma/un/processor.rb +43 -0
- data/lib/metanorma/un/version.rb +5 -0
- data/metanorma-unece.gemspec +48 -0
- metadata +334 -0
@@ -0,0 +1,171 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
3
|
+
<!--
|
4
|
+
Presupposes isodoc.rnc, is included in it
|
5
|
+
include "isodoc.rnc" { }
|
6
|
+
-->
|
7
|
+
<define name="requirement">
|
8
|
+
<element name="requirement">
|
9
|
+
<ref name="RequirementType"/>
|
10
|
+
</element>
|
11
|
+
</define>
|
12
|
+
<define name="recommendation">
|
13
|
+
<element name="recommendation">
|
14
|
+
<ref name="RequirementType"/>
|
15
|
+
</element>
|
16
|
+
</define>
|
17
|
+
<define name="permission">
|
18
|
+
<element name="permission">
|
19
|
+
<ref name="RequirementType"/>
|
20
|
+
</element>
|
21
|
+
</define>
|
22
|
+
<define name="RequirementType">
|
23
|
+
<optional>
|
24
|
+
<attribute name="obligation">
|
25
|
+
<ref name="ObligationType"/>
|
26
|
+
</attribute>
|
27
|
+
</optional>
|
28
|
+
<optional>
|
29
|
+
<attribute name="unnumbered">
|
30
|
+
<data type="boolean"/>
|
31
|
+
</attribute>
|
32
|
+
</optional>
|
33
|
+
<optional>
|
34
|
+
<attribute name="subsequence"/>
|
35
|
+
</optional>
|
36
|
+
<attribute name="id">
|
37
|
+
<data type="ID"/>
|
38
|
+
</attribute>
|
39
|
+
<optional>
|
40
|
+
<attribute name="filename"/>
|
41
|
+
</optional>
|
42
|
+
<optional>
|
43
|
+
<attribute name="model"/>
|
44
|
+
</optional>
|
45
|
+
<optional>
|
46
|
+
<attribute name="type"/>
|
47
|
+
</optional>
|
48
|
+
<optional>
|
49
|
+
<ref name="reqtitle"/>
|
50
|
+
</optional>
|
51
|
+
<optional>
|
52
|
+
<ref name="label"/>
|
53
|
+
</optional>
|
54
|
+
<optional>
|
55
|
+
<ref name="subject"/>
|
56
|
+
</optional>
|
57
|
+
<zeroOrMore>
|
58
|
+
<ref name="reqinherit"/>
|
59
|
+
</zeroOrMore>
|
60
|
+
<zeroOrMore>
|
61
|
+
<ref name="classification"/>
|
62
|
+
</zeroOrMore>
|
63
|
+
<zeroOrMore>
|
64
|
+
<choice>
|
65
|
+
<ref name="measurementtarget"/>
|
66
|
+
<ref name="specification"/>
|
67
|
+
<ref name="verification"/>
|
68
|
+
<ref name="import"/>
|
69
|
+
<ref name="description"/>
|
70
|
+
</choice>
|
71
|
+
</zeroOrMore>
|
72
|
+
<optional>
|
73
|
+
<ref name="reqt_references"/>
|
74
|
+
</optional>
|
75
|
+
<zeroOrMore>
|
76
|
+
<choice>
|
77
|
+
<ref name="requirement"/>
|
78
|
+
<ref name="recommendation"/>
|
79
|
+
<ref name="permission"/>
|
80
|
+
</choice>
|
81
|
+
</zeroOrMore>
|
82
|
+
</define>
|
83
|
+
<define name="reqtitle">
|
84
|
+
<element name="title">
|
85
|
+
<ref name="FormattedString"/>
|
86
|
+
</element>
|
87
|
+
</define>
|
88
|
+
<define name="label">
|
89
|
+
<element name="label">
|
90
|
+
<text/>
|
91
|
+
</element>
|
92
|
+
</define>
|
93
|
+
<define name="subject">
|
94
|
+
<element name="subject">
|
95
|
+
<text/>
|
96
|
+
</element>
|
97
|
+
</define>
|
98
|
+
<define name="reqinherit">
|
99
|
+
<element name="inherit">
|
100
|
+
<text/>
|
101
|
+
</element>
|
102
|
+
</define>
|
103
|
+
<define name="measurementtarget">
|
104
|
+
<element name="measurement-target">
|
105
|
+
<ref name="RequirementSubpart"/>
|
106
|
+
</element>
|
107
|
+
</define>
|
108
|
+
<define name="specification">
|
109
|
+
<element name="specification">
|
110
|
+
<ref name="RequirementSubpart"/>
|
111
|
+
</element>
|
112
|
+
</define>
|
113
|
+
<define name="verification">
|
114
|
+
<element name="verification">
|
115
|
+
<ref name="RequirementSubpart"/>
|
116
|
+
</element>
|
117
|
+
</define>
|
118
|
+
<define name="import">
|
119
|
+
<element name="import">
|
120
|
+
<ref name="RequirementSubpart"/>
|
121
|
+
</element>
|
122
|
+
</define>
|
123
|
+
<define name="description">
|
124
|
+
<element name="description">
|
125
|
+
<ref name="RequirementSubpart"/>
|
126
|
+
</element>
|
127
|
+
</define>
|
128
|
+
<define name="reqt_references">
|
129
|
+
<element name="references">
|
130
|
+
<oneOrMore>
|
131
|
+
<ref name="bibitem"/>
|
132
|
+
</oneOrMore>
|
133
|
+
</element>
|
134
|
+
</define>
|
135
|
+
<define name="RequirementSubpart">
|
136
|
+
<optional>
|
137
|
+
<attribute name="type"/>
|
138
|
+
</optional>
|
139
|
+
<optional>
|
140
|
+
<attribute name="exclude">
|
141
|
+
<data type="boolean"/>
|
142
|
+
</attribute>
|
143
|
+
</optional>
|
144
|
+
<oneOrMore>
|
145
|
+
<ref name="BasicBlock"/>
|
146
|
+
</oneOrMore>
|
147
|
+
</define>
|
148
|
+
<define name="ObligationType">
|
149
|
+
<choice>
|
150
|
+
<value>requirement</value>
|
151
|
+
<value>recommendation</value>
|
152
|
+
<value>permission</value>
|
153
|
+
</choice>
|
154
|
+
</define>
|
155
|
+
<define name="classification">
|
156
|
+
<element name="classification">
|
157
|
+
<ref name="classification_tag"/>
|
158
|
+
<ref name="classification_value"/>
|
159
|
+
</element>
|
160
|
+
</define>
|
161
|
+
<define name="classification_tag">
|
162
|
+
<element name="tag">
|
163
|
+
<text/>
|
164
|
+
</element>
|
165
|
+
</define>
|
166
|
+
<define name="classification_value">
|
167
|
+
<element name="value">
|
168
|
+
<text/>
|
169
|
+
</element>
|
170
|
+
</define>
|
171
|
+
</grammar>
|
@@ -0,0 +1,242 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<grammar ns="https://www.metanorma.org/ns/un" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
|
3
|
+
<!--
|
4
|
+
Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
|
5
|
+
we cannot have a new default namespace: we will end up with a grammar with two different
|
6
|
+
namespaces, one for isostandard and one for csand additions. And we do not want that.
|
7
|
+
-->
|
8
|
+
<include href="isodoc.rng">
|
9
|
+
<start>
|
10
|
+
<ref name="un-standard"/>
|
11
|
+
</start>
|
12
|
+
<define name="TextElement">
|
13
|
+
<choice>
|
14
|
+
<text/>
|
15
|
+
<ref name="em"/>
|
16
|
+
<ref name="eref"/>
|
17
|
+
<ref name="strong"/>
|
18
|
+
<ref name="stem"/>
|
19
|
+
<ref name="sub"/>
|
20
|
+
<ref name="sup"/>
|
21
|
+
<ref name="tt"/>
|
22
|
+
<ref name="strike"/>
|
23
|
+
<ref name="smallcap"/>
|
24
|
+
<ref name="xref"/>
|
25
|
+
<ref name="br"/>
|
26
|
+
<ref name="hyperlink"/>
|
27
|
+
<ref name="hr"/>
|
28
|
+
<ref name="pagebreak"/>
|
29
|
+
<ref name="bookmark"/>
|
30
|
+
</choice>
|
31
|
+
</define>
|
32
|
+
<define name="admonition">
|
33
|
+
<element name="admonition">
|
34
|
+
<attribute name="id">
|
35
|
+
<data type="ID"/>
|
36
|
+
</attribute>
|
37
|
+
<optional>
|
38
|
+
<attribute name="unnumbered">
|
39
|
+
<data type="boolean"/>
|
40
|
+
</attribute>
|
41
|
+
</optional>
|
42
|
+
<attribute name="type">
|
43
|
+
<choice>
|
44
|
+
<value>danger</value>
|
45
|
+
<value>caution</value>
|
46
|
+
<value>warning</value>
|
47
|
+
<value>important</value>
|
48
|
+
<value>safety precautions</value>
|
49
|
+
</choice>
|
50
|
+
</attribute>
|
51
|
+
<optional>
|
52
|
+
<ref name="tname"/>
|
53
|
+
</optional>
|
54
|
+
<oneOrMore>
|
55
|
+
<choice>
|
56
|
+
<ref name="paragraph-with-footnote"/>
|
57
|
+
<ref name="table"/>
|
58
|
+
<ref name="formula"/>
|
59
|
+
<ref name="ol"/>
|
60
|
+
<ref name="ul"/>
|
61
|
+
<ref name="dl"/>
|
62
|
+
<ref name="figure"/>
|
63
|
+
<ref name="quote"/>
|
64
|
+
<ref name="sourcecode"/>
|
65
|
+
<ref name="example"/>
|
66
|
+
<ref name="review"/>
|
67
|
+
</choice>
|
68
|
+
</oneOrMore>
|
69
|
+
<zeroOrMore>
|
70
|
+
<ref name="note"/>
|
71
|
+
</zeroOrMore>
|
72
|
+
</element>
|
73
|
+
</define>
|
74
|
+
<define name="DocumentType">
|
75
|
+
<choice>
|
76
|
+
<value>recommendation</value>
|
77
|
+
<value>plenary</value>
|
78
|
+
<value>addendum</value>
|
79
|
+
<value>communication</value>
|
80
|
+
<value>corrigendum</value>
|
81
|
+
<value>reissue</value>
|
82
|
+
<value>agenda</value>
|
83
|
+
<value>budgetary</value>
|
84
|
+
<value>sec-gen-notes</value>
|
85
|
+
<value>expert-report</value>
|
86
|
+
<value>resolution</value>
|
87
|
+
</choice>
|
88
|
+
</define>
|
89
|
+
<define name="editorialgroup">
|
90
|
+
<element name="editorialgroup">
|
91
|
+
<oneOrMore>
|
92
|
+
<ref name="committee"/>
|
93
|
+
</oneOrMore>
|
94
|
+
</element>
|
95
|
+
</define>
|
96
|
+
<define name="sections">
|
97
|
+
<element name="sections">
|
98
|
+
<oneOrMore>
|
99
|
+
<ref name="clause"/>
|
100
|
+
</oneOrMore>
|
101
|
+
</element>
|
102
|
+
</define>
|
103
|
+
<define name="BibDataExtensionType">
|
104
|
+
<optional>
|
105
|
+
<ref name="doctype"/>
|
106
|
+
</optional>
|
107
|
+
<zeroOrMore>
|
108
|
+
<ref name="submissionlanguage"/>
|
109
|
+
</zeroOrMore>
|
110
|
+
<ref name="editorialgroup"/>
|
111
|
+
<zeroOrMore>
|
112
|
+
<ref name="ics"/>
|
113
|
+
</zeroOrMore>
|
114
|
+
<optional>
|
115
|
+
<ref name="distribution"/>
|
116
|
+
</optional>
|
117
|
+
<optional>
|
118
|
+
<ref name="session"/>
|
119
|
+
</optional>
|
120
|
+
</define>
|
121
|
+
<define name="preface">
|
122
|
+
<element name="preface">
|
123
|
+
<optional>
|
124
|
+
<ref name="abstract"/>
|
125
|
+
</optional>
|
126
|
+
<optional>
|
127
|
+
<ref name="foreword"/>
|
128
|
+
</optional>
|
129
|
+
<optional>
|
130
|
+
<ref name="introduction"/>
|
131
|
+
</optional>
|
132
|
+
</element>
|
133
|
+
</define>
|
134
|
+
<define name="abstract">
|
135
|
+
<element name="abstract">
|
136
|
+
<ref name="Basic-Section"/>
|
137
|
+
</element>
|
138
|
+
</define>
|
139
|
+
</include>
|
140
|
+
<define name="session">
|
141
|
+
<element name="session">
|
142
|
+
<optional>
|
143
|
+
<ref name="session-number"/>
|
144
|
+
</optional>
|
145
|
+
<optional>
|
146
|
+
<ref name="session-date"/>
|
147
|
+
</optional>
|
148
|
+
<zeroOrMore>
|
149
|
+
<ref name="item-number"/>
|
150
|
+
</zeroOrMore>
|
151
|
+
<zeroOrMore>
|
152
|
+
<ref name="item-name"/>
|
153
|
+
</zeroOrMore>
|
154
|
+
<zeroOrMore>
|
155
|
+
<ref name="subitem-name"/>
|
156
|
+
</zeroOrMore>
|
157
|
+
<optional>
|
158
|
+
<ref name="collaborator"/>
|
159
|
+
</optional>
|
160
|
+
<optional>
|
161
|
+
<ref name="agenda-id"/>
|
162
|
+
</optional>
|
163
|
+
<optional>
|
164
|
+
<ref name="item-footnote"/>
|
165
|
+
</optional>
|
166
|
+
</element>
|
167
|
+
</define>
|
168
|
+
<define name="committee">
|
169
|
+
<element name="committee">
|
170
|
+
<text/>
|
171
|
+
</element>
|
172
|
+
</define>
|
173
|
+
<define name="session-number">
|
174
|
+
<element name="number">
|
175
|
+
<text/>
|
176
|
+
</element>
|
177
|
+
</define>
|
178
|
+
<define name="session-date">
|
179
|
+
<element name="session-date">
|
180
|
+
<data type="date"/>
|
181
|
+
</element>
|
182
|
+
</define>
|
183
|
+
<define name="item-number">
|
184
|
+
<element name="item-number">
|
185
|
+
<text/>
|
186
|
+
</element>
|
187
|
+
</define>
|
188
|
+
<define name="collaborator">
|
189
|
+
<element name="collaborator">
|
190
|
+
<text/>
|
191
|
+
</element>
|
192
|
+
</define>
|
193
|
+
<define name="agenda-id">
|
194
|
+
<element name="agenda-id">
|
195
|
+
<text/>
|
196
|
+
</element>
|
197
|
+
</define>
|
198
|
+
<define name="item-name">
|
199
|
+
<element name="item-name">
|
200
|
+
<text/>
|
201
|
+
</element>
|
202
|
+
</define>
|
203
|
+
<define name="subitem-name">
|
204
|
+
<element name="subitem-name">
|
205
|
+
<text/>
|
206
|
+
</element>
|
207
|
+
</define>
|
208
|
+
<define name="item-footnote">
|
209
|
+
<element name="item-footnote">
|
210
|
+
<text/>
|
211
|
+
</element>
|
212
|
+
</define>
|
213
|
+
<define name="submissionlanguage">
|
214
|
+
<element name="submissionlanguage">
|
215
|
+
<text/>
|
216
|
+
</element>
|
217
|
+
</define>
|
218
|
+
<define name="distribution">
|
219
|
+
<element name="distribution">
|
220
|
+
<choice>
|
221
|
+
<value>general</value>
|
222
|
+
<value>limited</value>
|
223
|
+
<value>restricted</value>
|
224
|
+
</choice>
|
225
|
+
</element>
|
226
|
+
</define>
|
227
|
+
<define name="un-standard">
|
228
|
+
<element name="un-standard">
|
229
|
+
<ref name="bibdata"/>
|
230
|
+
<optional>
|
231
|
+
<ref name="boilerplate"/>
|
232
|
+
</optional>
|
233
|
+
<ref name="preface"/>
|
234
|
+
<oneOrMore>
|
235
|
+
<ref name="sections"/>
|
236
|
+
</oneOrMore>
|
237
|
+
<zeroOrMore>
|
238
|
+
<ref name="annex"/>
|
239
|
+
</zeroOrMore>
|
240
|
+
</element>
|
241
|
+
</define>
|
242
|
+
</grammar>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Asciidoctor
|
2
|
+
module UN
|
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
|
+
stage_validate(doc)
|
11
|
+
end
|
12
|
+
|
13
|
+
def stage_validate(xmldoc)
|
14
|
+
stage = xmldoc&.at("//bibdata/status/stage")&.text
|
15
|
+
%w(proposal working-draft committee-draft draft-standard final-draft
|
16
|
+
published withdrawn).include? stage or
|
17
|
+
warn "Document Attributes: #{stage} is not a recognised status"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|