metanorma-bipm 2.1.8.1 → 2.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -7602,6 +7602,18 @@
7602
7602
  </xsl:copy>
7603
7603
  </xsl:template>
7604
7604
 
7605
+ <xsl:template match="*[local-name() = 'sub']" mode="contents_item">
7606
+ <xsl:copy>
7607
+ <xsl:apply-templates mode="contents_item"/>
7608
+ </xsl:copy>
7609
+ </xsl:template>
7610
+
7611
+ <xsl:template match="*[local-name() = 'sup']" mode="contents_item">
7612
+ <xsl:copy>
7613
+ <xsl:apply-templates mode="contents_item"/>
7614
+ </xsl:copy>
7615
+ </xsl:template>
7616
+
7605
7617
  <xsl:template match="*[local-name() = 'stem']" mode="contents_item">
7606
7618
  <xsl:copy-of select="."/>
7607
7619
  </xsl:template>
@@ -9062,21 +9074,29 @@
9062
9074
  </xsl:variable>
9063
9075
 
9064
9076
  <xsl:template match="@*|node()" mode="index_add_id">
9077
+ <xsl:param name="docid"/>
9065
9078
  <xsl:copy>
9066
- <xsl:apply-templates select="@*|node()" mode="index_add_id"/>
9079
+ <xsl:apply-templates select="@*|node()" mode="index_add_id">
9080
+ <xsl:with-param name="docid" select="$docid"/>
9081
+ </xsl:apply-templates>
9067
9082
  </xsl:copy>
9068
9083
  </xsl:template>
9069
9084
 
9070
9085
  <xsl:template match="*[local-name() = 'xref']" mode="index_add_id">
9086
+ <xsl:param name="docid"/>
9071
9087
  <xsl:variable name="id">
9072
- <xsl:call-template name="generateIndexXrefId"/>
9088
+ <xsl:call-template name="generateIndexXrefId">
9089
+ <xsl:with-param name="docid" select="$docid"/>
9090
+ </xsl:call-template>
9073
9091
  </xsl:variable>
9074
9092
  <xsl:copy> <!-- add id to xref -->
9075
9093
  <xsl:apply-templates select="@*" mode="index_add_id"/>
9076
9094
  <xsl:attribute name="id">
9077
9095
  <xsl:value-of select="$id"/>
9078
9096
  </xsl:attribute>
9079
- <xsl:apply-templates mode="index_add_id"/>
9097
+ <xsl:apply-templates mode="index_add_id">
9098
+ <xsl:with-param name="docid" select="$docid"/>
9099
+ </xsl:apply-templates>
9080
9100
  </xsl:copy>
9081
9101
  <!-- split <xref target="bm1" to="End" pagenumber="true"> to two xref:
9082
9102
  <xref target="bm1" pagenumber="true"> and <xref target="End" pagenumber="true"> -->
@@ -9088,7 +9108,9 @@
9088
9108
  <xsl:attribute name="id">
9089
9109
  <xsl:value-of select="$id"/><xsl:text>_to</xsl:text>
9090
9110
  </xsl:attribute>
9091
- <xsl:apply-templates mode="index_add_id"/>
9111
+ <xsl:apply-templates mode="index_add_id">
9112
+ <xsl:with-param name="docid" select="$docid"/>
9113
+ </xsl:apply-templates>
9092
9114
  </xsl:copy>
9093
9115
  </xsl:if>
9094
9116
  </xsl:template>
@@ -9125,12 +9147,33 @@
9125
9147
  </xsl:when>
9126
9148
  <xsl:when test="self::* and local-name(.) = 'xref'">
9127
9149
  <xsl:variable name="id" select="@id"/>
9128
- <xsl:variable name="page" select="$index//item[@id = $id]"/>
9129
- <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9130
- <xsl:variable name="page_next" select="$index//item[@id = $id_next]"/>
9131
9150
 
9151
+ <xsl:variable name="id_next" select="following-sibling::*[local-name() = 'xref'][1]/@id"/>
9132
9152
  <xsl:variable name="id_prev" select="preceding-sibling::*[local-name() = 'xref'][1]/@id"/>
