metanorma-un 0.4.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/asciidoctor/un/basicdoc.rng +31 -1
- data/lib/asciidoctor/un/converter.rb +47 -59
- data/lib/asciidoctor/un/isodoc.rng +124 -15
- data/lib/asciidoctor/un/validate.rb +2 -1
- data/lib/isodoc/un/base_convert.rb +3 -58
- data/lib/isodoc/un/html/htmlstyle.css +1096 -0
- data/lib/isodoc/un/html/unece.css +830 -0
- data/lib/isodoc/un/html/unece.scss +18 -4
- data/lib/isodoc/un/html/wordstyle.css +1237 -0
- data/lib/isodoc/un/html_convert.rb +10 -21
- data/lib/isodoc/un/i18n-en.yaml +2 -0
- data/lib/isodoc/un/i18n.rb +11 -0
- data/lib/isodoc/un/init.rb +29 -0
- data/lib/isodoc/un/metadata.rb +23 -12
- data/lib/isodoc/un/presentation_xml_convert.rb +44 -1
- data/lib/isodoc/un/un.plenary-attachment.xsl +2043 -2168
- data/lib/isodoc/un/un.plenary.xsl +2043 -2168
- data/lib/isodoc/un/un.recommendation.xsl +2118 -11739
- data/lib/isodoc/un/word_convert.rb +18 -23
- data/lib/isodoc/un/xref.rb +7 -8
- data/lib/metanorma/un/version.rb +1 -1
- data/metanorma-unece.gemspec +2 -4
- metadata +12 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 774afb2e0ab41456a24cba9f9fbac69a115a34e1f746fe54a07f10b22681f22f
|
4
|
+
data.tar.gz: 3c215cc2b94107c28c5783c97e06f045b739079957e2fa55877021ff836a392f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e9934f37702e647338e603c00355a087f957537110fc56d0ba61689c49355b63b9bd31178c6a943cb8a528db6c496ab25fdc44399b27fce0c15a5c8f789f26d
|
7
|
+
data.tar.gz: 90b85724afcbb49af22b4c18648074675a3f16adb22bca9579eec2af4fc674b0f3db3dbee89edd1988492d2d2351d8f06018ab1a7557a1ed31c3be9249ae3cad
|
@@ -158,7 +158,17 @@
|
|
158
158
|
<data type="ID"/>
|
159
159
|
</attribute>
|
160
160
|
<oneOrMore>
|
161
|
-
<
|
161
|
+
<choice>
|
162
|
+
<ref name="formula"/>
|
163
|
+
<ref name="ul"/>
|
164
|
+
<ref name="ol"/>
|
165
|
+
<ref name="dl"/>
|
166
|
+
<ref name="quote"/>
|
167
|
+
<ref name="sourcecode"/>
|
168
|
+
<ref name="paragraph"/>
|
169
|
+
<ref name="table"/>
|
170
|
+
<ref name="figure"/>
|
171
|
+
</choice>
|
162
172
|
</oneOrMore>
|
163
173
|
</element>
|
164
174
|
</define>
|
@@ -402,6 +412,16 @@
|
|
402
412
|
</choice>
|
403
413
|
</attribute>
|
404
414
|
</optional>
|
415
|
+
<optional>
|
416
|
+
<attribute name="valign">
|
417
|
+
<choice>
|
418
|
+
<value>top</value>
|
419
|
+
<value>middle</value>
|
420
|
+
<value>bottom</value>
|
421
|
+
<value>baseline</value>
|
422
|
+
</choice>
|
423
|
+
</attribute>
|
424
|
+
</optional>
|
405
425
|
<choice>
|
406
426
|
<zeroOrMore>
|
407
427
|
<ref name="TextElement"/>
|
@@ -429,6 +449,16 @@
|
|
429
449
|
</choice>
|
430
450
|
</attribute>
|
431
451
|
</optional>
|
452
|
+
<optional>
|
453
|
+
<attribute name="valign">
|
454
|
+
<choice>
|
455
|
+
<value>top</value>
|
456
|
+
<value>middle</value>
|
457
|
+
<value>bottom</value>
|
458
|
+
<value>baseline</value>
|
459
|
+
</choice>
|
460
|
+
</attribute>
|
461
|
+
</optional>
|
432
462
|
<choice>
|
433
463
|
<zeroOrMore>
|
434
464
|
<ref name="TextElement"/>
|
@@ -5,34 +5,14 @@ require_relative "validate"
|
|
5
5
|
|
6
6
|
module Asciidoctor
|
7
7
|
module UN
|
8
|
-
|
9
|
-
# A {Converter} implementation that generates RSD output, and a document
|
10
|
-
# schema encapsulation of the document for validation
|
11
|
-
#
|
12
8
|
class Converter < Standoc::Converter
|
13
9
|
XML_ROOT_TAG = "un-standard".freeze
|
14
10
|
XML_NAMESPACE = "https://www.metanorma.org/ns/un".freeze
|
15
11
|
|
16
12
|
register_for "un"
|
17
13
|
|
18
|
-
def
|
19
|
-
|
20
|
-
c.role **{ type: "author" }
|
21
|
-
c.organization do |a|
|
22
|
-
a.name Metanorma::UN::ORGANIZATION_NAME_LONG
|
23
|
-
a.abbreviation Metanorma::UN::ORGANIZATION_NAME_SHORT
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def metadata_publisher(node, xml)
|
29
|
-
xml.contributor do |c|
|
30
|
-
c.role **{ type: "publisher" }
|
31
|
-
c.organization do |a|
|
32
|
-
a.name Metanorma::UN::ORGANIZATION_NAME_LONG
|
33
|
-
a.abbreviation Metanorma::UN::ORGANIZATION_NAME_SHORT
|
34
|
-
end
|
35
|
-
end
|
14
|
+
def default_publisher
|
15
|
+
"United Nations"
|
36
16
|
end
|
37
17
|
|
38
18
|
def metadata_committee(node, xml)
|
@@ -49,41 +29,35 @@ module Asciidoctor
|
|
49
29
|
end
|
50
30
|
end
|
51
31
|
|
32
|
+
def asciidoc_sub(text)
|
33
|
+
Asciidoctor::Standoc::Utils::asciidoc_sub(text)
|
34
|
+
end
|
35
|
+
|
52
36
|
def title(node, xml)
|
53
37
|
["en"].each do |lang|
|
54
|
-
xml.title **{ type: "main", language: lang,
|
55
|
-
|
38
|
+
xml.title **{ type: "main", language: lang,
|
39
|
+
format: "text/plain" } do |t|
|
40
|
+
t << (asciidoc_sub(node.attr("title")) || node.title)
|
56
41
|
end
|
57
42
|
node.attr("subtitle") and
|
58
|
-
xml.title **{ type: "subtitle", language: lang,
|
59
|
-
|
60
|
-
|
43
|
+
xml.title **{ type: "subtitle", language: lang,
|
44
|
+
format: "text/plain" } do |t|
|
45
|
+
t << asciidoc_sub(node.attr("subtitle"))
|
46
|
+
end
|
61
47
|
end
|
62
48
|
end
|
63
49
|
|
64
50
|
def metadata_id(node, xml)
|
65
51
|
dn = node.attr("docnumber")
|
66
52
|
if docstatus = node.attr("status")
|
67
|
-
abbr = IsoDoc::UN::Metadata.new("en", "Latn",
|
53
|
+
abbr = IsoDoc::UN::Metadata.new("en", "Latn", @i18n)
|
54
|
+
.stage_abbr(docstatus)
|
68
55
|
dn = "#{dn}(#{abbr})" unless abbr.empty?
|
69
56
|
end
|
70
57
|
xml.docidentifier { |i| i << dn }
|
71
58
|
xml.docnumber { |i| i << node.attr("docnumber") }
|
72
59
|
end
|
73
60
|
|
74
|
-
def metadata_copyright(node, xml)
|
75
|
-
from = node.attr("copyright-year") || Date.today.year
|
76
|
-
xml.copyright do |c|
|
77
|
-
c.from from
|
78
|
-
c.owner do |owner|
|
79
|
-
owner.organization do |o|
|
80
|
-
o.name Metanorma::UN::ORGANIZATION_NAME_LONG
|
81
|
-
o.abbreviation Metanorma::UN::ORGANIZATION_NAME_SHORT
|
82
|
-
end
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
87
61
|
def metadata_distribution(node, xml)
|
88
62
|
xml.distribution node.attr("distribution") if node.attr("distribution")
|
89
63
|
end
|
@@ -92,17 +66,26 @@ module Asciidoctor
|
|
92
66
|
xml.session do |session|
|
93
67
|
session.number node.attr("session") if node.attr("session")
|
94
68
|
session.date node.attr("session-date") if node.attr("session-date")
|
95
|
-
node&.attr("item-number")&.split(/,[ ]*/)&.each
|
96
|
-
|
97
|
-
|
98
|
-
|
69
|
+
node&.attr("item-number")&.split(/,[ ]*/)&.each do |i|
|
70
|
+
session.item_number i
|
71
|
+
end
|
72
|
+
node&.attr("item-name")&.split(/,[ ]*/)&.each do |i|
|
73
|
+
session.item_name i
|
74
|
+
end
|
75
|
+
node&.attr("subitem-name")&.split(/,[ ]*/)&.each do |i|
|
76
|
+
session.subitem_name i
|
77
|
+
end
|
78
|
+
node.attr("collaborator") and
|
79
|
+
session.collaborator node.attr("collaborator")
|
99
80
|
session.id node.attr("agenda-id") if node.attr("agenda-id")
|
100
|
-
|
81
|
+
node.attr("item-footnote") and
|
82
|
+
session.item_footnote node.attr("item-footnote")
|
101
83
|
end
|
102
84
|
end
|
103
85
|
|
104
86
|
def metadata_language(node, xml)
|
105
|
-
languages = node&.attr("language")&.split(/,[ ]*/) ||
|
87
|
+
languages = node&.attr("language")&.split(/,[ ]*/) ||
|
88
|
+
%w(ar ru en fr zh es)
|
106
89
|
languages.each { |l| xml.language l }
|
107
90
|
end
|
108
91
|
|
@@ -124,15 +107,19 @@ module Asciidoctor
|
|
124
107
|
|
125
108
|
def makexml(node)
|
126
109
|
@draft = node.attributes.has_key?("draft")
|
127
|
-
@no_number_subheadings =
|
110
|
+
@no_number_subheadings =
|
111
|
+
node.attributes.has_key?("do-not-number-subheadings")
|
128
112
|
super
|
129
113
|
end
|
130
114
|
|
131
115
|
def doctype(node)
|
132
|
-
d =
|
133
|
-
unless %w{plenary recommendation addendum communication corrigendum
|
134
|
-
agenda budgetary sec-gen-notes expert-report resolution
|
135
|
-
|
116
|
+
d = super
|
117
|
+
unless %w{plenary recommendation addendum communication corrigendum
|
118
|
+
reissue agenda budgetary sec-gen-notes expert-report resolution
|
119
|
+
plenary-attachment}.include? d
|
120
|
+
@log.add(
|
121
|
+
"Document Attributes", nil,
|
122
|
+
"#{d} is not a legal document type: reverting to 'recommendation'")
|
136
123
|
d = "recommendation"
|
137
124
|
end
|
138
125
|
d
|
@@ -141,9 +128,12 @@ module Asciidoctor
|
|
141
128
|
def outputs(node, ret)
|
142
129
|
File.open(@filename + ".xml", "w:UTF-8") { |f| f.write(ret) }
|
143
130
|
presentation_xml_converter(node).convert(@filename + ".xml")
|
144
|
-
html_converter(node).convert(@filename + ".presentation.xml",
|
145
|
-
|
146
|
-
|
131
|
+
html_converter(node).convert(@filename + ".presentation.xml",
|
132
|
+
nil, false, "#{@filename}.html")
|
133
|
+
doc_converter(node).convert(@filename + ".presentation.xml",
|
134
|
+
nil, false, "#{@filename}.doc")
|
135
|
+
pdf_converter(node)&.convert(@filename + ".presentation.xml",
|
136
|
+
nil, false, "#{@filename}.pdf")
|
147
137
|
end
|
148
138
|
|
149
139
|
def validate(doc)
|
@@ -217,10 +207,8 @@ module Asciidoctor
|
|
217
207
|
end
|
218
208
|
|
219
209
|
def admonition_attrs(node)
|
220
|
-
attr_code(super.merge(
|
221
|
-
|
222
|
-
"subsequence": node.attr("subsequence"),
|
223
|
-
))
|
210
|
+
attr_code(super.merge("unnumbered": node.option?("unnumbered"),
|
211
|
+
"subsequence": node.attr("subsequence")))
|
224
212
|
end
|
225
213
|
|
226
214
|
def sectiontype_streamline(ret)
|
@@ -42,8 +42,11 @@
|
|
42
42
|
</define>
|
43
43
|
<define name="xref">
|
44
44
|
<element name="xref">
|
45
|
+
<!-- attribute target { xsd:IDREF }, -->
|
45
46
|
<attribute name="target">
|
46
|
-
<data type="
|
47
|
+
<data type="string">
|
48
|
+
<param name="pattern">\i\c*|\c+#\c+</param>
|
49
|
+
</data>
|
47
50
|
</attribute>
|
48
51
|
<optional>
|
49
52
|
<attribute name="type">
|
@@ -578,6 +581,8 @@
|
|
578
581
|
<ref name="ol"/>
|
579
582
|
<ref name="dl"/>
|
580
583
|
<ref name="formula"/>
|
584
|
+
<ref name="quote"/>
|
585
|
+
<ref name="sourcecode"/>
|
581
586
|
</choice>
|
582
587
|
</oneOrMore>
|
583
588
|
</element>
|
@@ -661,6 +666,16 @@
|
|
661
666
|
</choice>
|
662
667
|
</attribute>
|
663
668
|
</optional>
|
669
|
+
<optional>
|
670
|
+
<attribute name="valign">
|
671
|
+
<choice>
|
672
|
+
<value>top</value>
|
673
|
+
<value>middle</value>
|
674
|
+
<value>bottom</value>
|
675
|
+
<value>baseline</value>
|
676
|
+
</choice>
|
677
|
+
</attribute>
|
678
|
+
</optional>
|
664
679
|
<choice>
|
665
680
|
<zeroOrMore>
|
666
681
|
<choice>
|
@@ -697,6 +712,16 @@
|
|
697
712
|
</choice>
|
698
713
|
</attribute>
|
699
714
|
</optional>
|
715
|
+
<optional>
|
716
|
+
<attribute name="valign">
|
717
|
+
<choice>
|
718
|
+
<value>top</value>
|
719
|
+
<value>middle</value>
|
720
|
+
<value>bottom</value>
|
721
|
+
<value>baseline</value>
|
722
|
+
</choice>
|
723
|
+
</attribute>
|
724
|
+
</optional>
|
700
725
|
<choice>
|
701
726
|
<zeroOrMore>
|
702
727
|
<choice>
|
@@ -922,6 +947,9 @@
|
|
922
947
|
<optional>
|
923
948
|
<attribute name="script"/>
|
924
949
|
</optional>
|
950
|
+
<optional>
|
951
|
+
<attribute name="type"/>
|
952
|
+
</optional>
|
925
953
|
<optional>
|
926
954
|
<attribute name="obligation">
|
927
955
|
<choice>
|
@@ -961,9 +989,6 @@
|
|
961
989
|
</define>
|
962
990
|
<define name="content-subsection">
|
963
991
|
<element name="clause">
|
964
|
-
<optional>
|
965
|
-
<attribute name="type"/>
|
966
|
-
</optional>
|
967
992
|
<ref name="Content-Section"/>
|
968
993
|
</element>
|
969
994
|
</define>
|
@@ -992,6 +1017,9 @@
|
|
992
1017
|
</choice>
|
993
1018
|
</attribute>
|
994
1019
|
</optional>
|
1020
|
+
<optional>
|
1021
|
+
<attribute name="type"/>
|
1022
|
+
</optional>
|
995
1023
|
<optional>
|
996
1024
|
<ref name="section-title"/>
|
997
1025
|
</optional>
|
@@ -1011,9 +1039,6 @@
|
|
1011
1039
|
</define>
|
1012
1040
|
<define name="clause">
|
1013
1041
|
<element name="clause">
|
1014
|
-
<optional>
|
1015
|
-
<attribute name="type"/>
|
1016
|
-
</optional>
|
1017
1042
|
<ref name="Clause-Section"/>
|
1018
1043
|
</element>
|
1019
1044
|
</define>
|
@@ -1042,18 +1067,24 @@
|
|
1042
1067
|
</choice>
|
1043
1068
|
</attribute>
|
1044
1069
|
</optional>
|
1070
|
+
<optional>
|
1071
|
+
<attribute name="type"/>
|
1072
|
+
</optional>
|
1045
1073
|
<optional>
|
1046
1074
|
<ref name="section-title"/>
|
1047
1075
|
</optional>
|
1048
1076
|
<group>
|
1049
|
-
<
|
1050
|
-
<
|
1051
|
-
<
|
1052
|
-
|
1053
|
-
|
1054
|
-
<
|
1055
|
-
|
1056
|
-
|
1077
|
+
<choice>
|
1078
|
+
<group>
|
1079
|
+
<zeroOrMore>
|
1080
|
+
<ref name="BasicBlock"/>
|
1081
|
+
</zeroOrMore>
|
1082
|
+
<zeroOrMore>
|
1083
|
+
<ref name="note"/>
|
1084
|
+
</zeroOrMore>
|
1085
|
+
</group>
|
1086
|
+
<ref name="amend"/>
|
1087
|
+
</choice>
|
1057
1088
|
<zeroOrMore>
|
1058
1089
|
<choice>
|
1059
1090
|
<ref name="clause-subsection"/>
|
@@ -1180,6 +1211,9 @@
|
|
1180
1211
|
<optional>
|
1181
1212
|
<attribute name="script"/>
|
1182
1213
|
</optional>
|
1214
|
+
<optional>
|
1215
|
+
<attribute name="type"/>
|
1216
|
+
</optional>
|
1183
1217
|
<optional>
|
1184
1218
|
<attribute name="obligation">
|
1185
1219
|
<choice>
|
@@ -1501,4 +1535,79 @@
|
|
1501
1535
|
<ref name="CitationType"/>
|
1502
1536
|
</element>
|
1503
1537
|
</define>
|
1538
|
+
<define name="amend">
|
1539
|
+
<element name="amend">
|
1540
|
+
<optional>
|
1541
|
+
<attribute name="id">
|
1542
|
+
<data type="ID"/>
|
1543
|
+
</attribute>
|
1544
|
+
</optional>
|
1545
|
+
<attribute name="change">
|
1546
|
+
<choice>
|
1547
|
+
<value>add</value>
|
1548
|
+
<value>modify</value>
|
1549
|
+
<value>delete</value>
|
1550
|
+
</choice>
|
1551
|
+
</attribute>
|
1552
|
+
<optional>
|
1553
|
+
<attribute name="path"/>
|
1554
|
+
</optional>
|
1555
|
+
<optional>
|
1556
|
+
<attribute name="path_end"/>
|
1557
|
+
</optional>
|
1558
|
+
<optional>
|
1559
|
+
<attribute name="title"/>
|
1560
|
+
</optional>
|
1561
|
+
<optional>
|
1562
|
+
<element name="location">
|
1563
|
+
<zeroOrMore>
|
1564
|
+
<ref name="locality"/>
|
1565
|
+
</zeroOrMore>
|
1566
|
+
</element>
|
1567
|
+
</optional>
|
1568
|
+
<zeroOrMore>
|
1569
|
+
<ref name="autonumber"/>
|
1570
|
+
</zeroOrMore>
|
1571
|
+
<optional>
|
1572
|
+
<element name="description">
|
1573
|
+
<zeroOrMore>
|
1574
|
+
<ref name="BasicBlock"/>
|
1575
|
+
</zeroOrMore>
|
1576
|
+
</element>
|
1577
|
+
</optional>
|
1578
|
+
<optional>
|
1579
|
+
<element name="newcontent">
|
1580
|
+
<zeroOrMore>
|
1581
|
+
<ref name="BasicBlock"/>
|
1582
|
+
</zeroOrMore>
|
1583
|
+
</element>
|
1584
|
+
</optional>
|
1585
|
+
<optional>
|
1586
|
+
<element name="description">
|
1587
|
+
<zeroOrMore>
|
1588
|
+
<ref name="BasicBlock"/>
|
1589
|
+
</zeroOrMore>
|
1590
|
+
</element>
|
1591
|
+
</optional>
|
1592
|
+
</element>
|
1593
|
+
</define>
|
1594
|
+
<define name="autonumber">
|
1595
|
+
<element name="autonumber">
|
1596
|
+
<attribute name="type">
|
1597
|
+
<choice>
|
1598
|
+
<value>requirement</value>
|
1599
|
+
<value>recommendation</value>
|
1600
|
+
<value>permission</value>
|
1601
|
+
<value>table</value>
|
1602
|
+
<value>figure</value>
|
1603
|
+
<value>admonition</value>
|
1604
|
+
<value>formula</value>
|
1605
|
+
<value>sourcecode</value>
|
1606
|
+
<value>example</value>
|
1607
|
+
<value>note</value>
|
1608
|
+
</choice>
|
1609
|
+
</attribute>
|
1610
|
+
<text/>
|
1611
|
+
</element>
|
1612
|
+
</define>
|
1504
1613
|
</grammar>
|