isodoc 3.1.11 → 3.1.12

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: 8160c3e32a52cffb4ec08452c22872631c0a55dfd3ae81b3bb5dfdf6269769c6
4
- data.tar.gz: bb0f4a1a46099a5315d97991b6bff04a4f08a5364f8b5d4a3ae74bc4c2a2ea6c
3
+ metadata.gz: 1ce8e37bf69e8622cfac604ad54ea06088dea5c9eec91226d8d9e3f3761693c4
4
+ data.tar.gz: 033de119ca1a8300891954739f892434955f9830ac3becdd0d87f479b8914ba2
5
5
  SHA512:
6
- metadata.gz: 221dafa4fa11246d7b0e61c5553c6199e2a4a58bc409d6389a889a5cb4bee761c6e5a7a8d2936acefd41083cb86436845a6719519d50a675774149fd5a2c92ad
7
- data.tar.gz: de02f2a399990422f41dd6380bd337462b3a90609e1e6caefb7266d117a24b29b17a1b69015188cd087373eeb00ba097678aeed669d8bf7b2a1c73037c7e306b
6
+ metadata.gz: 4d7bf496ad23e75d105f5bdacf73f0d21e537f0d559f53914e78b3da631044500c5887f544290003b3d2508f7926f860ff846857b8ca0a434f23b3f6143033e5
7
+ data.tar.gz: 6644b38d8a81476e6ac6e11b7884685f2942c0b7ee69d5078ee48276eaba30c3e901fcf112594c8202a6fd41bb81e4e7d149e14de9c59350a1fa0b312344580f
@@ -311,9 +311,15 @@ h6:hover > a.anchor,
311
311
  padding: 0;
312
312
  }
313
313
 
314
+ .svg-container {
315
+ width: 100%; /* or any desired width */
316
+ display: block; /* ← removes unwanted inline spacing */
317
+ }
318
+
314
319
  svg {
315
320
  width: 100%;
316
- overflow: visible;
321
+ height: auto; /* ← key to maintaining aspect ratio */
322
+ display: block; /* ← removes unwanted inline spacing */
317
323
  }
318
324
 
319
325
  #standard-band {
@@ -311,7 +311,13 @@ h6:hover > a.anchor,
311
311
  padding: 0;
312
312
  }
313
313
 
314
+ .svg-container {
315
+ width: 100%; /* or any desired width */
316
+ display: block; /* ← removes unwanted inline spacing */
317
+ }
318
+
314
319
  svg {
315
320
  width: 100%;
316
- overflow: visible;
321
+ height: auto; /* ← key to maintaining aspect ratio */
322
+ display: block; /* ← removes unwanted inline spacing */
317
323
  }
@@ -277,6 +277,13 @@ visibility:visible;
277
277
  padding: 0;
278
278
  }
279
279
 
280
+ .svg-container {
281
+ width: 100%; /* or any desired width */
282
+ display: block; /* ← removes unwanted inline spacing */
283
+ }
284
+
280
285
  svg {
281
- width: 100%; overflow: visible;
286
+ width: 100%;
287
+ height: auto; /* ← key to maintaining aspect ratio */
288
+ display: block; /* ← removes unwanted inline spacing */
282
289
  }
@@ -200,33 +200,14 @@ module IsoDoc
200
200
  node&.children&.each { |n| parse(n, out) }
201
201
  end
202
202
 
203
- def location_parse(node, out); end
204
- def author_parse(node, out); end
205
- def xref_label_parse(node, out); end
206
- def name_parse(node, out); end
207
- def semx_definition_parse(node, out); end
208
- def semx_xref_parse(node, out); end
209
- def semx_eref_parse(node, out); end
210
- def semx_link_parse(node, out); end
211
- def semx_origin_parse(node, out); end
212
- def date_parse(node, out); end
213
- def semx_stem_parse(node, out); end
214
- def floating_title_parse(node, out); end
215
- def identifier_parse(node, out); end
216
- def concept_parse(node, out); end
217
- def erefstack_parse(node, out); end
218
- def svgmap_parse(node, out); end
219
- def amend_parse(node, out); end
220
- def semx_sourcecode_parse(node, out); end
221
- def review_note_parse(node, out); end
222
- def semx_source_parse(node, out); end
223
-
224
203
  def fmt_name_parse(node, out)
