metanorma-un 0.8.0 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/isodoc/un/html/htmlstyle.css +25 -18
- data/lib/isodoc/un/html/htmlstyle.scss +8 -2
- data/lib/isodoc/un/html/unece.css +1 -2
- data/lib/isodoc/un/html/unece.scss +0 -1
- data/lib/isodoc/un/un.plenary-attachment.xsl +2115 -1298
- data/lib/isodoc/un/un.plenary.xsl +2115 -1298
- data/lib/isodoc/un/un.recommendation.xsl +2142 -1246
- data/lib/isodoc/un/xref.rb +39 -25
- data/lib/metanorma/un/basicdoc.rng +5 -3
- data/lib/metanorma/un/biblio.rng +7 -5
- data/lib/metanorma/un/isodoc.rng +171 -4
- data/lib/metanorma/un/un.rng +6 -1
- data/lib/metanorma/un/version.rb +1 -1
- metadata +2 -2
data/lib/isodoc/un/xref.rb
CHANGED
@@ -3,24 +3,25 @@ require "roman-numerals"
|
|
3
3
|
module IsoDoc
|
4
4
|
module UN
|
5
5
|
class Xref < IsoDoc::Xref
|
6
|
-
def initial_anchor_names(
|
7
|
-
preface_names(
|
8
|
-
preface_names(
|
9
|
-
preface_names(
|
10
|
-
|
6
|
+
def initial_anchor_names(doc)
|
7
|
+
preface_names(doc.at(ns("//preface/abstract")))
|
8
|
+
preface_names(doc.at(ns("//foreword")))
|
9
|
+
preface_names(doc.at(ns("//introduction")))
|
10
|
+
doc.xpath(ns("//preface/clause")).each do |c|
|
11
11
|
preface_names(c)
|
12
12
|
end
|
13
|
-
preface_names(
|
13
|
+
preface_names(doc.at(ns("//acknowledgements")))
|
14
14
|
sequential_asset_names(
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
doc.xpath(ns("//preface/abstract | //foreword | //introduction | "\
|
16
|
+
"//preface/clause | //acknowledgements")),
|
17
|
+
)
|
18
|
+
middle_section_asset_names(doc)
|
19
|
+
clause_names(doc, 0)
|
20
|
+
termnote_anchor_names(doc)
|
21
|
+
termexample_anchor_names(doc)
|
21
22
|
end
|
22
23
|
|
23
|
-
def clause_names(docxml,
|
24
|
+
def clause_names(docxml, _sect_num)
|
24
25
|
q = "//clause[parent::sections]"
|
25
26
|
@paranumber = 0
|
26
27
|
i = 0
|
@@ -57,24 +58,28 @@ module IsoDoc
|
|
57
58
|
|
58
59
|
def label_leaf_section(clause, lvl)
|
59
60
|
@paranumber += 1
|
60
|
-
@anchors[clause["id"]] =
|
61
|
-
|
62
|
-
|
61
|
+
@anchors[clause["id"]] =
|
62
|
+
{ label: @paranumber.to_s, elem: @labels["paragraph"],
|
63
|
+
xref: l10n("#{@labels['paragraph']} #{@paranumber}"),
|
64
|
+
level: lvl, type: "paragraph" }
|
63
65
|
end
|
64
66
|
|
65
67
|
def label_annex_leaf_section(clause, num, lvl)
|
66
68
|
@paranumber += 1
|
67
|
-
@anchors[clause["id"]] =
|
68
|
-
|
69
|
-
|
69
|
+
@anchors[clause["id"]] =
|
70
|
+
{ label: @paranumber.to_s, elem: @labels["paragraph"],
|
71
|
+
xref: l10n("#{@labels['paragraph']} #{num}.#{@paranumber}"),
|
72
|
+
level: lvl, type: "paragraph" }
|
70
73
|
end
|
71
74
|
|
72
75
|
def section_names(clause, num, lvl)
|
73
76
|
return num if clause.nil?
|
77
|
+
|
74
78
|
leaf_section?(clause) and label_leaf_section(clause, lvl) and return
|
75
79
|
num = num + 1
|
76
80
|
lbl = levelnumber(num, 1)
|
77
81
|
@anchors[clause["id"]] = { label: lbl, level: lvl, type: "clause",
|
82
|
+
elem: @labels["clause"],
|
78
83
|
xref: l10n("#{@labels['clause']} #{lbl}") }
|
79
84
|
i = 1
|
80
85
|
clause.xpath(ns(NONTERMINAL)).each do |c|
|
@@ -89,6 +94,7 @@ module IsoDoc
|
|
89
94
|
/\.(?<leafnum>[^.]+$)/ =~ num
|
90
95
|
clause["unnumbered"] == "true" or
|
91
96
|
@anchors[clause["id"]] = { label: leafnum, level: level, type: "clause",
|
97
|
+
elem: @labels["clause"],
|
92
98
|
xref: l10n("#{@labels['clause']} #{num}") }
|
93
99
|
i = 1
|
94
100
|
clause.xpath(ns(NONTERMINAL)).each do |c|
|
@@ -97,27 +103,32 @@ module IsoDoc
|
|
97
103
|
end
|
98
104
|
end
|
99
105
|
|
100
|
-
def annex_name_lbl(
|
106
|
+
def annex_name_lbl(_clause, num)
|
101
107
|
l10n("<strong>#{@labels['annex']} #{num}</strong>")
|
102
108
|
end
|
103
109
|
|
104
110
|
SUBCLAUSES =
|
105
111
|
"./clause | ./references | ./term | ./terms | ./definitions".freeze
|
106
112
|
|
113
|
+
def annex_name_anchors(clause, num)
|
114
|
+
{ label: annex_name_lbl(clause, num),
|
115
|
+
elem: @labels["annex"],
|
116
|
+
type: "clause", value: num.to_s, level: 1,
|
117
|
+
xref: "#{@labels['annex']} #{num}" }
|
118
|
+
end
|
107
119
|
|
108
120
|
def annex_names(clause, num)
|
109
121
|
hierarchical_asset_names(clause, num)
|
110
122
|
leaf_section?(clause) and
|
111
123
|
label_annex_leaf_section(clause, num, 1) and return
|
112
|
-
@anchors[clause["id"]] =
|
113
|
-
type: "clause", value: num,
|
114
|
-
xref: l10n("#{@labels['annex']} #{num}"), level: 1 }
|
124
|
+
@anchors[clause["id"]] = annex_name_anchors(clause, num)
|
115
125
|
if a = single_annex_special_section(clause)
|
116
|
-
annex_names1(a,
|
126
|
+
annex_names1(a, num.to_s, 1)
|
117
127
|
else
|
118
128
|
i = 1
|
119
129
|
clause.xpath(ns(SUBCLAUSES)).each do |c|
|
120
130
|
next if c["unnumbered"] == "true"
|
131
|
+
|
121
132
|
annex_names1(c, "#{num}.#{annex_levelnum(i, 2)}", 2)
|
122
133
|
i += 1 if !leaf_section?(c)
|
123
134
|
end
|
@@ -129,10 +140,11 @@ module IsoDoc
|
|
129
140
|
label_annex_leaf_section(clause, num, level) and return
|
130
141
|
/\.(?<leafnum>[^.]+$)/ =~ num
|
131
142
|
@anchors[clause["id"]] = { label: leafnum, xref: l10n("#{@labels['annex']} #{num}"),
|
132
|
-
level: level, type: "clause" }
|
143
|
+
level: level, type: "clause", elem: @labels["annex"] }
|
133
144
|
i = 1
|
134
145
|
clause.xpath(ns("./clause | ./references")).each do |c|
|
135
146
|
next if c["unnumbered"] == "true"
|
147
|
+
|
136
148
|
annex_names1(c, "#{num}.#{annex_levelnum(i, level + 1)}", level + 1)
|
137
149
|
i += 1 if !leaf_section?(c)
|
138
150
|
end
|
@@ -156,6 +168,7 @@ module IsoDoc
|
|
156
168
|
i = 0
|
157
169
|
clause.xpath(ns(".//admonition")).each do |t|
|
158
170
|
next if t["id"].nil? || t["id"].empty?
|
171
|
+
|
159
172
|
i += 1 unless t["unnumbered"] == "true"
|
160
173
|
@anchors[t["id"]] = anchor_struct(i.to_s, nil, @labels["admonition"],
|
161
174
|
"box", t["unnumbered"])
|
@@ -166,6 +179,7 @@ module IsoDoc
|
|
166
179
|
i = 0
|
167
180
|
clause.xpath(ns(".//admonition")).each do |t|
|
168
181
|
next if t["id"].nil? || t["id"].empty?
|
182
|
+
|
169
183
|
i += 1 unless t["unnumbered"] == "true"
|
170
184
|
@anchors[t["id"]] =
|
171
185
|
anchor_struct("#{num}.#{i}", nil, @labels["admonition"], "box",
|
@@ -173,9 +173,11 @@
|
|
173
173
|
<data type="dateTime"/>
|
174
174
|
</attribute>
|
175
175
|
</optional>
|
176
|
-
<
|
177
|
-
<
|
178
|
-
|
176
|
+
<optional>
|
177
|
+
<attribute name="from">
|
178
|
+
<data type="IDREF"/>
|
179
|
+
</attribute>
|
180
|
+
</optional>
|
179
181
|
<optional>
|
180
182
|
<attribute name="to">
|
181
183
|
<data type="IDREF"/>
|
data/lib/metanorma/un/biblio.rng
CHANGED
@@ -209,9 +209,6 @@
|
|
209
209
|
<zeroOrMore>
|
210
210
|
<ref name="contact"/>
|
211
211
|
</zeroOrMore>
|
212
|
-
<zeroOrMore>
|
213
|
-
<ref name="uri"/>
|
214
|
-
</zeroOrMore>
|
215
212
|
</element>
|
216
213
|
</define>
|
217
214
|
<define name="fullname">
|
@@ -401,9 +398,9 @@
|
|
401
398
|
<choice>
|
402
399
|
<!-- iso191606 TODO -->
|
403
400
|
<group>
|
404
|
-
<
|
401
|
+
<zeroOrMore>
|
405
402
|
<ref name="street"/>
|
406
|
-
</
|
403
|
+
</zeroOrMore>
|
407
404
|
<ref name="city"/>
|
408
405
|
<optional>
|
409
406
|
<ref name="state"/>
|
@@ -828,6 +825,11 @@
|
|
828
825
|
<optional>
|
829
826
|
<attribute name="scope"/>
|
830
827
|
</optional>
|
828
|
+
<optional>
|
829
|
+
<attribute name="primary">
|
830
|
+
<data type="boolean"/>
|
831
|
+
</attribute>
|
832
|
+
</optional>
|
831
833
|
<text/>
|
832
834
|
</element>
|
833
835
|
</define>
|
data/lib/metanorma/un/isodoc.rng
CHANGED
@@ -32,6 +32,56 @@
|
|
32
32
|
<ref name="DocumentType"/>
|
33
33
|
</element>
|
34
34
|
</define>
|
35
|
+
<define name="index">
|
36
|
+
<element name="index">
|
37
|
+
<optional>
|
38
|
+
<attribute name="to">
|
39
|
+
<data type="IDREF"/>
|
40
|
+
</attribute>
|
41
|
+
</optional>
|
42
|
+
<element name="primary">
|
43
|
+
<oneOrMore>
|
44
|
+
<choice>
|
45
|
+
<ref name="PureTextElement"/>
|
46
|
+
<ref name="stem"/>
|
47
|
+
</choice>
|
48
|
+
</oneOrMore>
|
49
|
+
</element>
|
50
|
+
<optional>
|
51
|
+
<element name="secondary">
|
52
|
+
<oneOrMore>
|
53
|
+
<choice>
|
54
|
+
<ref name="PureTextElement"/>
|
55
|
+
<ref name="stem"/>
|
56
|
+
</choice>
|
57
|
+
</oneOrMore>
|
58
|
+
</element>
|
59
|
+
</optional>
|
60
|
+
<optional>
|
61
|
+
<element name="tertiary">
|
62
|
+
<oneOrMore>
|
63
|
+
<choice>
|
64
|
+
<ref name="PureTextElement"/>
|
65
|
+
<ref name="stem"/>
|
66
|
+
</choice>
|
67
|
+
</oneOrMore>
|
68
|
+
</element>
|
69
|
+
</optional>
|
70
|
+
</element>
|
71
|
+
</define>
|
72
|
+
<define name="bibitem">
|
73
|
+
<element name="bibitem">
|
74
|
+
<attribute name="id">
|
75
|
+
<data type="ID"/>
|
76
|
+
</attribute>
|
77
|
+
<optional>
|
78
|
+
<attribute name="hidden">
|
79
|
+
<data type="boolean"/>
|
80
|
+
</attribute>
|
81
|
+
</optional>
|
82
|
+
<ref name="BibliographicItem"/>
|
83
|
+
</element>
|
84
|
+
</define>
|
35
85
|
<define name="section-title">
|
36
86
|
<element name="title">
|
37
87
|
<zeroOrMore>
|
@@ -102,9 +152,7 @@
|
|
102
152
|
<data type="boolean"/>
|
103
153
|
</attribute>
|
104
154
|
</optional>
|
105
|
-
<
|
106
|
-
<ref name="PureTextElement"/>
|
107
|
-
</oneOrMore>
|
155
|
+
<ref name="XrefBody"/>
|
108
156
|
</element>
|
109
157
|
</define>
|
110
158
|
<define name="erefType">
|
@@ -138,6 +186,42 @@
|
|
138
186
|
<ref name="PureTextElement"/>
|
139
187
|
</oneOrMore>
|
140
188
|
</define>
|
189
|
+
<define name="localityStack">
|
190
|
+
<element name="localityStack">
|
191
|
+
<optional>
|
192
|
+
<attribute name="connective">
|
193
|
+
<choice>
|
194
|
+
<value>and</value>
|
195
|
+
<value>or</value>
|
196
|
+
<value>from</value>
|
197
|
+
<value>to</value>
|
198
|
+
<value/>
|
199
|
+
</choice>
|
200
|
+
</attribute>
|
201
|
+
</optional>
|
202
|
+
<zeroOrMore>
|
203
|
+
<ref name="locality"/>
|
204
|
+
</zeroOrMore>
|
205
|
+
</element>
|
206
|
+
</define>
|
207
|
+
<define name="sourceLocalityStack">
|
208
|
+
<element name="sourceLocalityStack">
|
209
|
+
<optional>
|
210
|
+
<attribute name="connective">
|
211
|
+
<choice>
|
212
|
+
<value>and</value>
|
213
|
+
<value>or</value>
|
214
|
+
<value>from</value>
|
215
|
+
<value>to</value>
|
216
|
+
<value/>
|
217
|
+
</choice>
|
218
|
+
</attribute>
|
219
|
+
</optional>
|
220
|
+
<zeroOrMore>
|
221
|
+
<ref name="sourceLocality"/>
|
222
|
+
</zeroOrMore>
|
223
|
+
</element>
|
224
|
+
</define>
|
141
225
|
<define name="ul">
|
142
226
|
<element name="ul">
|
143
227
|
<attribute name="id">
|
@@ -690,6 +774,7 @@
|
|
690
774
|
<ref name="terms"/>
|
691
775
|
<ref name="term-clause"/>
|
692
776
|
<ref name="definitions"/>
|
777
|
+
<ref name="floating-title"/>
|
693
778
|
</choice>
|
694
779
|
</oneOrMore>
|
695
780
|
</element>
|
@@ -1013,6 +1098,26 @@
|
|
1013
1098
|
</zeroOrMore>
|
1014
1099
|
</element>
|
1015
1100
|
</define>
|
1101
|
+
<define name="sub">
|
1102
|
+
<element name="sub">
|
1103
|
+
<zeroOrMore>
|
1104
|
+
<choice>
|
1105
|
+
<ref name="PureTextElement"/>
|
1106
|
+
<ref name="stem"/>
|
1107
|
+
</choice>
|
1108
|
+
</zeroOrMore>
|
1109
|
+
</element>
|
1110
|
+
</define>
|
1111
|
+
<define name="sup">
|
1112
|
+
<element name="sup">
|
1113
|
+
<zeroOrMore>
|
1114
|
+
<choice>
|
1115
|
+
<ref name="PureTextElement"/>
|
1116
|
+
<ref name="stem"/>
|
1117
|
+
</choice>
|
1118
|
+
</zeroOrMore>
|
1119
|
+
</element>
|
1120
|
+
</define>
|
1016
1121
|
<define name="pagebreak">
|
1017
1122
|
<element name="pagebreak">
|
1018
1123
|
<optional>
|
@@ -1027,6 +1132,16 @@
|
|
1027
1132
|
</define>
|
1028
1133
|
</include>
|
1029
1134
|
<!-- end overrides -->
|
1135
|
+
<define name="image" combine="choice">
|
1136
|
+
<element name="svg">
|
1137
|
+
<oneOrMore>
|
1138
|
+
<choice>
|
1139
|
+
<text/>
|
1140
|
+
<ref name="AnyElement"/>
|
1141
|
+
</choice>
|
1142
|
+
</oneOrMore>
|
1143
|
+
</element>
|
1144
|
+
</define>
|
1030
1145
|
<define name="MultilingualRenderingType">
|
1031
1146
|
<choice>
|
1032
1147
|
<value>common</value>
|
@@ -1680,6 +1795,7 @@
|
|
1680
1795
|
<ref name="clause-subsection"/>
|
1681
1796
|
<ref name="terms"/>
|
1682
1797
|
<ref name="definitions"/>
|
1798
|
+
<ref name="floating-title"/>
|
1683
1799
|
</choice>
|
1684
1800
|
</oneOrMore>
|
1685
1801
|
</choice>
|
@@ -1722,6 +1838,7 @@
|
|
1722
1838
|
<ref name="terms"/>
|
1723
1839
|
<ref name="definitions"/>
|
1724
1840
|
<ref name="references"/>
|
1841
|
+
<ref name="floating-title"/>
|
1725
1842
|
</choice>
|
1726
1843
|
</zeroOrMore>
|
1727
1844
|
</group>
|
@@ -2200,7 +2317,18 @@
|
|
2200
2317
|
<ref name="MultilingualRenderingType"/>
|
2201
2318
|
</attribute>
|
2202
2319
|
</optional>
|
2203
|
-
<
|
2320
|
+
<oneOrMore>
|
2321
|
+
<choice>
|
2322
|
+
<ref name="formula"/>
|
2323
|
+
<ref name="ul"/>
|
2324
|
+
<ref name="ol"/>
|
2325
|
+
<ref name="dl"/>
|
2326
|
+
<ref name="quote"/>
|
2327
|
+
<ref name="sourcecode"/>
|
2328
|
+
<ref name="paragraph"/>
|
2329
|
+
<ref name="figure"/>
|
2330
|
+
</choice>
|
2331
|
+
</oneOrMore>
|
2204
2332
|
</element>
|
2205
2333
|
</define>
|
2206
2334
|
<define name="termsource">
|
@@ -2534,4 +2662,43 @@
|
|
2534
2662
|
</oneOrMore>
|
2535
2663
|
</element>
|
2536
2664
|
</define>
|
2665
|
+
<define name="floating-title">
|
2666
|
+
<element name="floating-title">
|
2667
|
+
<attribute name="id">
|
2668
|
+
<data type="ID"/>
|
2669
|
+
</attribute>
|
2670
|
+
<attribute name="depth">
|
2671
|
+
<data type="int"/>
|
2672
|
+
</attribute>
|
2673
|
+
<zeroOrMore>
|
2674
|
+
<ref name="TextElement"/>
|
2675
|
+
</zeroOrMore>
|
2676
|
+
</element>
|
2677
|
+
</define>
|
2678
|
+
<define name="XrefBody">
|
2679
|
+
<zeroOrMore>
|
2680
|
+
<ref name="XrefTarget"/>
|
2681
|
+
</zeroOrMore>
|
2682
|
+
<oneOrMore>
|
2683
|
+
<ref name="PureTextElement"/>
|
2684
|
+
</oneOrMore>
|
2685
|
+
</define>
|
2686
|
+
<define name="XrefTarget">
|
2687
|
+
<element name="location">
|
2688
|
+
<attribute name="target">
|
2689
|
+
<data type="string">
|
2690
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
2691
|
+
</data>
|
2692
|
+
</attribute>
|
2693
|
+
<attribute name="connective">
|
2694
|
+
<choice>
|
2695
|
+
<value>and</value>
|
2696
|
+
<value>or</value>
|
2697
|
+
<value>from</value>
|
2698
|
+
<value>to</value>
|
2699
|
+
<value/>
|
2700
|
+
</choice>
|
2701
|
+
</attribute>
|
2702
|
+
</element>
|
2703
|
+
</define>
|
2537
2704
|
</grammar>
|
data/lib/metanorma/un/un.rng
CHANGED
@@ -96,7 +96,10 @@
|
|
96
96
|
<define name="sections">
|
97
97
|
<element name="sections">
|
98
98
|
<oneOrMore>
|
99
|
-
<
|
99
|
+
<choice>
|
100
|
+
<ref name="clause"/>
|
101
|
+
<ref name="floating-title"/>
|
102
|
+
</choice>
|
100
103
|
</oneOrMore>
|
101
104
|
</element>
|
102
105
|
</define>
|
@@ -186,6 +189,7 @@
|
|
186
189
|
<ref name="clause-subsection"/>
|
187
190
|
<ref name="terms"/>
|
188
191
|
<ref name="definitions"/>
|
192
|
+
<ref name="floating-title"/>
|
189
193
|
</choice>
|
190
194
|
</zeroOrMore>
|
191
195
|
</group>
|
@@ -233,6 +237,7 @@
|
|
233
237
|
<ref name="terms"/>
|
234
238
|
<ref name="definitions"/>
|
235
239
|
<ref name="references"/>
|
240
|
+
<ref name="floating-title"/>
|
236
241
|
</choice>
|
237
242
|
</zeroOrMore>
|
238
243
|
</group>
|
data/lib/metanorma/un/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metanorma-un
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ribose Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: iso-639
|