metanorma-un 0.9.8.1 → 0.9.9
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/init.rb +5 -4
- data/lib/isodoc/un/metadata.rb +17 -18
- data/lib/isodoc/un/un.plenary-attachment.xsl +12 -0
- data/lib/isodoc/un/un.plenary.xsl +12 -0
- data/lib/isodoc/un/un.recommendation.xsl +12 -0
- data/lib/isodoc/un/xref.rb +9 -0
- data/lib/metanorma/un/biblio.rng +32 -1
- data/lib/metanorma/un/converter.rb +4 -4
- data/lib/metanorma/un/version.rb +1 -1
- data/metanorma-un.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4134dee9f7b858f16da13effd1f60fcec62c1b81c7d1cb6fb00bf14851839fe
|
4
|
+
data.tar.gz: 1ca85dfad1fa39a2d5094b62a74f0ed13ce5727368cc1536c3d702e610e1c752
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3164723cc1fd0cc5d20195f4d7d52582585dd0c030763554dc819407c3705bef35d93020d257c26d0c3e8ee65cf079af55768c7639c11a403f62139850ef87d5
|
7
|
+
data.tar.gz: 2214521c8a53956cc2960db30b4fdf875358dff48a8db4179794b4bf828d32ef7f35f734dcadb602147431397788989f64f00615a0b6cad7d940bf8df03e93b7
|
data/lib/isodoc/un/init.rb
CHANGED
@@ -6,8 +6,8 @@ require_relative "i18n"
|
|
6
6
|
module IsoDoc
|
7
7
|
module UN
|
8
8
|
module Init
|
9
|
-
def metadata_init(lang, script, labels)
|
10
|
-
@meta = Metadata.new(lang, script, labels)
|
9
|
+
def metadata_init(lang, script, locale, labels)
|
10
|
+
@meta = Metadata.new(lang, script, locale, labels)
|
11
11
|
@meta.set(:toc, @toc)
|
12
12
|
end
|
13
13
|
|
@@ -16,8 +16,9 @@ module IsoDoc
|
|
16
16
|
@xrefs = Xref.new(lang, script, html, labels, options)
|
17
17
|
end
|
18
18
|
|
19
|
-
def i18n_init(lang, script, i18nyaml = nil)
|
20
|
-
@i18n = I18n.new(lang, script,
|
19
|
+
def i18n_init(lang, script, locale, i18nyaml = nil)
|
20
|
+
@i18n = I18n.new(lang, script, locale: locale,
|
21
|
+
i18nyaml: i18nyaml || @i18nyaml)
|
21
22
|
end
|
22
23
|
|
23
24
|
def fileloc(loc)
|
data/lib/isodoc/un/metadata.rb
CHANGED
@@ -4,9 +4,8 @@ require "iso-639"
|
|
4
4
|
|
5
5
|
module IsoDoc
|
6
6
|
module UN
|
7
|
-
|
8
7
|
class Metadata < IsoDoc::Metadata
|
9
|
-
def initialize(lang, script, labels)
|
8
|
+
def initialize(lang, script, locale, labels)
|
10
9
|
super
|
11
10
|
here = File.dirname(__FILE__)
|
12
11
|
set(:logo, File.expand_path(File.join(here, "html", "logo.jpg")))
|
@@ -27,8 +26,8 @@ module IsoDoc
|
|
27
26
|
def extract_languages(nodeset)
|
28
27
|
lgs = []
|
29
28
|
nodeset.each do |l|
|
30
|
-
l && ISO_639
|
31
|
-
lgs << ISO_639.find(l.text).english_name
|
29
|
+
l && ISO_639.find(l.text)&.english_name and
|
30
|
+
lgs << ISO_639.find(l.text).english_name
|
32
31
|
end
|
33
32
|
lgs.map { |l| l == "Spanish; Castilian" ? "Spanish" : l }
|
34
33
|
end
|
@@ -36,7 +35,7 @@ module IsoDoc
|
|
36
35
|
def author(isoxml, _out)
|
37
36
|
tc = isoxml.at(ns("//bibdata/ext/editorialgroup/committee"))
|
38
37
|
set(:tc, tc.text) if tc
|
39
|
-
set(:distribution, isoxml
|
38
|
+
set(:distribution, isoxml.at(ns("//bibdata/ext/distribution"))&.text)
|
40
39
|
lgs = extract_languages(isoxml.xpath(ns("//bibdata/language")))
|
41
40
|
lgs.sort == %w(English French Arabic Chinese Russian Spanish).sort and
|
42
41
|
lgs = []
|
@@ -56,23 +55,23 @@ module IsoDoc
|
|
56
55
|
end
|
57
56
|
|
58
57
|
def session(isoxml, _out)
|
59
|
-
set(:session_number, isoxml
|
60
|
-
text&.to_i&.localize
|
61
|
-
to_rbnf_s("SpelloutRules", "spellout-ordinal")&.capitalize)
|
62
|
-
set(:session_date, isoxml
|
58
|
+
set(:session_number, isoxml.at(ns("//bibdata/ext/session/number"))
|
59
|
+
&.text&.to_i&.localize
|
60
|
+
&.to_rbnf_s("SpelloutRules", "spellout-ordinal")&.capitalize)
|
61
|
+
set(:session_date, isoxml.at(ns("//bibdata/ext/session/date"))&.text)
|
63
62
|
set(:session_collaborator,
|
64
|
-
isoxml
|
65
|
-
sid = isoxml
|
63
|
+
isoxml.at(ns("//bibdata/ext/session/collaborator"))&.text)
|
64
|
+
sid = isoxml.at(ns("//bibdata/ext/session/id"))&.text
|
66
65
|
set(:session_id, sid)
|
67
66
|
set(:session_id_head, sid&.sub(%r{/.*$}, ""))
|
68
67
|
set(:session_id_tail, sid&.sub(%r{^[^/]+}, ""))
|
69
|
-
set(:item_footnote,
|
70
|
-
isoxml
|
71
|
-
set(:session_itemnumber,
|
68
|
+
set(:item_footnote,
|
69
|
+
isoxml.at(ns("//bibdata/ext/session/item-footnote"))&.text)
|
70
|
+
set(:session_itemnumber,
|
72
71
|
multival(isoxml, "//bibdata/ext/session/item-number"))
|
73
|
-
set(:session_itemname,
|
72
|
+
set(:session_itemname,
|
74
73
|
multival(isoxml, "//bibdata/ext/session/item-name"))
|
75
|
-
set(:session_subitemname,
|
74
|
+
set(:session_subitemname,
|
76
75
|
multival(isoxml, "//bibdata/ext/session/subitem-name"))
|
77
76
|
end
|
78
77
|
|
@@ -80,8 +79,8 @@ module IsoDoc
|
|
80
79
|
dn = isoxml.at(ns("//bibdata/docidentifier"))&.text
|
81
80
|
set(:docnumber, dn)
|
82
81
|
type = isoxml&.at(ns("//bibdata/ext/doctype"))&.text
|
83
|
-
set(:formatted_docnumber,
|
84
|
-
"UN/CEFACT Recommendation #{dn}" : dn)
|
82
|
+
set(:formatted_docnumber,
|
83
|
+
type == "recommendation" ? "UN/CEFACT Recommendation #{dn}" : dn)
|
85
84
|
end
|
86
85
|
|
87
86
|
def stage_abbr(status)
|
@@ -6542,6 +6542,18 @@
|
|
6542
6542
|
</xsl:copy>
|
6543
6543
|
</xsl:template>
|
6544
6544
|
|
6545
|
+
<xsl:template match="*[local-name() = 'sub']" mode="contents_item">
|
6546
|
+
<xsl:copy>
|
6547
|
+
<xsl:apply-templates mode="contents_item"/>
|
6548
|
+
</xsl:copy>
|
6549
|
+
</xsl:template>
|
6550
|
+
|
6551
|
+
<xsl:template match="*[local-name() = 'sup']" mode="contents_item">
|
6552
|
+
<xsl:copy>
|
6553
|
+
<xsl:apply-templates mode="contents_item"/>
|
6554
|
+
</xsl:copy>
|
6555
|
+
</xsl:template>
|
6556
|
+
|
6545
6557
|
<xsl:template match="*[local-name() = 'stem']" mode="contents_item">
|
6546
6558
|
<xsl:copy-of select="."/>
|
6547
6559
|
</xsl:template>
|
@@ -6542,6 +6542,18 @@
|
|
6542
6542
|
</xsl:copy>
|
6543
6543
|
</xsl:template>
|
6544
6544
|
|
6545
|
+
<xsl:template match="*[local-name() = 'sub']" mode="contents_item">
|
6546
|
+
<xsl:copy>
|
6547
|
+
<xsl:apply-templates mode="contents_item"/>
|
6548
|
+
</xsl:copy>
|
6549
|
+
</xsl:template>
|
6550
|
+
|
6551
|
+
<xsl:template match="*[local-name() = 'sup']" mode="contents_item">
|
6552
|
+
<xsl:copy>
|
6553
|
+
<xsl:apply-templates mode="contents_item"/>
|
6554
|
+
</xsl:copy>
|
6555
|
+
</xsl:template>
|
6556
|
+
|
6545
6557
|
<xsl:template match="*[local-name() = 'stem']" mode="contents_item">
|
6546
6558
|
<xsl:copy-of select="."/>
|
6547
6559
|
</xsl:template>
|
@@ -6622,6 +6622,18 @@
|
|
6622
6622
|
</xsl:copy>
|
6623
6623
|
</xsl:template>
|
6624
6624
|
|
6625
|
+
<xsl:template match="*[local-name() = 'sub']" mode="contents_item">
|
6626
|
+
<xsl:copy>
|
6627
|
+
<xsl:apply-templates mode="contents_item"/>
|
6628
|
+
</xsl:copy>
|
6629
|
+
</xsl:template>
|
6630
|
+
|
6631
|
+
<xsl:template match="*[local-name() = 'sup']" mode="contents_item">
|
6632
|
+
<xsl:copy>
|
6633
|
+
<xsl:apply-templates mode="contents_item"/>
|
6634
|
+
</xsl:copy>
|
6635
|
+
</xsl:template>
|
6636
|
+
|
6625
6637
|
<xsl:template match="*[local-name() = 'stem']" mode="contents_item">
|
6626
6638
|
<xsl:copy-of select="."/>
|
6627
6639
|
</xsl:template>
|
data/lib/isodoc/un/xref.rb
CHANGED
@@ -25,6 +25,15 @@ module IsoDoc
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def asset_anchor_names(doc)
|
29
|
+
super
|
30
|
+
@parse_settings.empty? or return
|
31
|
+
sequential_asset_names(
|
32
|
+
doc.xpath(ns("//preface/abstract | //foreword | //introduction | "\
|
33
|
+
"//preface/clause | //acknowledgements")),
|
34
|
+
)
|
35
|
+
end
|
36
|
+
|
28
37
|
def clause_names(docxml, _sect_num)
|
29
38
|
q = "//clause[parent::sections]"
|
30
39
|
@paranumber = 0
|
data/lib/metanorma/un/biblio.rng
CHANGED
@@ -73,8 +73,14 @@
|
|
73
73
|
<text/>
|
74
74
|
</element>
|
75
75
|
</define>
|
76
|
-
<define name="
|
76
|
+
<define name="locale">
|
77
77
|
<a:documentation>ISO-639</a:documentation>
|
78
|
+
<element name="locale">
|
79
|
+
<text/>
|
80
|
+
</element>
|
81
|
+
</define>
|
82
|
+
<define name="script">
|
83
|
+
<a:documentation>ISO-3166</a:documentation>
|
78
84
|
<element name="script">
|
79
85
|
<text/>
|
80
86
|
</element>
|
@@ -93,6 +99,9 @@
|
|
93
99
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
94
100
|
<attribute name="language"/>
|
95
101
|
</optional>
|
102
|
+
<optional>
|
103
|
+
<attribute name="locale"/>
|
104
|
+
</optional>
|
96
105
|
<optional>
|
97
106
|
<attribute name="script"/>
|
98
107
|
</optional>
|
@@ -136,6 +145,9 @@
|
|
136
145
|
<!-- multiple languages and scripts possible: comma delimit them if so -->
|
137
146
|
<attribute name="language"/>
|
138
147
|
</optional>
|
148
|
+
<optional>
|
149
|
+
<attribute name="locale"/>
|
150
|
+
</optional>
|
139
151
|
<optional>
|
140
152
|
<attribute name="script"/>
|
141
153
|
</optional>
|
@@ -650,6 +662,9 @@
|
|
650
662
|
<zeroOrMore>
|
651
663
|
<ref name="language"/>
|
652
664
|
</zeroOrMore>
|
665
|
+
<zeroOrMore>
|
666
|
+
<ref name="locale"/>
|
667
|
+
</zeroOrMore>
|
653
668
|
<zeroOrMore>
|
654
669
|
<ref name="script"/>
|
655
670
|
</zeroOrMore>
|
@@ -741,6 +756,9 @@
|
|
741
756
|
<zeroOrMore>
|
742
757
|
<ref name="language"/>
|
743
758
|
</zeroOrMore>
|
759
|
+
<zeroOrMore>
|
760
|
+
<ref name="locale"/>
|
761
|
+
</zeroOrMore>
|
744
762
|
<zeroOrMore>
|
745
763
|
<ref name="script"/>
|
746
764
|
</zeroOrMore>
|
@@ -854,6 +872,15 @@
|
|
854
872
|
<optional>
|
855
873
|
<attribute name="type"/>
|
856
874
|
</optional>
|
875
|
+
<optional>
|
876
|
+
<attribute name="language"/>
|
877
|
+
</optional>
|
878
|
+
<optional>
|
879
|
+
<attribute name="locale"/>
|
880
|
+
</optional>
|
881
|
+
<optional>
|
882
|
+
<attribute name="script"/>
|
883
|
+
</optional>
|
857
884
|
<data type="anyURI"/>
|
858
885
|
</define>
|
859
886
|
<define name="DateType">
|
@@ -882,6 +909,7 @@
|
|
882
909
|
<value>vote-started</value>
|
883
910
|
<value>vote-ended</value>
|
884
911
|
<value>announced</value>
|
912
|
+
<value>stable-until</value>
|
885
913
|
</choice>
|
886
914
|
</define>
|
887
915
|
<define name="bdate">
|
@@ -930,6 +958,9 @@
|
|
930
958
|
<optional>
|
931
959
|
<attribute name="language"/>
|
932
960
|
</optional>
|
961
|
+
<optional>
|
962
|
+
<attribute name="locale"/>
|
963
|
+
</optional>
|
933
964
|
<optional>
|
934
965
|
<attribute name="script"/>
|
935
966
|
</optional>
|
@@ -51,7 +51,7 @@ module Metanorma
|
|
51
51
|
def metadata_id(node, xml)
|
52
52
|
dn = node.attr("docnumber")
|
53
53
|
if docstatus = node.attr("status")
|
54
|
-
abbr = IsoDoc::UN::Metadata.new("en", "Latn", @i18n)
|
54
|
+
abbr = IsoDoc::UN::Metadata.new("en", "Latn", "", @i18n)
|
55
55
|
.stage_abbr(docstatus)
|
56
56
|
dn = "#{dn}(#{abbr})" unless abbr.empty?
|
57
57
|
end
|
@@ -67,13 +67,13 @@ module Metanorma
|
|
67
67
|
xml.session do |session|
|
68
68
|
session.number node.attr("session") if node.attr("session")
|
69
69
|
session.date node.attr("session-date") if node.attr("session-date")
|
70
|
-
node
|
70
|
+
node.attr("item-number")&.split(/, */)&.each do |i|
|
71
71
|
session.item_number i
|
72
72
|
end
|
73
|
-
node
|
73
|
+
node.attr("item-name")&.split(/, */)&.each do |i|
|
74
74
|
session.item_name i
|
75
75
|
end
|
76
|
-
node
|
76
|
+
node.attr("subitem-name")&.split(/, */)&.each do |i|
|
77
77
|
session.subitem_name i
|
78
78
|
end
|
79
79
|
node.attr("collaborator") and
|
data/lib/metanorma/un/version.rb
CHANGED
data/metanorma-un.gemspec
CHANGED
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_dependency "roman-numerals"
|
31
31
|
spec.add_dependency "twitter_cldr"
|
32
32
|
|
33
|
-
spec.add_dependency "metanorma-standoc", "~> 2.2.
|
33
|
+
spec.add_dependency "metanorma-standoc", "~> 2.2.4"
|
34
34
|
|
35
35
|
spec.add_development_dependency "debug"
|
36
36
|
spec.add_development_dependency "equivalent-xml", "~> 0.6"
|
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.9.
|
4
|
+
version: 0.9.9
|
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-09-
|
11
|
+
date: 2022-09-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: iso-639
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 2.2.
|
61
|
+
version: 2.2.4
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 2.2.
|
68
|
+
version: 2.2.4
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: debug
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|