225
204
  children_parse(node, out)
226
205
  end
227
206
 
228
207
  def fmt_identifier_parse(node, out)
229
- children_parse(node, out)
208
+ out.span style: "white-space: nowrap;" do |s|
209
+ children_parse(node, s)
210
+ end
230
211
  end
231
212
 
232
213
  def fmt_concept_parse(node, out)
@@ -77,6 +77,27 @@ module IsoDoc
77
77
  children_parse(node, e)
78
78
  end
79
79
  end
80
+
81
+ def location_parse(node, out); end
82
+ def author_parse(node, out); end
83
+ def xref_label_parse(node, out); end
84
+ def name_parse(node, out); end
85
+ def semx_definition_parse(node, out); end
86
+ def semx_xref_parse(node, out); end
87
+ def semx_eref_parse(node, out); end
88
+ def semx_link_parse(node, out); end
89
+ def semx_origin_parse(node, out); end
90
+ def date_parse(node, out); end
91
+ def semx_stem_parse(node, out); end
92
+ def floating_title_parse(node, out); end
93
+ def identifier_parse(node, out); end
94
+ def concept_parse(node, out); end
95
+ def erefstack_parse(node, out); end
96
+ def svgmap_parse(node, out); end
97
+ def amend_parse(node, out); end
98
+ def semx_sourcecode_parse(node, out); end
99
+ def review_note_parse(node, out); end
100
+ def semx_source_parse(node, out); end
80
101
  end
81
102
  end
82
103
  end
@@ -100,12 +100,21 @@ module IsoDoc
100
100
  ret
101
101
  end
102
102
 
103
+ def svg_supply_viewbox(svg)
104
+ svg["viewbox"] and return
105
+ svg["height"] && svg["width"] or return
106
+ h = svg["height"].sub(/[^0-9]+$/, "")
107
+ w = svg["width"].sub(/[^0-9]+$/, "")
108
+ h.to_i.positive? && w.to_i.positive? or return
109
+ svg["viewbox"] = "0 0 #{w} #{h}"
110
+ end
111
+
103
112
  def image_body_parse(node, attrs, out)
104
113
  if svg = node.at("./m:svg", "m" => "http://www.w3.org/2000/svg")
105
- svg.delete("width")
106
- svg["height"] = "1px"
107
- svg["padding-bottom"] = "calc(100% * 3 / 4);"
108
- out.parent.add_child(svg)
114
+ svg_supply_viewbox(svg)
115
+ out.div class: "svg-container" do |div|
116
+ div.parent.add_child(svg)
117
+ end
109
118
  else super
110
119
  end
111
120
  end
@@ -83,7 +83,11 @@ module IsoDoc
83
83
  end
84
84
 
85
85
  def status_print(status)
86
- status.split(/[- ]/).map(&:capitalize).join(" ")
86
+ status.split(/[- ]/).map do |w|
87
+ letters = w.chars
88
+ letters.first.upcase!
89
+ letters.join
90
+ end.join(" ")
87
91
  end
88
92
 
89
93
  def docid(isoxml, _out)
@@ -6,6 +6,7 @@ module IsoDoc
6
6
  a = bibdata_current(docxml) or return
7
7
  address_precompose(a)
8
8
  bibdata_i18n(a)
9
+ @xrefs.klass.info docxml, nil
9
10
  end
10
11
 
11
12
  def address_precompose(bib)
@@ -38,17 +39,23 @@ module IsoDoc
38
39
  end
39
40
 
40
41
  def bibdata_i18n(bib)
41
- hash_translate(bib, @i18n.get["doctype_dict"], "./ext/doctype")
42
- hash_translate(bib, @i18n.get["stage_dict"], "./status/stage")
43
- hash_translate(bib, @i18n.get["substage_dict"], "./status/substage")
42
+ hash_translate(bib, @i18n.get["doctype_dict"], "./ext/doctype",
43
+ "//presentation-metadata/doctype-alias", @lang)
44
+ hash_translate(bib, @i18n.get["stage_dict"], "./status/stage", nil, @lang)
45
+ hash_translate(bib, @i18n.get["substage_dict"], "./status/substage", nil,
46
+ @lang)
44
47
  edition_translate(bib)
