metanorma-bipm 1.1.6 → 1.1.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,16 +18,13 @@ module IsoDoc
18
18
  end
19
19
 
20
20
  def eref_localities1(target, type, from, to, delim, n, lang = "en")
21
- if @jcgm
22
- @iso.eref_localities1(target, type, from, to, delim, n, lang)
23
- else
24
- super
25
- end
21
+ @jcgm and
22
+ return @iso.eref_localities1(target, type, from, to, delim, n, lang)
23
+ super
26
24
  end
27
25
 
28
26
  def table1(elem)
29
- return if labelled_ancestor(elem)
30
- return if elem["unnumbered"]
27
+ return if labelled_ancestor(elem) || elem["unnumbered"]
31
28
 
32
29
  n = @xrefs.anchor(elem["id"], :label, false)
33
30
  prefix_name(elem, ".<tab/>",
@@ -47,27 +44,42 @@ module IsoDoc
47
44
  return if elem["unnumbered"] == "true"
48
45
 
49
46
  lbl = @xrefs.anchor(elem["id"], :label)
50
- if t = elem.at(ns("./title"))
47
+ t = elem.at(ns("./title")) and
51
48
  t.children = "<strong>#{t.children.to_xml}</strong>"
52
- end
53
49
  prefix_name(elem, ".<tab/>", lbl, "title")
54
50
  end
55
51
 
56
52
  def clause(docxml)
53
+ quotedtitles(docxml)
57
54
  super
58
- if @jcgm
55
+ @jcgm and
59
56
  docxml.xpath(ns("//preface/introduction[clause]")).each do |f|
60
57
  clause1(f)
61
58
  end
62
- end
63
59
  end
64
60
 
65
61
  def clause1(elem)
66
62
  return if elem["unnumbered"] == "true"
67
63
  return if elem.at(("./ancestor::*[@unnumbered = 'true']"))
64
+
68
65
  super
69
66
  end
70
67
 
68
+ def prefix_name(node, delim, number, elem)
69
+ return if number.nil? || number.empty?
70
+
71
+ unless name = node.at(ns("./#{elem}[not(@type = 'quoted')]"))
72
+ return if node.at(ns("./#{elem}[@type = 'quoted']"))
73
+
74
+ node.children.empty? and node.add_child("<#{elem}></#{elem}>") or
75
+ node.children.first.previous = "<#{elem}></#{elem}>"
76
+ name = node.children.first
77
+ end
78
+ if name.children.empty? then name.add_child(number)
79
+ else (name.children.first.previous = "#{number}#{delim}")
80
+ end
81
+ end
82
+
71
83
  def conversions(docxml)
72
84
  super
73
85
  doccontrol docxml
@@ -111,7 +123,7 @@ module IsoDoc
111
123
  i = 3
112
124
  while list_draft(xml, i) != ["", ""]
113
125
  ret += "<tr>#{list_draft(xml, i).map { |x| "<td>#{x}</td>" }.join} "\
114
- "<td/></tr>"
126
+ "<td/></tr>"
115
127
  i += 1
116
128
  end
117
129
  ret
@@ -135,7 +147,7 @@ module IsoDoc
135
147
 
136
148
  COCHAIR = "xmlns:role[contains(text(),'co-chair')]".freeze
137
149
  CHAIR = "[xmlns:role[contains(text(),'chair')]"\
138
- "[not(contains(text(),'co-chair'))]]".freeze
150
+ "[not(contains(text(),'co-chair'))]]".freeze
139
151
 
140
152
  def list_cochairs(xml)
141
153
  ret = list_people(xml, "//bibdata/contributor[#{COCHAIR}]/person")
@@ -167,11 +179,11 @@ module IsoDoc
167
179
  end
168
180
 
169
181
  def twitter_cldr_localiser_symbols
170
- { group: "&#xA0;", fraction_group: "&#xA0;",
171
- fraction_group_digits: 3 }
182
+ { group: "&#xA0;", fraction_group: "&#xA0;", fraction_group_digits: 3 }
172
183
  end
173
184
 
174
185
  def mathml1(elem, locale)
186
+ asciimath_dup(elem)
175
187
  localize_maths(elem, locale)
176
188
  end
177
189
 
@@ -208,9 +220,7 @@ module IsoDoc
208
220
  def jcgm_eref(docxml, xpath)
209
221
  return unless @jcgm
210
222
 
211
- docxml.xpath(ns(xpath)).each do |x|
212
- extract_brackets(x)
213
- end
223
+ docxml.xpath(ns(xpath)).each { |x| extract_brackets(x) }
214
224
  # merge adjacent text nodes
215
225
  docxml.root.replace(Nokogiri::XML(docxml.root.to_xml).root)
216
226
  docxml.xpath(ns(xpath)).each do |x| # rubocop: disable Style/CombinableLoops
@@ -233,6 +243,13 @@ module IsoDoc
233
243
  end
234
244
  end
235
245
 
246
+ def quotedtitles(docxml)
247
+ docxml.xpath(ns("//variant-title[@type = 'quoted']")).each do |t|
248
+ t.name = "title"
249
+ t.children.first.previous = "<blacksquare/>"
250
+ end
251
+ end
252
+
236
253
  include Init
237
254
  end
238
255
  end
@@ -61,16 +61,16 @@ module IsoDoc
61
61
  end
62
62
 
63
63
  NUMBERED_SUBCLAUSES = "./clause[not(@unnumbered = 'true')] | "\
64
- "./references[not(@unnumbered = 'true')] | "\
65
- "./term[not(@unnumbered = 'true')] | "\
66
- "./terms[not(@unnumbered = 'true')] | "\
67
- "./definitions[not(@unnumbered = 'true')]".freeze
64
+ "./references[not(@unnumbered = 'true')] | "\
65
+ "./term[not(@unnumbered = 'true')] | "\
66
+ "./terms[not(@unnumbered = 'true')] | "\
67
+ "./definitions[not(@unnumbered = 'true')]".freeze
68
68
 
69
69
  UNNUMBERED_SUBCLAUSES = "./clause[@unnumbered = 'true'] | "\
70
- "./references[@unnumbered = 'true'] | "\
71
- "./term[@unnumbered = 'true'] | "\
72
- "./terms[@unnumbered = 'true'] | "\
73
- "./definitions[@unnumbered = 'true']".freeze
70
+ "./references[@unnumbered = 'true'] | "\
71
+ "./term[@unnumbered = 'true'] | "\
72
+ "./terms[@unnumbered = 'true'] | "\
73
+ "./definitions[@unnumbered = 'true']".freeze
74
74
 
75
75
  def section_name_anchors(clause, num, lvl)
76
76
  lbl = @jcgm ? "clause_jcgm" : "clause"
@@ -157,9 +157,10 @@ module IsoDoc
157
157
  annex_names1(a, num.to_s, 1)
158
158
  else
159
159
  i = Counter.new
160
+ prefix = @jcgm ? "" : "A"
160
161
  clause.xpath(ns(NUMBERED_SUBCLAUSES)).each do |c|
161
162
  i.increment(c)
162
- annex_names1(c, "#{num}.#{i.print}", 2)
163
+ annex_names1(c, "#{prefix}#{num}.#{i.print}", 2)
163
164
  end
164
165
  clause.xpath(ns(UNNUMBERED_SUBCLAUSES))
165
166
  .each { |c| unnumbered_annex_names1(c, 2) }
@@ -19,9 +19,17 @@ module Metanorma
19
19
  "Arial" => nil,
20
20
  "Times New Roman" => nil,
21
21
  "Work Sans" => nil,
22
+ "Work Sans Black" => nil,
23
+ "Work Sans ExtraBold" => nil,
24
+ "Work Sans ExtraLight" => nil,
25
+ "Work Sans Light" => nil,
26
+ "Work Sans Medium" => nil,
27
+ "Work Sans SemiBold" => nil,
28
+ "Work Sans Thin" => nil,
22
29
  "STIX Two Math" => nil,
23
30
  "Source Han Sans" => nil,
24
- "TeX Gyre Chorus" => nil,
31
+ "Source Han Sans Normal" => nil,
32
+ "TeXGyreChorus" => nil,
25
33
  }
26
34
  end
27
35
 
@@ -1,5 +1,5 @@
1
1
  module Metanorma
2
2
  module BIPM
3
- VERSION = "1.1.6".freeze
3
+ VERSION = "1.1.10".freeze
4
4
  end
5
5
  end
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: 1.1.6
4
+ version: 1.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: 2021-08-02 00:00:00.000000000 Z
11
+ date: 2021-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metanorma-generic