9133
- <xsl:variable name="page_prev" select="$index//item[@id = $id_prev]"/>
9153
+
9154
+ <xsl:variable name="pages_">
9155
+ <xsl:for-each select="$index/index/item[@id = $id or @id = $id_next or @id = $id_prev]">
9156
+ <xsl:choose>
9157
+ <xsl:when test="@id = $id">
9158
+ <page><xsl:value-of select="."/></page>
9159
+ </xsl:when>
9160
+ <xsl:when test="@id = $id_next">
9161
+ <page_next><xsl:value-of select="."/></page_next>
9162
+ </xsl:when>
9163
+ <xsl:when test="@id = $id_prev">
9164
+ <page_prev><xsl:value-of select="."/></page_prev>
9165
+ </xsl:when>
9166
+ </xsl:choose>
9167
+ </xsl:for-each>
9168
+ </xsl:variable>
9169
+ <xsl:variable name="pages" select="xalan:nodeset($pages_)"/>
9170
+
9171
+ <!-- <xsl:variable name="page" select="$index/index/item[@id = $id]"/> -->
9172
+ <xsl:variable name="page" select="$pages/page"/>
9173
+ <!-- <xsl:variable name="page_next" select="$index/index/item[@id = $id_next]"/> -->
9174
+ <xsl:variable name="page_next" select="$pages/page_next"/>
9175
+ <!-- <xsl:variable name="page_prev" select="$index/index/item[@id = $id_prev]"/> -->
9176
+ <xsl:variable name="page_prev" select="$pages/page_prev"/>
9134
9177
 
9135
9178
  <xsl:choose>
9136
9179
  <!-- 2nd pass -->
@@ -9190,16 +9233,20 @@
9190
9233
  </xsl:template>
9191
9234
 
9192
9235
  <xsl:template name="generateIndexXrefId">
9236
+ <xsl:param name="docid"/>
9237
+
9193
9238
  <xsl:variable name="level" select="count(ancestor::*[local-name() = 'ul'])"/>
9194
9239
 
9195
- <xsl:variable name="docid">
9196
- <xsl:call-template name="getDocumentId"/>
9240
+ <xsl:variable name="docid_curr">
9241
+ <xsl:value-of select="$docid"/>
9242
+ <xsl:if test="normalize-space($docid) = ''"><xsl:call-template name="getDocumentId"/></xsl:if>
9197
9243
  </xsl:variable>
9244
+
9198
9245
  <xsl:variable name="item_number">
9199
9246
  <xsl:number count="*[local-name() = 'li'][ancestor::*[local-name() = 'indexsect']]" level="any"/>
9200
9247
  </xsl:variable>
9201
9248
  <xsl:variable name="xref_number"><xsl:number count="*[local-name() = 'xref']"/></xsl:variable>
9202
- <xsl:value-of select="concat($docid, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9249
+ <xsl:value-of select="concat($docid_curr, '_', $item_number, '_', $xref_number)"/> <!-- $level, '_', -->
9203
9250
  </xsl:template>
9204
9251
 
9205
9252
  <xsl:template match="*[local-name() = 'indexsect']/*[local-name() = 'title']" priority="4">
@@ -11,7 +11,7 @@ module IsoDoc
11
11
  K_k kg_h_c_deltanu kg_h m_c_deltanu m_c mol_NA
12
12
  s_deltanu).freeze
13
13
 
14
- def initialize(lang, script, labels)
14
+ def initialize(lang, script, locale, labels)
15
15
  super
16
16
  here = File.join(File.dirname(__FILE__), "html", "si-aspect")
17
17
  si_paths = []
@@ -26,14 +26,14 @@ module IsoDoc
26
26
 
27
27
  def title(isoxml, _out)
28
28
  lang1, lang2 = @lang == "fr" ? %w(fr en) : %w(en fr)
