isodoc 2.11.3 → 2.11.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4228f130d19273b278dcf701d27c405d37a7843b053eed057b424af2d7399b09
4
- data.tar.gz: 003b627868c9e53ae1eb6baf7f9cb71a06a3e3e0c09b6102cd5e1dc7c45faee5
3
+ metadata.gz: 9890e0801befbe1a13b4138f01f702537e46d4cc482ac99f03f1faf1e7ac532b
4
+ data.tar.gz: 69ba3b17b78d0a464cae75213d0eadca3047d0cb7c55a148db7d014b25f2bbd0
5
5
  SHA512:
6
- metadata.gz: 2e865cfbe5a51e7a78a1562b7d88b7930a0eacf8db22e94c0e4ed0dc12f7c76b75975c98296a0f1624c82d729fdc03a5715f01237a14b68fa8b612a17f297a49
7
- data.tar.gz: 533d41c63cf5955bc60f7223716cfea1151d959d0cdec32577154159c88abe4d9c0d81b2c8256fccc3e1b02d2e59dd8dcff613dee425f64ce417e390b77e3fe2
6
+ metadata.gz: 1db6e8c07945fb2ad57b19094279d0e26f8638e1e6fefaa261ec9230438dfaf0cea0c7ec6b49276f4108332d41d875c23fd8aa57295bdbbaaee88846f1375ce2
7
+ data.tar.gz: 0e127ca60d5841b344d0e3b399475fb5adfb9b72b4df6ae5a2943df95b39f40ab56f486f3eae669b26b2fd239e13d02503e97834fea758575324af7795ca2584
@@ -75,6 +75,9 @@ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
75
75
  p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
76
76
  font-size: {{monospacefontsize}}; }
77
77
 
78
+ sub, sup {
79
+ font-size: 0.75em; }
80
+
78
81
  article, aside, details, figcaption, figure,
79
82
  footer, header, hgroup, menu, nav, section {
80
83
  display: block; }
@@ -75,6 +75,9 @@ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
75
75
  p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
76
76
  font-size: {{monospacefontsize}}; }
77
77
 
78
+ sub, sup {
79
+ font-size: 0.75em; }
80
+
78
81
  article, aside, details, figcaption, figure,
79
82
  footer, header, hgroup, menu, nav, section {
80
83
  display: block; }
@@ -81,6 +81,10 @@ p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td sam
81
81
  font-size: $monospacefontsize;
82
82
  }
83
83
 
84
+ sub, sup {
85
+ font-size: 0.75em;
86
+ }
87
+
84
88
  article, aside, details, figcaption, figure,
85
89
  footer, header, hgroup, menu, nav, section {
86
90
  display: block;
@@ -21,9 +21,10 @@ module IsoDoc
21
21
  # TwitterCldr::DataReaders::NumberDataReader.new(locale).symbols
22
22
  def localize_maths(node, locale)
23
23
  node.xpath(".//m:mn", MATHML).each do |x|
24
+ fmt = x["data-metanorma-numberformat"]
25
+ x.delete("data-metanorma-numberformat")
24
26
  x.children =
25
- if fmt = x["data-metanorma-numberformat"]
26
- x.delete("data-metanorma-numberformat")
27
+ if !fmt.nil? && !fmt.empty?
27
28
  explicit_number_formatter(x, locale, fmt)
28
29
  else implicit_number_formatter(x, locale)
29
30
  end
@@ -61,7 +62,7 @@ module IsoDoc
61
62
  .each do |i|
62
63
  ret[i] &&= ret[i].to_i
63
64
  end
64
- %i(notation exponent_sign locale).each do |i|
65
+ %i(notation exponent_sign number_sign locale).each do |i|
65
66
  ret[i] &&= ret[i].to_sym
66
67
  end
67
68
  ret
@@ -78,12 +79,39 @@ module IsoDoc
78
79
  end
79
80
 
80
81
  def explicit_number_formatter_cfg(num, fmt)
81
- symbols = twitter_cldr_localiser_symbols.dup.merge(fmt)
82
- precision = symbols[:precision] || num_precision(num.text)
82
+ symbols = twitter_cldr_localiser_symbols.dup.transform_values do |v|
83
+ v.is_a?(String) ? HTMLEntities.new.decode(v) : v
84
+ end.merge(fmt)
85
+ symbols = large_notation_fmt(symbols, num.text)
86
+ [symbols[:precision] || num_precision(num.text), symbols,
87
+ explicit_number_formatter_signif(num, symbols)]
88
+ end
89
+
90
+ def explicit_number_formatter_signif(num, symbols)
83
91
  signif = symbols[:significant]
84
92
  (symbols.keys & %i(precision digit_count)).empty? and
85
93
  signif ||= num_totaldigits(num.text)
86
- [precision, symbols, signif]
94
+ signif
95
+ end
96
+
97
+ def large_notation_fmt(symbols, num)
98
+ n = symbols[:large_notation]
99
+ min = BigDecimal(symbols[:large_notation_min] || "1e-6")
100
+ max = BigDecimal(symbols[:large_notation_max] || "1e6")
101
+ n1 = large_notation_fmt1(num, n, min, max) and symbols[:notation] = n1
102
+ symbols.delete(:large_notation)
103
+ symbols.delete(:large_notation_min)
104
+ symbols.delete(:large_notation_max)
105
+ symbols
106
+ end
107
+
108
+ def large_notation_fmt1(num, notation, min, max)
109
+ notation.nil? || notation == "nil" and return nil
110
+ val = BigDecimal(num).abs
111
+ val.zero? and return nil
112
+ val < min and return notation
113
+ val > max and return notation
114
+ nil
87
115
  end
88
116
 
89
117
  def num_precision(num)
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "2.11.3".freeze
2
+ VERSION = "2.11.4".freeze
3
3
  end
@@ -64,7 +64,6 @@ module IsoDoc
64
64
  'span[@style="MsoCommentReference"]'.freeze
65
65
 
66
66
  def embed_comment_in_comment_list(docxml)
67
- # docxml.xpath(COMMENT_IN_COMMENT_LIST).each do |x|
68
67
  docxml.xpath(COMMENT_IN_COMMENT_LIST1).each do |x|
69
68
  n = x.next_element
70
69
  n&.children&.first&.add_previous_sibling(x.remove)
@@ -66,7 +66,7 @@ module IsoDoc
66
66
  def sequential_table_names(clause, container: false)
67
67
  c = Counter.new
68
68
  clause.xpath(ns(".//table")).noblank.each do |t|
69
- labelled_ancestor(t) and next
69
+ # labelled_ancestor(t) and next
70
70
  @anchors[t["id"]] = anchor_struct(
71
71
  c.increment(t).print, container ? t : nil,
72
72
  @labels["table"], "table", t["unnumbered"]
@@ -190,7 +190,7 @@ container: false)
190
190
  def hierarchical_table_names(clause, num)
191
191
  c = Counter.new
192
192
  clause.xpath(ns(".//table")).noblank.each do |t|
193
- labelled_ancestor(t) and next
193
+ # labelled_ancestor(t) and next
194
194
  @anchors[t["id"]] =
195
195
  anchor_struct("#{num}#{hiersep}#{c.increment(t).print}",
196
196
  nil, @labels["table"], "table", t["unnumbered"])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: isodoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.11.3
4
+ version: 2.11.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-16 00:00:00.000000000 Z
11
+ date: 2024-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64