isodoc 3.2.4 → 3.2.5

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: 819d3c20ea4ccb0037115026969f618e21162b177380574c7d2c3be138ef6f69
4
- data.tar.gz: cb207eec17fa2a44459809689955e60ac612d4db3d44f5c0ad3d91a30da084e2
3
+ metadata.gz: c9fdc30bd68584b0e694c4ebc052d9d5c9377ff0b97d470bf9a71b422cc4c01d
4
+ data.tar.gz: 6eb37637765b514734b06b12beaee5769884636b9163844d6bfd8396e4beff49
5
5
  SHA512:
6
- metadata.gz: 27592d4f55312126f518f475247fdb73125c24af3c1a1e47ed9dadfa9e47418c8b3656ddf8cee4aaa7584ba6852facb051bc6d34cce2b17c16f97cbd077fce7d
7
- data.tar.gz: 190486f76b78338fd7078175141af00165ae0f6f540394ba00b34f35a398aa10f04b8107eeb95e3f60772892aa52a57a2894674a21350ee88eb4e1d413e95631
6
+ metadata.gz: d8368550186c0826ce9f4cf4634b2c00970622eae12ed79582e8ef4002d88349e019a2a641877acf51747513f57d97a3d5bcf98695c5f58f638bec986b73331d
7
+ data.tar.gz: c57d4d8f9a1c32fdef6f3828ee5b11d798de609e80cb72f0eec89a980235d28e5dbabd64431a9c683bbd430f406ddee169547c1af4dfe4bf15c2cfdbfa490d52
@@ -38,8 +38,7 @@ module IsoDoc
38
38
  fnbody.xpath(ns(".//fmt-fn-label")).each do |s|
39
39
  s["class"] = "TableFootnoteRef"
40
40
  s.name = "span"
41
- d = s.at(ns("./span[@class = 'fmt-caption-delim']")) and
42
- s.next = d
41
+ d = s.at(ns("./span[@class = 'fmt-caption-delim']")) and s.next = d
43
42
  end
44
43
  end
45
44
 
@@ -107,14 +107,14 @@ module IsoDoc
107
107
  set(:agency, agency)
108
108
  set(:publisher, connectives_strip(@i18n.boolean_conj(publisher, "and")))
109
109
  set(:copublisher_logos, logos.map { |l| to_datauri(l) })
110
- set(:copublisher_logo_attrs, copublisher_logo_attrs(xml))
110
+ set(:copublisher_logo_attrs, contrib_logo_attrs(xml, "publisher"))
111
111
  agency_addr(xml)
112
112
  end
113
113
 
114
- def copublisher_logo_attrs(xml)
114
+ def contrib_logo_attrs(xml, role)
115
115
  xml.xpath(ns("//metanorma-extension/presentation-metadata/*"))
116
116
  .each_with_object([]) do |x, m|
117
- copublisher_logo_attr?(x) or next
117
+ contrib_logo_attr?(x, role) or next
118
118
  p = x.name.split(/[_-]/)
119
119
  idx = (p[4] || "1").to_i - 1
120
120
  m[idx] ||= {}
@@ -123,8 +123,8 @@ module IsoDoc
123
123
  end
124
124
  end
125
125
 
126
- def copublisher_logo_attr?(elem)
127
- elem.name.start_with?("logo-publisher-") or return false
126
+ def contrib_logo_attr?(elem, role)
127
+ elem.name.start_with?("logo-#{role}-") or return false
128
128
  p = elem.name.split(/[_-]/)
129
129
  %w(doc html).include?(p[2]) &&
130
130
  %w(height width).include?(p[3]) &&
@@ -55,7 +55,8 @@ module IsoDoc
55
55
  end
56
56
 
57
57
  def table_fn(elem)
58
- fnotes = elem.xpath(ns(".//fn")) - elem.xpath(ns("./name//fn"))
58
+ fnotes = elem.xpath(ns(".//fn")) - elem.xpath(ns("./name//fn")) -
59
+ elem.xpath(ns("./fmt-name//fn"))
59
60
  ret = footnote_collect(fnotes)
60
61
  f = footnote_container(fnotes, ret) and elem << f
61
62
  end
@@ -80,9 +81,11 @@ module IsoDoc
80
81
 
81
82
  def non_document_footnotes(docxml)
82
83
  table_fns = docxml.xpath(ns("//table//fn")) -
83
- docxml.xpath(ns("//table/name//fn"))
84
+ docxml.xpath(ns("//table/name//fn")) -
85
+ docxml.xpath(ns("//table/fmt-name//fn"))
84
86
  fig_fns = docxml.xpath(ns("//figure//fn")) -
85
- docxml.xpath(ns("//figure/name//fn"))
87
+ docxml.xpath(ns("//figure/name//fn")) -
88
+ docxml.xpath(ns("//figure/fmt-name//fn"))
86
89
  table_fns + fig_fns
87
90
  end
88
91
 
@@ -117,7 +120,8 @@ module IsoDoc
117
120
 
118
121
  # move footnotes into key
119
122
  def figure_fn(elem)
120
- fn = elem.xpath(ns(".//fn")) - elem.xpath(ns("./name//fn"))
123
+ fn = elem.xpath(ns(".//fn")) - elem.xpath(ns("./name//fn")) -
124
+ elem.xpath(ns("./fmt-name//fn"))
121
125
  fn.empty? and return
122
126
  dl = figure_key_insert_pt(elem)
123
127
  footnote_collect(fn).each do |f|
@@ -169,8 +173,10 @@ module IsoDoc
169
173
  end
170
174
 
171
175
  # Do not insert a comment bookmark inside another comment bookmark
