metanorma-un 0.9.8.1 → 0.9.10
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 +59 -12
- data/lib/isodoc/un/un.plenary.xsl +59 -12
- data/lib/isodoc/un/un.recommendation.xsl +59 -12
- 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/isodoc.rng +9 -0
- 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: 7b7eed9a4ee7a8a2f881a16841acb2d6d9310618d61b27994d70eebb9e0c2cc1
|
4
|
+
data.tar.gz: '00018c02bdbbec199661eb6e5aa43b09240a22948528a9fde135142445c82d5b'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63e67ef5e0bf08d8823bad86046701935fa38bec6e21fbdac22033903a49290dd0b854d564f8468625d9c28a3bfc217ce74b8582dfde386a689ea4c1c2dccc40
|
7
|
+
data.tar.gz: 377c2a773f8c9d230506070943113c01009a49673607c92e93a4946b9ca060cc087f1ee8909fe8e6999a19c6a46b5e31df74359899a0a0eae5d614acd96162ec
|
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>
|
@@ -7491,7 +7503,7 @@
|
|
7491
7503
|
<!-- ====== -->
|
7492
7504
|
<!-- eref -->
|
7493
7505
|
<!-- ====== -->
|
7494
|
-
<xsl:template match="*[local-name() = 'eref']">
|
7506
|
+
<xsl:template match="*[local-name() = 'eref']" name="eref">
|
7495
7507
|
<xsl:variable name="current_bibitemid" select="@bibitemid"/>
|
7496
7508
|
<!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
|
7497
7509
|
<xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
|
@@ -7992,21 +8004,29 @@
|
|
7992
8004
|
</xsl:variable>
|
7993
8005
|
|
7994
8006
|
<xsl:template match="@*|node()" mode="index_add_id">
|
8007
|
+
<xsl:param name="docid"/>
|
7995
8008
|
<xsl:copy>
|
7996
|
-
|
8009
|
+
<xsl:apply-templates select="@*|node()" mode="index_add_id">
|
8010
|
+
<xsl:with-param name="docid" select="$docid"/>
|
8011
|
+
</xsl:apply-templates>
|
7997
8012
|
</xsl:copy>
|
7998
8013
|
</xsl:template>
|
7999
8014
|
|
8000
8015
|
<xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
|
8016
|
+
<xsl:param name="docid"/>
|
8001
8017
|
<xsl:variable name="id">
|
8002
|
-
<xsl:call-template name="generateIndexXrefId"
|
8018
|
+
<xsl:call-template name="generateIndexXrefId">
|
8019
|
+
<xsl:with-param name="docid" select="$docid"/>
|
8020
|
+
</xsl:call-template>
|
8003
8021
|
</xsl:variable>
|
8004
8022
|
<xsl:copy> <!-- add id to xref -->
|
8005
8023
|
<xsl:apply-templates select="@*" mode="index_add_id"/>
|
8006
8024
|
<xsl:attribute name="id">
|
8007
8025
|
<xsl:value-of select="$id"/>
|
8008
8026
|
</xsl:attribute>
|
8009
|
-
<xsl:apply-templates mode="index_add_id"
|
8027
|
+
<xsl:apply-templates mode="index_add_id">
|
8028
|
+
<xsl:with-param name="docid" select="$docid"/>
|
8029
|
+
</xsl:apply-templates>
|
8010
8030
|
</xsl:copy>
|
8011
8031
|
<!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
|
8012
8032
|
<xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
|
@@ -8018,7 +8038,9 @@
|
|
8018
8038
|
<xsl:attribute name="id">
|
8019
8039
|
<xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
|
8020
8040
|
</xsl:attribute>
|
8021
|
-
<xsl:apply-templates mode="index_add_id"
|
8041
|
+
<xsl:apply-templates mode="index_add_id">
|
8042
|
+
<xsl:with-param name="docid" select="$docid"/>
|
8043
|
+
</xsl:apply-templates>
|
8022
8044
|
</xsl:copy>
|
8023
8045
|
</xsl:if>
|
8024
8046
|
</xsl:template>
|
@@ -8055,12 +8077,33 @@
|
|
8055
8077
|
</xsl:when>
|
8056
8078
|
<xsl:when test="self::* and local-name(.) = 'xref'">
|
8057
8079
|
<xsl:variable name="id" select="@id"/>
|
8058
|
-
<xsl:variable name="page" select="$index//item[@id = $id]"/>
|
8059
|
-
<xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
|
8060
|
-
<xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
|
8061
8080
|
|
8081
|
+
<xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
|
8062
8082
|
<xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
|
8063
|
-
|
8083
|
+
|
8084
|
+
<xsl:variable name="pages_">
|
8085
|
+
<xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
|
8086
|
+
<xsl:choose>
|
8087
|
+
<xsl:when test="@id = $id">
|
8088
|
+
<page><xsl:value-of select="."/></page>
|
8089
|
+
</xsl:when>
|
8090
|
+
<xsl:when test="@id = $id_next">
|
8091
|
+
<page_next><xsl:value-of select="."/></page_next>
|
8092
|
+
</xsl:when>
|
8093
|
+
<xsl:when test="@id = $id_prev">
|
8094
|
+
<page_prev><xsl:value-of select="."/></page_prev>
|
8095
|
+
</xsl:when>
|
8096
|
+
</xsl:choose>
|
8097
|
+
</xsl:for-each>
|
8098
|
+
</xsl:variable>
|
8099
|
+
<xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
|
8100
|
+
|
8101
|
+
<!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
|
8102
|
+
<xsl:variable name="page" select="$pages/page"/>
|
8103
|
+
<!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
|
8104
|
+
<xsl:variable name="page_next" select="$pages/page_next"/>
|
8105
|
+
<!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
|
8106
|
+
<xsl:variable name="page_prev" select="$pages/page_prev"/>
|
8064
8107
|
|
8065
8108
|
<xsl:choose>
|
8066
8109
|
<!-- 2nd pass -->
|
@@ -8120,16 +8163,20 @@
|
|
8120
8163
|
</xsl:template>
|
8121
8164
|
|
8122
8165
|
<xsl:template name="generateIndexXrefId">
|
8166
|
+
<xsl:param name="docid"/>
|
8167
|
+
|
8123
8168
|
<xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
|
8124
8169
|
|
8125
|
-
<xsl:variable name="
|
8126
|
-
<xsl:
|
8170
|
+
<xsl:variable name="docid_curr">
|
8171
|
+
<xsl:value-of select="$docid"/>
|
8172
|
+
<xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
|
8127
8173
|
</xsl:variable>
|
8174
|
+
|
8128
8175
|
<xsl:variable name="item_number">
|
8129
8176
|
<xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
|
8130
8177
|
</xsl:variable>
|
8131
8178
|
<xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
|
8132
|
-
<xsl:value-of select="concat($
|
8179
|
+
<xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
|
8133
8180
|
</xsl:template>
|
8134
8181
|
|
8135
8182
|
<xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
|
@@ -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>
|
@@ -7491,7 +7503,7 @@
|
|
7491
7503
|
<!-- ====== -->
|
7492
7504
|
<!-- eref -->
|
7493
7505
|
<!-- ====== -->
|
7494
|
-
<xsl:template match="*[local-name() = 'eref']">
|
7506
|
+
<xsl:template match="*[local-name() = 'eref']" name="eref">
|
7495
7507
|
<xsl:variable name="current_bibitemid" select="@bibitemid"/>
|
7496
7508
|
<!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
|
7497
7509
|
<xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
|
@@ -7992,21 +8004,29 @@
|
|
7992
8004
|
</xsl:variable>
|
7993
8005
|
|
7994
8006
|
<xsl:template match="@*|node()" mode="index_add_id">
|
8007
|
+
<xsl:param name="docid"/>
|
7995
8008
|
<xsl:copy>
|
7996
|
-
|
8009
|
+
<xsl:apply-templates select="@*|node()" mode="index_add_id">
|
8010
|
+
<xsl:with-param name="docid" select="$docid"/>
|
8011
|
+
</xsl:apply-templates>
|
7997
8012
|
</xsl:copy>
|
7998
8013
|
</xsl:template>
|
7999
8014
|
|
8000
8015
|
<xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
|
8016
|
+
<xsl:param name="docid"/>
|
8001
8017
|
<xsl:variable name="id">
|
8002
|
-
<xsl:call-template name="generateIndexXrefId"
|
8018
|
+
<xsl:call-template name="generateIndexXrefId">
|
8019
|
+
<xsl:with-param name="docid" select="$docid"/>
|
8020
|
+
</xsl:call-template>
|
8003
8021
|
</xsl:variable>
|
8004
8022
|
<xsl:copy> <!-- add id to xref -->
|
8005
8023
|
<xsl:apply-templates select="@*" mode="index_add_id"/>
|
8006
8024
|
<xsl:attribute name="id">
|
8007
8025
|
<xsl:value-of select="$id"/>
|
8008
8026
|
</xsl:attribute>
|
8009
|
-
<xsl:apply-templates mode="index_add_id"
|
8027
|
+
<xsl:apply-templates mode="index_add_id">
|
8028
|
+
<xsl:with-param name="docid" select="$docid"/>
|
8029
|
+
</xsl:apply-templates>
|
8010
8030
|
</xsl:copy>
|
8011
8031
|
<!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
|
8012
8032
|
<xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
|
@@ -8018,7 +8038,9 @@
|
|
8018
8038
|
<xsl:attribute name="id">
|
8019
8039
|
<xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
|
8020
8040
|
</xsl:attribute>
|
8021
|
-
<xsl:apply-templates mode="index_add_id"
|
8041
|
+
<xsl:apply-templates mode="index_add_id">
|
8042
|
+
<xsl:with-param name="docid" select="$docid"/>
|
8043
|
+
</xsl:apply-templates>
|
8022
8044
|
</xsl:copy>
|
8023
8045
|
</xsl:if>
|
8024
8046
|
</xsl:template>
|
@@ -8055,12 +8077,33 @@
|
|
8055
8077
|
</xsl:when>
|
8056
8078
|
<xsl:when test="self::* and local-name(.) = 'xref'">
|
8057
8079
|
<xsl:variable name="id" select="@id"/>
|
8058
|
-
<xsl:variable name="page" select="$index//item[@id = $id]"/>
|
8059
|
-
<xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
|
8060
|
-
<xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
|
8061
8080
|
|
8081
|
+
<xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
|
8062
8082
|
<xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
|
8063
|
-
|
8083
|
+
|
8084
|
+
<xsl:variable name="pages_">
|
8085
|
+
<xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
|
8086
|
+
<xsl:choose>
|
8087
|
+
<xsl:when test="@id = $id">
|
8088
|
+
<page><xsl:value-of select="."/></page>
|
8089
|
+
</xsl:when>
|
8090
|
+
<xsl:when test="@id = $id_next">
|
8091
|
+
<page_next><xsl:value-of select="."/></page_next>
|
8092
|
+
</xsl:when>
|
8093
|
+
<xsl:when test="@id = $id_prev">
|
8094
|
+
<page_prev><xsl:value-of select="."/></page_prev>
|
8095
|
+
</xsl:when>
|
8096
|
+
</xsl:choose>
|
8097
|
+
</xsl:for-each>
|
8098
|
+
</xsl:variable>
|
8099
|
+
<xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
|
8100
|
+
|
8101
|
+
<!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
|
8102
|
+
<xsl:variable name="page" select="$pages/page"/>
|
8103
|
+
<!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
|
8104
|
+
<xsl:variable name="page_next" select="$pages/page_next"/>
|
8105
|
+
<!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
|
8106
|
+
<xsl:variable name="page_prev" select="$pages/page_prev"/>
|
8064
8107
|
|
8065
8108
|
<xsl:choose>
|
8066
8109
|
<!-- 2nd pass -->
|
@@ -8120,16 +8163,20 @@
|
|
8120
8163
|
</xsl:template>
|
8121
8164
|
|
8122
8165
|
<xsl:template name="generateIndexXrefId">
|
8166
|
+
<xsl:param name="docid"/>
|
8167
|
+
|
8123
8168
|
<xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
|
8124
8169
|
|
8125
|
-
<xsl:variable name="
|
8126
|
-
<xsl:
|
8170
|
+
<xsl:variable name="docid_curr">
|
8171
|
+
<xsl:value-of select="$docid"/>
|
8172
|
+
<xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
|
8127
8173
|
</xsl:variable>
|
8174
|
+
|
8128
8175
|
<xsl:variable name="item_number">
|
8129
8176
|
<xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
|
8130
8177
|
</xsl:variable>
|
8131
8178
|
<xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
|
8132
|
-
<xsl:value-of select="concat($
|
8179
|
+
<xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
|
8133
8180
|
</xsl:template>
|
8134
8181
|
|
8135
8182
|
<xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
|
@@ -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>
|
@@ -7571,7 +7583,7 @@
|
|
7571
7583
|
<!-- ====== -->
|
7572
7584
|
<!-- eref -->
|
7573
7585
|
<!-- ====== -->
|
7574
|
-
<xsl:template match="*[local-name() = 'eref']">
|
7586
|
+
<xsl:template match="*[local-name() = 'eref']" name="eref">
|
7575
7587
|
<xsl:variable name="current_bibitemid" select="@bibitemid"/>
|
7576
7588
|
<!-- <xsl:variable name="external-destination" select="normalize-space(key('bibitems', $current_bibitemid)/*[local-name() = 'uri'][@type = 'citation'])"/> -->
|
7577
7589
|
<xsl:variable name="external-destination" select="normalize-space($bibitems/*[local-name() ='bibitem'][@id = $current_bibitemid]/*[local-name() = 'uri'][@type = 'citation'])"/>
|
@@ -8072,21 +8084,29 @@
|
|
8072
8084
|
</xsl:variable>
|
8073
8085
|
|
8074
8086
|
<xsl:template match="@*|node()" mode="index_add_id">
|
8087
|
+
<xsl:param name="docid"/>
|
8075
8088
|
<xsl:copy>
|
8076
|
-
|
8089
|
+
<xsl:apply-templates select="@*|node()" mode="index_add_id">
|
8090
|
+
<xsl:with-param name="docid" select="$docid"/>
|
8091
|
+
</xsl:apply-templates>
|
8077
8092
|
</xsl:copy>
|
8078
8093
|
</xsl:template>
|
8079
8094
|
|
8080
8095
|
<xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
|
8096
|
+
<xsl:param name="docid"/>
|
8081
8097
|
<xsl:variable name="id">
|
8082
|
-
<xsl:call-template name="generateIndexXrefId"
|
8098
|
+
<xsl:call-template name="generateIndexXrefId">
|
8099
|
+
<xsl:with-param name="docid" select="$docid"/>
|
8100
|
+
</xsl:call-template>
|
8083
8101
|
</xsl:variable>
|
8084
8102
|
<xsl:copy> <!-- add id to xref -->
|
8085
8103
|
<xsl:apply-templates select="@*" mode="index_add_id"/>
|
8086
8104
|
<xsl:attribute name="id">
|
8087
8105
|
<xsl:value-of select="$id"/>
|
8088
8106
|
</xsl:attribute>
|
8089
|
-
<xsl:apply-templates mode="index_add_id"
|
8107
|
+
<xsl:apply-templates mode="index_add_id">
|
8108
|
+
<xsl:with-param name="docid" select="$docid"/>
|
8109
|
+
</xsl:apply-templates>
|
8090
8110
|
</xsl:copy>
|
8091
8111
|
<!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
|
8092
8112
|
<xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
|
@@ -8098,7 +8118,9 @@
|
|
8098
8118
|
<xsl:attribute name="id">
|
8099
8119
|
<xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
|
8100
8120
|
</xsl:attribute>
|
8101
|
-
<xsl:apply-templates mode="index_add_id"
|
8121
|
+
<xsl:apply-templates mode="index_add_id">
|
8122
|
+
<xsl:with-param name="docid" select="$docid"/>
|
8123
|
+
</xsl:apply-templates>
|
8102
8124
|
</xsl:copy>
|
8103
8125
|
</xsl:if>
|
8104
8126
|
</xsl:template>
|
@@ -8135,12 +8157,33 @@
|
|
8135
8157
|
</xsl:when>
|
8136
8158
|
<xsl:when test="self::* and local-name(.) = 'xref'">
|
8137
8159
|
<xsl:variable name="id" select="@id"/>
|
8138
|
-
<xsl:variable name="page" select="$index//item[@id = $id]"/>
|
8139
|
-
<xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
|
8140
|
-
<xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
|
8141
8160
|
|
8161
|
+
<xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
|
8142
8162
|
<xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
|
8143
|
-
|
8163
|
+
|
8164
|
+
<xsl:variable name="pages_">
|
8165
|
+
<xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
|
8166
|
+
<xsl:choose>
|
8167
|
+
<xsl:when test="@id = $id">
|
8168
|
+
<page><xsl:value-of select="."/></page>
|
8169
|
+
</xsl:when>
|
8170
|
+
<xsl:when test="@id = $id_next">
|
8171
|
+
<page_next><xsl:value-of select="."/></page_next>
|
8172
|
+
</xsl:when>
|
8173
|
+
<xsl:when test="@id = $id_prev">
|
8174
|
+
<page_prev><xsl:value-of select="."/></page_prev>
|
8175
|
+
</xsl:when>
|
8176
|
+
</xsl:choose>
|
8177
|
+
</xsl:for-each>
|
8178
|
+
</xsl:variable>
|
8179
|
+
<xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
|
8180
|
+
|
8181
|
+
<!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
|
8182
|
+
<xsl:variable name="page" select="$pages/page"/>
|
8183
|
+
<!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
|
8184
|
+
<xsl:variable name="page_next" select="$pages/page_next"/>
|
8185
|
+
<!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
|
8186
|
+
<xsl:variable name="page_prev" select="$pages/page_prev"/>
|
8144
8187
|
|
8145
8188
|
<xsl:choose>
|
8146
8189
|
<!-- 2nd pass -->
|
@@ -8200,16 +8243,20 @@
|
|
8200
8243
|
</xsl:template>
|
8201
8244
|
|
8202
8245
|
<xsl:template name="generateIndexXrefId">
|
8246
|
+
<xsl:param name="docid"/>
|
8247
|
+
|
8203
8248
|
<xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
|
8204
8249
|
|
8205
|
-
<xsl:variable name="
|
8206
|
-
<xsl:
|
8250
|
+
<xsl:variable name="docid_curr">
|
8251
|
+
<xsl:value-of select="$docid"/>
|
8252
|
+
<xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
|
8207
8253
|
</xsl:variable>
|
8254
|
+
|
8208
8255
|
<xsl:variable name="item_number">
|
8209
8256
|
<xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
|
8210
8257
|
</xsl:variable>
|
8211
8258
|
<xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
|
8212
|
-
<xsl:value-of select="concat($
|
8259
|
+
<xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
|
8213
8260
|
</xsl:template>
|
8214
8261
|
|
8215
8262
|
<xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
|
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/isodoc.rng
CHANGED
@@ -205,6 +205,15 @@
|
|
205
205
|
<data type="boolean"/>
|
206
206
|
</attribute>
|
207
207
|
</optional>
|
208
|
+
<optional>
|
209
|
+
<attribute name="style">
|
210
|
+
<choice>
|
211
|
+
<value>basic</value>
|
212
|
+
<value>full</value>
|
213
|
+
<value>short</value>
|
214
|
+
</choice>
|
215
|
+
</attribute>
|
216
|
+
</optional>
|
208
217
|
<ref name="XrefBody"/>
|
209
218
|
</element>
|
210
219
|
</define>
|
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.10
|
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-10-10 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
|