29
- set(:doctitle, @c.encode(isoxml&.at(
29
+ set(:doctitle, @c.encode(isoxml.at(
30
30
  ns("#{TITLE}[@type='main'][@language='#{lang1}']"))&.text || ""))
31
- set(:docsubtitle, @c.encode(isoxml&.at(
31
+ set(:docsubtitle, @c.encode(isoxml.at(
32
32
  ns("#{TITLE}[@type='main'][@language='#{lang2}']"))&.text || ""))
33
33
  %w(appendix annex part subtitle provenance).each do |e|
34
- set("#{e}title".to_sym, @c.encode(isoxml&.at(
34
+ set("#{e}title".to_sym, @c.encode(isoxml.at(
35
35
  ns("#{TITLE}[@type='#{e}'][@language='#{lang1}']"))&.text || ""))
36
- set("#{e}subtitle".to_sym, @c.encode(isoxml&.at(
36
+ set("#{e}subtitle".to_sym, @c.encode(isoxml.at(
37
37
  ns("#{TITLE}[@type='#{e}'][@language='#{lang2}']"))&.text || ""))
38
38
  end
39
39
  end
@@ -51,16 +51,16 @@ module IsoDoc
51
51
  super
52
52
  label1, label2 = @lang == "fr" ? %w(Annexe Appendix) : %w(Appendix Annexe)
53
53
  dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/appendix"))
54
- dn and set(:appendixid, @i18n.l10n("#{label1} #{dn&.text}"))
55
- dn and set(:appendixid_alt, @i18n.l10n("#{label2} #{dn&.text}"))
54
+ dn and set(:appendixid, @i18n.l10n("#{label1} #{dn.text}"))
55
+ dn and set(:appendixid_alt, @i18n.l10n("#{label2} #{dn.text}"))
56
56
  label1, label2 = @lang == "fr" ? %w(Appendice Annex) : %w(Annex Appendice)
57
57
  dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/annexid"))
58
- dn and set(:annexid, @i18n.l10n("#{label1} #{dn&.text}"))
59
- dn and set(:annexid_alt, @i18n.l10n("#{label2} #{dn&.text}"))
58
+ dn and set(:annexid, @i18n.l10n("#{label1} #{dn.text}"))
59
+ dn and set(:annexid_alt, @i18n.l10n("#{label2} #{dn.text}"))
60
60
  label1, label2 = @lang == "fr" ? %w(Partie Part) : %w(Part Partie)
61
61
  dn = isoxml.at(ns("//bibdata/ext/structuredidentifier/part"))
62
- dn and set(:partid, @i18n.l10n("#{label1} #{dn&.text}"))
63
- dn and set(:partid_alt, @i18n.l10n("#{label2} #{dn&.text}"))
62
+ dn and set(:partid, @i18n.l10n("#{label1} #{dn.text}"))
63
+ dn and set(:partid_alt, @i18n.l10n("#{label2} #{dn.text}"))
64
64
  set(:org_abbrev,
65
65
  isoxml.at(ns("//bibdata/ext/editorialgroup/committee"\
66
66
  "[@acronym = 'JCGM']")) ? "JCGM" : "BIPM")
@@ -13,8 +13,8 @@ module IsoDoc
13
13
  "@acronym"))&.value == "JCGM"
14
14
  @iso = IsoDoc::Iso::PresentationXMLConvert
15
15
  .new({ language: @lang, script: @script })
16
- i18n = @iso.i18n_init(@lang, @script, nil)
17
- @iso.metadata_init(@lang, @script, i18n)
16
+ i18n = @iso.i18n_init(@lang, @script, @locale, nil)
17
+ @iso.metadata_init(@lang, @script, @locale, i18n)
18
18
  super
19
19
  end
20
20
 
@@ -90,6 +90,12 @@ module IsoDoc
90
90
  { group: "&#xA0;", fraction_group: "&#xA0;", fraction_group_digits: 3 }
91
91
  end
92
92
 
93
+ def localized_number(num, locale, precision)
94
+ g = Regexp.quote(twitter_cldr_localiser_symbols[:group])
95
+ f = Regexp.quote(twitter_cldr_localiser_symbols[:fraction_group])
96
+ super.sub(/^(\d)#{g}(\d)/, "\\1\\2").sub(/(\d)#{f}(\d)$/, "\\1\\2")
97
+ end
98
+
93
99
  def mathml1(elem, locale)
94
100
  asciimath_dup(elem)
95
101
  localize_maths(elem, locale)
@@ -104,7 +110,7 @@ module IsoDoc
104
110
  pubdate = bibdata.at(ns("./date[not(@format)][@type = 'published']"))
105
111
  return unless pubdate
106
112
 
107
- meta = metadata_init(@lang, @script, @i18n)
113
+ meta = metadata_init(@lang, @script, @locale, @i18n)
108
114
  pubdate.next = pubdate.dup
109
115
  pubdate.next["format"] = "ddMMMyyyy"
110
116
  pubdate.next.children = meta.monthyr(pubdate.text)
@@ -132,8 +138,8 @@ module IsoDoc
132
138
  # merge adjacent text nodes
133
139
  docxml.root.replace(Nokogiri::XML(docxml.root.to_xml).root)
134
140
  docxml.xpath(ns(xpath)).each do |x| # rubocop: disable Style/CombinableLoops
135
- if x&.next&.text? && /^\],\s+\[$/.match?(x&.next&.text) &&
136
- %w(eref origin source).include?(x&.next&.next&.name)
141
+ if x.next&.text? && /^\],\s+\[$/.match?(x.next.text) &&
142
+ %w(eref origin source).include?(x.next.next&.name)
137
143
  x.next.replace(", ")
138
144
  end
139
145
  end
@@ -164,25 +170,6 @@ module IsoDoc
164
170
  end
165
171
  elem.children = l10n("[#{@i18n.source} #{elem.children.to_xml.strip}]")
166
172
  end
167
- =begin
168
- def expand_citeas(text)
169
- ret = super
170
- if @lang == "fr" && /^(CGPM|CIPM) /.match?(ret)
171
- ret.sub!(/^(CGPM|CIPM) (\S+)/) do |_m|
172
- "#{$1} &#x2013; #{FR_OUTCOME_TYPE[$2.to_sym] || $2}"
173
- end
174
- end
175
- ret
176
- end
177
-
178
- FR_OUTCOME_TYPE = {
179
- Resolution: "Résolution",
180
- Decision: "Décision",
181
- Recommendation: "Recommandation",
182
- Declaration: "Déclaration",
183
- Meeting: "Réunion",
184
- }.freeze
185
- =end
186
173
 
187
174
  include Init
188
175
  end
@@ -73,8 +73,14 @@
73
73
  <text/>
74
74
  </element>
75
75
  </define>
76
- <define name="script">
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>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module BIPM
3
- VERSION = "2.1.8.1".freeze
3
+ VERSION = "2.1.9".freeze
4
4
  end
5
5
  end
@@ -26,8 +26,8 @@ Gem::Specification.new do |spec|
26
26
  spec.require_paths = ["lib"]
27
27
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5.0")
28
28
 
29
- spec.add_dependency "metanorma-generic", "~> 2.2.0"
30
- spec.add_dependency "metanorma-iso", "~> 2.1.8"
29
+ spec.add_dependency "metanorma-generic", "~> 2.2.2"
30
+ spec.add_dependency "metanorma-iso", "~> 2.2.0"
31
31
 
32
32
  spec.add_development_dependency "debug"
33
33
  spec.add_development_dependency "equivalent-xml", "~> 0.6"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metanorma-bipm
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.8.1
4
+ version: 2.1.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-07 00:00:00.000000000 Z
11
+ date: 2022-09-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.0
19
+ version: 2.2.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 2.2.0
26
+ version: 2.2.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: metanorma-iso
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 2.1.8
33
+ version: 2.2.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 2.1.8
40
+ version: 2.2.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: debug
43
43
  requirement: !ruby/object:Gem::Requirement