176
+ # Also avoid list labels, which are typically not rendered downstream
177
+ # as selectable text
172
178
  AVOID_COMMENT_BOOKMARKS = <<~XPATH.freeze
173
- [not(ancestor::xmlns:fmt-annotation-start)][not(ancestor::xmlns:fmt-annotation-end)]
179
+ [not(ancestor::xmlns:fmt-annotation-start)][not(ancestor::xmlns:fmt-annotation-end)][not(ancestor::xmlns:fmt-name[parent::xmlns:li])]
174
180
  XPATH
175
181
 
176
182
  def comment_bookmarks_locate(elem)
@@ -4,9 +4,9 @@ module IsoDoc
4
4
  class PresentationXMLConvert < ::IsoDoc::Convert
5
5
  def references(docxml)
6
6
  bibliography_bibitem_number(docxml)
7
- renderings = references_render(docxml)
7
+ @ref_renderings = references_render(docxml)
8
8
  docxml.xpath(ns("//references/bibitem")).each do |x|
9
- bibitem(x, renderings)
9
+ bibitem(x, @ref_renderings)
10
10
  reference_name(x)
11
11
  end
12
12
  hidden_items(docxml)
@@ -86,8 +86,6 @@ module IsoDoc
86
86
  index docxml # fed by strip_duplicate_ids
87
87
  toc docxml
88
88
  display_order docxml # feeds document_footnotes
89
- document_footnotes docxml
90
- comments docxml
91
89
  end
92
90
 
93
91
  def block(docxml)
@@ -111,6 +109,8 @@ module IsoDoc
111
109
  end
112
110
 
113
111
  def inline(docxml)
112
+ document_footnotes docxml
113
+ comments docxml
114
114
  bibitem_lookup(docxml) # feeds citeas
115
115
  fmt_ref docxml # feeds citeas, xref, eref, origin, concept
116
116
  citeas docxml # feeds xref, eref, origin, concept
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "3.2.4".freeze
2
+ VERSION = "3.2.5".freeze
3
3
  end
@@ -63,6 +63,7 @@ module IsoDoc
63
63
  word_floating_titles(docxml)
64
64
  word_section_breaks(docxml)
65
65
  word_tab_clean(docxml)
66
+ word_fn_cleanup(docxml)
66
67
  authority_cleanup(docxml)
67
68
  word_remove_empty_toc(docxml)
68
69
  word_remove_empty_sections(docxml)
@@ -197,6 +198,23 @@ module IsoDoc
197
198
  end
198
199
  end
199
200
  end
201
+
202
+ TABLE_FN_ADJ = <<~XPATH.freeze
203
+ //a[@class='TableFootnoteRef'][following-sibling::*[1][self::a[@class='TableFootnoteRef']]]
204
+ XPATH
205
+
206
+ FN_ADJ = <<~XPATH.freeze
207
+ //span[@class='MsoFootnoteReference'][following-sibling::*[1][self::span[@class='MsoFootnoteReference']]]
208
+ XPATH
209
+
210
+ def word_fn_cleanup(docxml)
211
+ docxml.xpath(TABLE_FN_ADJ).each do |a|
212
+ a.next = '<span class="TableFootnoteRef">, </span>'
213
+ end
214
+ docxml.xpath(FN_ADJ).each do |a|
215
+ a.next = '<span class="MsoFootnoteReference">, </span>'
216
+ end
217
+ end
200
218
  end
201
219
  end
202
220
  end
@@ -92,15 +92,13 @@ module IsoDoc
92
92
  end
93
93
 
94
94
  def toc_word_class_list(classes)
95
- classes.map do |x|
96
- / /.match?(x) ? %(&quot;#{x}&quot;) : x
97
- end.join(",")
95
+ classes.map { |x| "#{x},1" }.join(",")
98
96
  end
99
97
 
100
98
  def word_toc_reqt_preface1
101
99
  <<~TOC
102
100
  <span lang="EN-GB"><span style='mso-element:field-begin'></span><span
103
- style='mso-spacerun:yes'>&#xA0;</span>TOC \\h \\z \\t #{toc_word_class_list reqt_toc_class}
101
+ style='mso-spacerun:yes'>&#xA0;</span>TOC \\h \\z \\t "#{toc_word_class_list reqt_toc_class}"
104
102
  <span style='mso-element:field-separator'></span></span>
105
103
  TOC
106
104
  end
@@ -108,14 +106,14 @@ module IsoDoc
108
106
  def word_toc_table_preface1
109
107
  <<~TOC
110
108
  <span lang="EN-GB"><span style='mso-element:field-begin'></span><span style='mso-spacerun:yes'>&#xA0;</span>TOC
111
- \\h \\z \\t #{toc_word_class_list table_toc_class} <span style='mso-element:field-separator'></span></span>
109
+ \\h \\z \\t "#{toc_word_class_list table_toc_class}" <span style='mso-element:field-separator'></span></span>
112
110
  TOC
113
111
  end
114
112
 
115
113
  def word_toc_figure_preface1
116
114
  <<~TOC
117
115
  <span lang="EN-GB"><span style='mso-element:field-begin'></span><span style='mso-spacerun:yes'>&#xA0;</span>TOC
118
- \\h \\z \\t #{toc_word_class_list figure_toc_class} <span style='mso-element:field-separator'></span></span>
116
+ \\h \\z \\t "#{toc_word_class_list figure_toc_class}" <span style='mso-element:field-separator'></span></span>
119
117
  TOC
120
118
  end
121
119
 
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: 3.2.4
4
+ version: 3.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-08-18 00:00:00.000000000 Z
11
+ date: 2025-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64