45
48
  end
46
49
 
47
- def hash_translate(bibdata, hash, xpath, lang = @lang)
48
- x = bibdata.at(ns(xpath)) or return
50
+ # translate dest_xpath in bibdata using lookup in hash
51
+ # source text is dest_xpath by default, can be alt_source_xpath if given
52
+ def hash_translate(bibdata, hash, dest_xpath, alt_source_xpath, lang)
53
+ x = bibdata.at(ns(dest_xpath)) or return
54
+ alt_source_xpath and doctype = bibdata.at(ns(alt_source_xpath))
55
+ doctype ||= x
49
56
  hash.is_a? Hash or return
50
- hash[x.text] or return
51
- tag_translate(x, lang, hash[x.text])
57
+ hash[doctype.text] or return
58
+ tag_translate(x, lang, hash[doctype.text])
52
59
  end
53
60
 
54
61
  # does not allow %Spellout and %Ordinal in the ordinal expression
@@ -41,7 +41,6 @@ module IsoDoc
41
41
  provide_ids docxml # feeds @xrefs.parse
42
42
  @xrefs.parse docxml
43
43
  @xrefs.klass.meta = @meta
44
- @xrefs.klass.info docxml, nil
45
44
  counter_init
46
45
  end
47
46
 
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "3.1.11".freeze
2
+ VERSION = "3.1.12".freeze
3
3
  end
@@ -49,6 +49,7 @@ module IsoDoc
49
49
  word_preface(docxml)
50
50
  word_sourcecode_annotations(docxml)
51
51
  word_sourcecode_table(docxml)
52
+ word_nonbreaking_spans(docxml)
52
53
  word_nested_tables(docxml)
53
54
  word_colgroup(docxml)
54
55
  word_table_align(docxml)
@@ -185,6 +186,17 @@ module IsoDoc
185
186
  out[-1].previous = b.remove
186
187
  end
187
188
  end
189
+
190
+ def word_nonbreaking_spans(docxml)
191
+ docxml.xpath("//span[@style = 'white-space: nowrap;']").each do |s|
192
+ s.delete("style")
193
+ s.traverse do |n|
194
+ n.text? or next
195
+ n.replace(n.text.gsub(" ", "\u00a0").gsub("-", "\u2011")
196
+ .gsub(/\.(?=.)/, ".\u2060"))
197
+ end
198
+ end
199
+ end
188
200
  end
189
201
  end
190
202
  end
@@ -59,7 +59,7 @@ module IsoDoc
59
59
  ret = ret.merge(@pdf_cmd_options)
60
60
  %w(--xsl-file --xsl-file-override).each do |x|
61
61
  ret[x] &&= Pathname.new(File.expand_path(ret[x])).to_s
62
- #.relative_path_from(File.dirname(@xsl)).to_s
62
+ # .relative_path_from(File.dirname(@xsl)).to_s
63
63
  end
64
64
  if ret["--xsl-file"]
65
65
  @xsl = ret["--xsl-file"]
@@ -100,15 +100,15 @@ module IsoDoc
100
100
 
101
101
  def input_xml_path(input_filename, xml_file, debug)
102
102
  docxml, filename, dir = convert_init(xml_file, input_filename, debug)
103
- input_filename = Tempfile.open([File.basename(filename), ".xml"],
104
- mode: File::BINARY | File::SHARE_DELETE,
105
- encoding: "utf-8") do |f|
106
- f.write docxml
107
- f
108
- end
103
+ temp_file = Tempfile.open([File.basename(filename), ".xml"],
104
+ mode: File::BINARY | File::SHARE_DELETE,
105
+ encoding: "utf-8")
106
+ temp_file.write docxml
107
+ temp_file.flush
108
+ @tempfile_cache << temp_file # Add to cache to prevent garbage collection
109
109
  FileUtils.rm_rf dir
110
110
 
111
- [input_filename, docxml, input_filename.path]
111
+ [temp_file, docxml, temp_file.path]
112
112
  end
113
113
  end
114
114
  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: 3.1.11
4
+ version: 3.1.12
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-06-09 00:00:00.000000000 Z
11
+ date: 2025-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64