isodoc 2.11.2 → 2.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/isodoc/base_style/all.css +4 -1
- data/lib/isodoc/base_style/reset.css +4 -1
- data/lib/isodoc/base_style/reset.scss +5 -1
- data/lib/isodoc/presentation_function/bibdata.rb +4 -5
- data/lib/isodoc/presentation_function/block.rb +2 -1
- data/lib/isodoc/presentation_function/inline.rb +4 -1
- data/lib/isodoc/presentation_function/math.rb +36 -6
- data/lib/isodoc/presentation_function/metadata.rb +12 -4
- data/lib/isodoc/presentation_function/section.rb +4 -10
- data/lib/isodoc/presentation_function/terms.rb +0 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/comments.rb +0 -1
- data/lib/isodoc/xref/xref_gen_seq.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9890e0801befbe1a13b4138f01f702537e46d4cc482ac99f03f1faf1e7ac532b
|
4
|
+
data.tar.gz: 69ba3b17b78d0a464cae75213d0eadca3047d0cb7c55a148db7d014b25f2bbd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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; }
|
@@ -232,7 +235,7 @@ h6:hover > a.anchor,
|
|
232
235
|
background-color: #777;
|
233
236
|
color: white;
|
234
237
|
cursor: pointer;
|
235
|
-
padding:
|
238
|
+
padding: 3px 0;
|
236
239
|
margin: 0;
|
237
240
|
width: 100%;
|
238
241
|
border: none;
|
@@ -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; }
|
@@ -232,7 +235,7 @@ h6:hover > a.anchor,
|
|
232
235
|
background-color: #777;
|
233
236
|
color: white;
|
234
237
|
cursor: pointer;
|
235
|
-
padding:
|
238
|
+
padding: 3px 0;
|
236
239
|
margin: 0;
|
237
240
|
width: 100%;
|
238
241
|
border: none;
|
@@ -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;
|
@@ -235,7 +239,7 @@ visibility:visible;
|
|
235
239
|
background-color: #777;
|
236
240
|
color: white;
|
237
241
|
cursor: pointer;
|
238
|
-
padding:
|
242
|
+
padding: 3px 0;
|
239
243
|
margin: 0;
|
240
244
|
width: 100%;
|
241
245
|
border: none;
|
@@ -29,11 +29,10 @@ module IsoDoc
|
|
29
29
|
|
30
30
|
def bibdata_current(docxml)
|
31
31
|
a = docxml.at(ns("//bibdata")) or return
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
l.text == @script and l["current"] = "true"
|
32
|
+
{ language: @lang, script: @script, locale: @locale }.each do |k, v|
|
33
|
+
a.xpath(ns("./#{k}")).each do |l|
|
34
|
+
l.text == v and l["current"] = "true"
|
35
|
+
end
|
37
36
|
end
|
38
37
|
a
|
39
38
|
end
|
@@ -119,7 +119,8 @@ module IsoDoc
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def amend1(elem)
|
122
|
-
elem.xpath(ns("./autonumber"
|
122
|
+
elem.xpath(ns("./locality | ./localityStack | ./autonumber | " \
|
123
|
+
"./classification | ./contributor")).each(&:remove)
|
123
124
|
elem.xpath(ns("./newcontent")).each { |a| a.name = "quote" }
|
124
125
|
elem.xpath(ns("./description")).each { |a| a.replace(a.children) }
|
125
126
|
elem.replace(elem.children)
|
@@ -85,7 +85,10 @@ module IsoDoc
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def identifier(docxml)
|
88
|
-
docxml.xpath(ns("//identifier"))
|
88
|
+
(docxml.xpath(ns("//identifier")) -
|
89
|
+
docxml.xpath(ns("//bibdata/identifier")) -
|
90
|
+
docxml.xpath(ns("//bibitema/identifier")))
|
91
|
+
.each do |n|
|
89
92
|
n.name = "tt"
|
90
93
|
end
|
91
94
|
end
|
@@ -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
|
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
|
@@ -40,6 +41,8 @@ module IsoDoc
|
|
40
41
|
end
|
41
42
|
|
42
43
|
def implicit_number_formatter(num, locale)
|
44
|
+
num.ancestors("formula").empty? or return
|
45
|
+
## by default, no formatting in formulas
|
43
46
|
fmt = { significant: num_totaldigits(num.text) }.compact
|
44
47
|
n = normalise_number(num.text)
|
45
48
|
@numfmt.localized_number(n, locale:, format: fmt,
|
@@ -59,7 +62,7 @@ module IsoDoc
|
|
59
62
|
.each do |i|
|
60
63
|
ret[i] &&= ret[i].to_i
|
61
64
|
end
|
62
|
-
%i(notation exponent_sign locale).each do |i|
|
65
|
+
%i(notation exponent_sign number_sign locale).each do |i|
|
63
66
|
ret[i] &&= ret[i].to_sym
|
64
67
|
end
|
65
68
|
ret
|
@@ -76,12 +79,39 @@ module IsoDoc
|
|
76
79
|
end
|
77
80
|
|
78
81
|
def explicit_number_formatter_cfg(num, fmt)
|
79
|
-
symbols = twitter_cldr_localiser_symbols.dup.
|
80
|
-
|
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)
|
81
91
|
signif = symbols[:significant]
|
82
92
|
(symbols.keys & %i(precision digit_count)).empty? and
|
83
93
|
signif ||= num_totaldigits(num.text)
|
84
|
-
|
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
|
85
115
|
end
|
86
116
|
|
87
117
|
def num_precision(num)
|
@@ -5,6 +5,12 @@ module IsoDoc
|
|
5
5
|
fonts_metadata(docxml)
|
6
6
|
attachments_extract(docxml)
|
7
7
|
preprocess_xslt_insert(docxml)
|
8
|
+
localized_strings(docxml)
|
9
|
+
a = docxml.at(ns("//metanorma-extension")) or return
|
10
|
+
a.elements.empty? and a.remove
|
11
|
+
end
|
12
|
+
|
13
|
+
def localized_strings(docxml)
|
8
14
|
a = docxml.at(ns("//bibdata")) or return
|
9
15
|
a.next =
|
10
16
|
"<localized-strings>#{i8n_name(trim_hash(@i18n.get), '').join}" \
|
@@ -37,9 +43,11 @@ module IsoDoc
|
|
37
43
|
|
38
44
|
def extension_insert_pt(xml)
|
39
45
|
xml.at(ns("//metanorma-extension")) ||
|
40
|
-
xml.at(ns("//bibdata"))
|
46
|
+
xml.at(ns("//bibdata"))
|
47
|
+
&.after("<metanorma-extension> </metanorma-extension>")
|
41
48
|
&.next_element ||
|
42
|
-
xml.root.elements.first
|
49
|
+
xml.root.elements.first
|
50
|
+
.before("<metanorma-extension> </metanorma-extension>")
|
43
51
|
.previous_element
|
44
52
|
end
|
45
53
|
|
@@ -58,7 +66,7 @@ module IsoDoc
|
|
58
66
|
def fonts_metadata(xmldoc)
|
59
67
|
ins = presmeta_insert_pt(xmldoc)
|
60
68
|
@fontist_fonts and CSV.parse_line(@fontist_fonts, col_sep: ";")
|
61
|
-
.map(&:strip).
|
69
|
+
.map(&:strip).reverse_each do |f|
|
62
70
|
ins.next = presmeta("fonts", f)
|
63
71
|
end
|
64
72
|
@fontlicenseagreement and
|
@@ -67,7 +75,7 @@ module IsoDoc
|
|
67
75
|
|
68
76
|
def presmeta_insert_pt(xmldoc)
|
69
77
|
xmldoc.at(ns("//presentation-metadata")) ||
|
70
|
-
xmldoc
|
78
|
+
extension_insert_pt(xmldoc).children.last
|
71
79
|
end
|
72
80
|
|
73
81
|
def presmeta(name, value)
|
@@ -6,7 +6,6 @@ module IsoDoc
|
|
6
6
|
s = docxml.at(ns("//sections")) or return
|
7
7
|
t = @meta.get[:doctitle]
|
8
8
|
t.nil? || t.empty? and return
|
9
|
-
#s.children.first.previous =
|
10
9
|
s.add_first_child "<p class='zzSTDTitle1'>#{t}</p>"
|
11
10
|
end
|
12
11
|
|
@@ -16,7 +15,6 @@ module IsoDoc
|
|
16
15
|
.each do |f|
|
17
16
|
f.parent.name == "annex" &&
|
18
17
|
@xrefs.klass.single_term_clause?(f.parent) and next
|
19
|
-
|
20
18
|
clause1(f)
|
21
19
|
end
|
22
20
|
end
|
@@ -41,14 +39,13 @@ module IsoDoc
|
|
41
39
|
p = "//clause | //annex | //appendix | //introduction | //foreword | " \
|
42
40
|
"//preface/abstract | //acknowledgements | //terms | " \
|
43
41
|
"//definitions | //references | //colophon | //indexsect"
|
44
|
-
docxml.xpath(ns(p)).each
|
45
|
-
floattitle1(f)
|
46
|
-
end
|
42
|
+
docxml.xpath(ns(p)).each { |f| floattitle1(f) }
|
47
43
|
# top-level
|
48
44
|
docxml.xpath(ns("//sections | //preface | //colophon"))
|
49
45
|
.each { |f| floattitle1(f) }
|
50
46
|
end
|
51
47
|
|
48
|
+
# TODO not currently doing anything with the @depth attribute of floating-title
|
52
49
|
def floattitle1(elem)
|
53
50
|
elem.xpath(ns(".//floating-title")).each do |p|
|
54
51
|
p.name = "p"
|
@@ -67,9 +64,8 @@ module IsoDoc
|
|
67
64
|
|
68
65
|
def annex1(elem)
|
69
66
|
lbl = @xrefs.anchor(elem["id"], :label)
|
70
|
-
|
67
|
+
t = elem.at(ns("./title")) and
|
71
68
|
t.children = "<strong>#{to_xml(t.children)}</strong>"
|
72
|
-
end
|
73
69
|
unnumbered_clause?(elem) and return
|
74
70
|
prefix_name(elem, "<br/><br/>", lbl, "title")
|
75
71
|
end
|
@@ -129,7 +125,7 @@ module IsoDoc
|
|
129
125
|
%w(note admonition p).include?(p.name) or break m
|
130
126
|
m << p
|
131
127
|
end
|
132
|
-
out.reject { |c| c["displayorder"] }.
|
128
|
+
out.reject { |c| c["displayorder"] }.reverse_each do |c|
|
133
129
|
c["displayorder"] = idx
|
134
130
|
idx += 1
|
135
131
|
end
|
@@ -195,7 +191,6 @@ module IsoDoc
|
|
195
191
|
preface.elements.each do |x|
|
196
192
|
((x.name == "floating-title" || x.at(xpath)) &&
|
197
193
|
xpath != "./self::*[not(following-sibling::*)]") or prev = x
|
198
|
-
# after.include?(x.name) or next
|
199
194
|
x.at(xpath) or next
|
200
195
|
clause == prev and break
|
201
196
|
prev ||= preface.children.first
|
@@ -248,7 +243,6 @@ module IsoDoc
|
|
248
243
|
def toc_refs(docxml)
|
249
244
|
docxml.xpath(ns("//toc//xref[text()]")).each do |x|
|
250
245
|
lbl = @xrefs.anchor(x["target"], :label) or next
|
251
|
-
#x.children.first.previous = "#{lbl}<tab/>"
|
252
246
|
x.add_first_child "#{lbl}<tab/>"
|
253
247
|
end
|
254
248
|
end
|
data/lib/isodoc/version.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2024-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: base64
|