isodoc 2.11.2 → 2.11.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 806dd6df2ad1f9acfbebcc324d1c2b88b035c3242b9655ee1c82c7a7eb3d40cc
4
- data.tar.gz: 1bc15cb526e0bbd4f8151facf0c20567ee2776046a325bb4dac96ce9e7eee40b
3
+ metadata.gz: 4228f130d19273b278dcf701d27c405d37a7843b053eed057b424af2d7399b09
4
+ data.tar.gz: 003b627868c9e53ae1eb6baf7f9cb71a06a3e3e0c09b6102cd5e1dc7c45faee5
5
5
  SHA512:
6
- metadata.gz: 356559fad5bb12c0bc7e8cfec04f2c7bb625be430f702a21d825d7fc5c03e0ac037e5d7490f7712d1294b9151997fac54125ff751f88a9cd8ae51412ce36e2bc
7
- data.tar.gz: a8579583084ad8ca0956a927ddd4e4ef1b386bc4979676ee8edd8f866b4031e6411764e5f49f62e2c293f0eadf83f04caccfcfcd0a0d70360bbd31a27999d215
6
+ metadata.gz: 2e865cfbe5a51e7a78a1562b7d88b7930a0eacf8db22e94c0e4ed0dc12f7c76b75975c98296a0f1624c82d729fdc03a5715f01237a14b68fa8b612a17f297a49
7
+ data.tar.gz: 533d41c63cf5955bc60f7223716cfea1151d959d0cdec32577154159c88abe4d9c0d81b2c8256fccc3e1b02d2e59dd8dcff613dee425f64ce417e390b77e3fe2
@@ -232,7 +232,7 @@ h6:hover > a.anchor,
232
232
  background-color: #777;
233
233
  color: white;
234
234
  cursor: pointer;
235
- padding: 12px 0;
235
+ padding: 3px 0;
236
236
  margin: 0;
237
237
  width: 100%;
238
238
  border: none;
@@ -232,7 +232,7 @@ h6:hover > a.anchor,
232
232
  background-color: #777;
233
233
  color: white;
234
234
  cursor: pointer;
235
- padding: 12px 0;
235
+ padding: 3px 0;
236
236
  margin: 0;
237
237
  width: 100%;
238
238
  border: none;
@@ -235,7 +235,7 @@ visibility:visible;
235
235
  background-color: #777;
236
236
  color: white;
237
237
  cursor: pointer;
238
- padding: 12px 0;
238
+ padding: 3px 0;
239
239
  margin: 0;
240
240
  width: 100%;
241
241
  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
- a.xpath(ns("./language")).each do |l|
33
- l.text == @lang and l["current"] = "true"
34
- end
35
- a.xpath(ns("./script")).each do |l|
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")).each(&:remove)
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")).each do |n|
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
@@ -40,6 +40,8 @@ module IsoDoc
40
40
  end
41
41
 
42
42
  def implicit_number_formatter(num, locale)
43
+ num.ancestors("formula").empty? or return
44
+ ## by default, no formatting in formulas
43
45
  fmt = { significant: num_totaldigits(num.text) }.compact
44
46
  n = normalise_number(num.text)
45
47
  @numfmt.localized_number(n, locale:, format: fmt,
@@ -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"))&.after("<metanorma-extension/>")
46
+ xml.at(ns("//bibdata"))
47
+ &.after("<metanorma-extension> </metanorma-extension>")
41
48
  &.next_element ||
42
- xml.root.elements.first.before("<metanorma-extension/>")
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).reverse.each do |f|
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.at(ns("//metanorma-extension")) || xmldoc.at(ns("//bibdata"))
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 do |f|
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
- if t = elem.at(ns("./title"))
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"] }.reverse.each do |c|
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
@@ -9,7 +9,6 @@ module IsoDoc
9
9
  end
10
10
 
11
11
  def deprecates(elem)
12
- #elem.children.first.previous = @i18n.l10n("#{@i18n.deprecated}: ")
13
12
  elem.add_first_child @i18n.l10n("#{@i18n.deprecated}: ")
14
13
  end
15
14
 
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "2.11.2".freeze
2
+ VERSION = "2.11.3".freeze
3
3
  end
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.2
4
+ version: 2.11.3
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-02 00:00:00.000000000 Z
11
+ date: 2024-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64