metanorma-bipm 2.1.8.1 → 2.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -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: " ", fraction_group: " ", 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)
@@ -98,18 +104,33 @@ module IsoDoc
98
104
  def bibdata_i18n(bibdata)
99
105
  super
100
106
  bibdata_dates(bibdata)
107
+ bibdata_titles(bibdata)
101
108
  end
102
109
 
103
110
  def bibdata_dates(bibdata)
104
111
  pubdate = bibdata.at(ns("./date[not(@format)][@type = 'published']"))
105
112
  return unless pubdate
106
113
 
107
- meta = metadata_init(@lang, @script, @i18n)
114
+ meta = metadata_init(@lang, @script, @locale, @i18n)
108
115
  pubdate.next = pubdate.dup
109
116
  pubdate.next["format"] = "ddMMMyyyy"
110
117
  pubdate.next.children = meta.monthyr(pubdate.text)
111
118
  end
112
119
 
120
+ def bibdata_titles(bibdata)
121
+ return unless app = bibdata.at(ns("//bibdata/ext/"\
122
+ "structuredidentifier/part"))
123
+
124
+ bibdata.xpath(ns("//bibdata/title[@type = 'part']")).each do |t|
125
+ t.previous = t.dup
126
+ t["type"] = "part-with-numbering"
127
+ part = t["language"] == "en" ? "Part" : "Partie"
128
+ # not looking up in YAML
129
+ t.children = l10n("#{part} #{app.text}: #{t.children.to_xml}",
130
+ t["language"])
131
+ end
132
+ end
133
+
113
134
  def eref(docxml)
114
135
  super
115
136
  jcgm_eref(docxml, "//eref")
@@ -132,8 +153,8 @@ module IsoDoc
132
153
  # merge adjacent text nodes
133
154
  docxml.root.replace(Nokogiri::XML(docxml.root.to_xml).root)
134
155
  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)
156
+ if x.next&.text? && /^\],\s+\[$/.match?(x.next.text) &&
157
+ %w(eref origin source).include?(x.next.next&.name)
137
158
  x.next.replace(", ")
138
159
  end
139
160
  end
@@ -142,13 +163,13 @@ module IsoDoc
142
163
  def extract_brackets(node)
143
164
  start = node.at("./text()[1]")
144
165
  finish = node.at("./text()[last()]")
145
- if /^\[/.match?(start.text) && /\]$/.match?(finish.text)
146
- start.replace(start.text[1..-1])
147
- node.previous = "["
148
- finish = node.at("./text()[last()]")
149
- finish.replace(finish.text[0..-2])
150
- node.next = "]"
151
- end
166
+ (/^\[/.match?(start.text) && /\]$/.match?(finish.text)) or return
167
+
168
+ start.replace(start.text[1..-1])
169
+ node.previous = "["
170
+ finish = node.at("./text()[last()]")
171
+ finish.replace(finish.text[0..-2])
172
+ node.next = "]"
152
173
  end
153
174
 
154
175
  def quotedtitles(docxml)
@@ -158,31 +179,35 @@ module IsoDoc
158
179
  end
159
180
  end
160
181
 
182
+ # notes and remarques (list notes) are not numbered
183
+ def note1(elem)
184
+ return if elem.parent.name == "bibitem" || elem["notag"] == "true"
185
+
186
+ # n = @xrefs.get[elem["id"]]
187
+ lbl = l10n(note_label(elem))
188
+ # (n.nil? || n[:label].nil? || n[:label].empty?) or
189
+ # lbl = l10n("#{lbl} #{n[:label]}")
190
+ prefix_name(elem, "", lbl, "name")
191
+ end
192
+
193
+ def note_label(elem)
194
+ if elem.ancestors("preface").empty?
195
+ if elem.ancestors("ul, ol, dl").empty?
196
+ @i18n.note
197
+ else
198
+ @i18n.listnote
199
+ end
200
+ else
201
+ @i18n.prefacenote
202
+ end
203
+ end
204
+
161
205
  def termsource1(elem)
162
206
  while elem&.next_element&.name == "termsource"
163
207
  elem << "; #{elem.next_element.remove.children.to_xml}"
164
208
  end
165
209
  elem.children = l10n("[#{@i18n.source} #{elem.children.to_xml.strip}]")
166
210
  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
211
 
187
212
  include Init
188
213
  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>
@@ -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>
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module BIPM
3
- VERSION = "2.1.8.1".freeze
3
+ VERSION = "2.1.10".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.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-09-07 00:00:00.000000000 Z
11
+ date: 2022-10-10 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