isodoc 1.8.3.3 → 1.8.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: 3da5eefcb4bd6e16b30199a41a2799abd1faac4f8102b3d119047ecd24a175d6
4
- data.tar.gz: 920d6ee9e4233bc4c3575b2358d2df680032e6b7f6a492bd46dcd0c6b5b3efe0
3
+ metadata.gz: 3189a7f65994e9185f29009eb40bb6589c83f579996199d34c669b44883a6548
4
+ data.tar.gz: 8462af8b54793cbc7dda2e98a2005a8ec11d4d17657a3fb63b3f2865950cf8c9
5
5
  SHA512:
6
- metadata.gz: 7ed8c4acbea2dcbbd7f523ad75319de642463e1b535df1ae682abd32649e568243759bb857ed93efb411b8d4b146a2dd1775246e020ddd85edf2864f064c1f79
7
- data.tar.gz: 14c07986dc7969dbe63285762e5a214917fbe88430ead384c759aadc299a5fa468e998b576e2ef28223267a17eef9022e12932bea46b38cc5d813e41cf207b90
6
+ metadata.gz: 4cd5b57e05c214e49e703f808799195e4b1d7b158a9e07fd4e728a369b8f1406d735eb7576e182abe28ba40529dc22a70db28f50e77f2548aed08ae0ff139d5c
7
+ data.tar.gz: 12eb151374efdde8fd26302aeecdde46e25a7db4147f4bbf1dd54256f460f8ef5f29880bbaa170171abb5d451bf11b1d1b29ff24bbba15746d28249f5ec283f6
@@ -68,6 +68,12 @@ code *, pre *, tt *, kbd *, samp * {
68
68
  font-family: {{monospacefont}} !important;
69
69
  font-variant-ligatures: none; }
70
70
 
71
+ p code, dt code, li code, label code, legend code, caption code, th code, td code,
72
+ p tt, dt tt, li tt, label tt, legend tt, caption tt, th tt, td tt,
73
+ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
74
+ p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
75
+ font-size: {{monospacefontsize}}; }
76
+
71
77
  article, aside, details, figcaption, figure,
72
78
  footer, header, hgroup, menu, nav, section {
73
79
  display: block; }
@@ -79,6 +85,9 @@ table {
79
85
  h1, h2, h3, h4, h5, h6 {
80
86
  font-family: {{headerfont}}; }
81
87
 
88
+ .h1, .h2, .h3, .h4, .h5, .h6 {
89
+ font-family: {{headerfont}}; }
90
+
82
91
  blockquote, q {
83
92
  quotes: none; }
84
93
  blockquote:before, blockquote:after, q:before, q:after {
@@ -68,6 +68,12 @@ code *, pre *, tt *, kbd *, samp * {
68
68
  font-family: {{monospacefont}} !important;
69
69
  font-variant-ligatures: none; }
70
70
 
71
+ p code, dt code, li code, label code, legend code, caption code, th code, td code,
72
+ p tt, dt tt, li tt, label tt, legend tt, caption tt, th tt, td tt,
73
+ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
74
+ p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
75
+ font-size: {{monospacefontsize}}; }
76
+
71
77
  article, aside, details, figcaption, figure,
72
78
  footer, header, hgroup, menu, nav, section {
73
79
  display: block; }
@@ -79,6 +85,9 @@ table {
79
85
  h1, h2, h3, h4, h5, h6 {
80
86
  font-family: {{headerfont}}; }
81
87
 
88
+ .h1, .h2, .h3, .h4, .h5, .h6 {
89
+ font-family: {{headerfont}}; }
90
+
82
91
  blockquote, q {
83
92
  quotes: none; }
84
93
  blockquote:before, blockquote:after, q:before, q:after {
@@ -74,6 +74,13 @@ code *, pre *, tt *, kbd *, samp * {
74
74
  font-variant-ligatures: none;
75
75
  }
76
76
 
77
+ p code, dt code, li code, label code, legend code, caption code, th code, td code,
78
+ p tt, dt tt, li tt, label tt, legend tt, caption tt, th tt, td tt,
79
+ p kbd, dt kbd, li kbd, label kbd, legend kbd, caption kbd, th kbd, td kbd,
80
+ p samp, dt samp, li samp, label samp, legend samp, caption samp, th samp, td samp {
81
+ font-size: $monospacefontsize;
82
+ }
83
+
77
84
  article, aside, details, figcaption, figure,
78
85
  footer, header, hgroup, menu, nav, section {
79
86
  display: block;
@@ -88,6 +95,10 @@ h1, h2, h3, h4, h5, h6 {
88
95
  font-family: $headerfont;
89
96
  }
90
97
 
98
+ .h1, .h2, .h3, .h4, .h5, .h6 {
99
+ font-family: $headerfont;
100
+ }
101
+
91
102
  blockquote, q {
92
103
  quotes: none;
93
104
 
@@ -28,25 +28,37 @@ module IsoDoc
28
28
  Liquid::Template.parse(doc)
29
29
  end
30
30
 
31
- def case_strict(text, casing, script)
31
+ def case_strict(text, casing, script, firstonly: true)
32
32
  return text unless %w(Latn Cyrl Grek Armn).include?(script)
33
33
 
34
- letters = text.chars
34
+ seen = false
35
+ text.split(/(\s+)/).map do |w|
36
+ letters = w.chars
37
+ case_strict1(letters, casing) if !seen || !firstonly
38
+ seen ||= /\S/.match?(w)
39
+ letters.join
40
+ end.join
41
+ end
42
+
43
+ def case_strict1(letters, casing)
44
+ return letters if letters.empty?
45
+
35
46
  case casing
36
47
  when "capital" then letters.first.upcase!
37
48
  when "lowercase" then letters.first.downcase!
49
+ when "allcaps" then letters.map(&:upcase!)
38
50
  end
39
- letters.join
40
51
  end
41
52
 
42
- def case_with_markup(linkend, casing, script)
53
+ def case_with_markup(linkend, casing, script, firstonly: true)
43
54
  seen = false
44
55
  xml = Nokogiri::XML("<root>#{linkend}</root>")
45
56
  xml.traverse do |b|
46
57
  next unless b.text? && !seen
47
58
 
48
- b.replace(Common::case_strict(b.text, casing, script))
49
- seen = true
59
+ b.replace(Common::case_strict(b.text, casing, script,
60
+ firstonly: firstonly))
61
+ seen = true if firstonly
50
62
  end
51
63
  xml.root.children.to_xml
52
64
  end
@@ -5,6 +5,7 @@ require "fileutils"
5
5
  require "tempfile"
6
6
  require_relative "i18n"
7
7
  require_relative "css"
8
+ require "securerandom"
8
9
 
9
10
  module IsoDoc
10
11
  class Convert < ::IsoDoc::Common
@@ -103,10 +104,16 @@ module IsoDoc
103
104
  @fn_bookmarks = {}
104
105
  @baseassetpath = options[:baseassetpath]
105
106
  @aligncrosselements = options[:aligncrosselements]
107
+ @tmpimagedir_suffix = tmpimagedir_suffix
108
+ @tmpfilesdir_suffix = tmpfilesdir_suffix
106
109
  end
107
110
 
108
111
  def tmpimagedir_suffix
109
- "_images"
112
+ "_#{SecureRandom.hex(8)}_images"
113
+ end
114
+
115
+ def tmpfilesdir_suffix
116
+ "_#{SecureRandom.hex(8)}_files"
110
117
  end
111
118
 
112
119
  def html_doc_path(*file)
@@ -174,10 +174,13 @@ module IsoDoc
174
174
  end
175
175
  end
176
176
 
177
- def para_class(_node)
177
+ def para_class(node)
178
178
  classtype = nil
179
179
  classtype = "MsoCommentText" if in_comment
180
180
  classtype = "Sourcecode" if @annotation
181
+ if node["type"] == "floating-title"
182
+ classtype = "h#{node['depth']}"
183
+ end
181
184
  classtype
182
185
  end
183
186
 
@@ -30,7 +30,7 @@ module IsoDoc
30
30
  end
31
31
 
32
32
  def init_dir(filename, debug)
33
- dir = "#{filename}_files"
33
+ dir = "#{filename}#{@tmpfilesdir_suffix}"
34
34
  unless debug
35
35
  Dir.mkdir(dir, 0o777) unless File.exists?(dir)
36
36
  FileUtils.rm_rf "#{dir}/*"
@@ -40,11 +40,11 @@ module IsoDoc
40
40
 
41
41
  # tmp image dir is same directory as @filename
42
42
  def tmpimagedir
43
- @filename + tmpimagedir_suffix
43
+ @filename + @tmpimagedir_suffix
44
44
  end
45
45
 
46
46
  def rel_tmpimagedir
47
- Pathname.new(@filename).basename.to_s + tmpimagedir_suffix
47
+ Pathname.new(@filename).basename.to_s + @tmpimagedir_suffix
48
48
  end
49
49
 
50
50
  # isodoc.css overrides any CSS injected by Html2Doc, which
@@ -142,9 +142,9 @@ module IsoDoc
142
142
 
143
143
  def header_strip_elem?(elem)
144
144
  elem.name == "img" ||
145
- elem.name == "span" && elem["class"] == "MsoCommentReference" ||
146
- elem.name == "a" && elem["class"] == "FootnoteRef" ||
147
- elem.name == "span" && /mso-bookmark/.match(elem["style"])
145
+ (elem.name == "span" && elem["class"] == "MsoCommentReference") ||
146
+ (elem.name == "a" && elem["class"] == "FootnoteRef") ||
147
+ (elem.name == "span" && /mso-bookmark/.match(elem["style"]))
148
148
  end
149
149
 
150
150
  def liquid(doc)
@@ -192,12 +192,6 @@ module IsoDoc
192
192
  save_dataimage(img["src"], false)
193
193
  when %r{^([A-Z]:)?/}
194
194
  img["src"]
195
- =begin
196
- if /^data:/.match? img["src"]
197
- save_dataimage(img["src"], false)
198
- elsif %r{^([A-Z]:)?/}.match? img["src"]
199
- img["src"]
200
- =end
201
195
  else
202
196
  File.join(@localdir, img["src"])
203
197
  end
@@ -213,12 +207,16 @@ module IsoDoc
213
207
  application/x-msmetafile image/x-xbitmap).include? type
214
208
  end
215
209
 
216
- def cleanup_entities(text)
210
+ def cleanup_entities(text, is_xml: true)
217
211
  c = HTMLEntities.new
218
- text.split(/([<>])/).each_slice(4).map do |a|
219
- a[0] = c.encode(c.decode(a[0]), :hexadecimal)
220
- a
221
- end.join
212
+ if is_xml
213
+ text.split(/([<>])/).each_slice(4).map do |a|
214
+ a[0] = c.encode(c.decode(a[0]), :hexadecimal)
215
+ a
216
+ end.join
217
+ else
218
+ c.encode(c.decode(text), :hexadecimal)
219
+ end
222
220
  end
223
221
 
224
222
  def external_path(path)
@@ -10,7 +10,7 @@ module IsoDoc
10
10
  include HtmlFunction::Html
11
11
 
12
12
  def tmpimagedir_suffix
13
- "_headlessimages"
13
+ "_#{SecureRandom.hex(8)}_headlessimages"
14
14
  end
15
15
 
16
16
  def initialize(options)
@@ -13,7 +13,7 @@ module IsoDoc
13
13
  include HtmlFunction::Html
14
14
 
15
15
  def tmpimagedir_suffix
16
- "_htmlimages"
16
+ "_#{SecureRandom.hex(8)}_htmlimages"
17
17
  end
18
18
 
19
19
  def initialize(options)
data/lib/isodoc/i18n.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "yaml"
2
+ require_relative "function/utils"
2
3
 
3
4
  module IsoDoc
4
5
  class I18n
@@ -17,7 +18,7 @@ module IsoDoc
17
18
  end
18
19
  ret
19
20
  when Array then ret.map { |n| normalise_hash(n) }
20
- when String then ret.unicode_normalize(:nfc)
21
+ when String then cleanup_entities(ret.unicode_normalize(:nfc))
21
22
  else ret
22
23
  end
23
24
  end
@@ -96,8 +97,9 @@ module IsoDoc
96
97
  xml.traverse do |n|
97
98
  next unless n.text?
98
99
 
99
- n.replace(n.text.gsub(/ /, "").gsub(/:/, ":").gsub(/,/, "、")
100
- .gsub(/\(/, "").gsub(/\)/, "").gsub(/\[/, "【").gsub(/\]/, ""))
100
+ n.replace(cleanup_entities(n.text.gsub(/ /, "").gsub(/:/, ":")
101
+ .gsub(/,/, "").gsub(/\(/, "").gsub(/\)/, "")
102
+ .gsub(/\[/, "【").gsub(/\]/, "】"), is_xml: false))
101
103
  end
102
104
  xml.to_xml.gsub(/<b>/, "").gsub("</b>", "").gsub(/<\?[^>]+>/, "")
103
105
  end
@@ -111,6 +113,7 @@ module IsoDoc
111
113
  l10n(names[0..-2].join(", ") + " #{andword} #{names[-1]}", @lang, @script)
112
114
  end
113
115
 
116
+ include Function::Utils
114
117
  # module_function :l10n
115
118
  end
116
119
  end
@@ -20,7 +20,7 @@ module IsoDoc
20
20
  end
21
21
 
22
22
  def tmpimagedir_suffix
23
- "_pdfimages"
23
+ "_#{SecureRandom.hex(8)}_pdfimages"
24
24
  end
25
25
 
26
26
  def convert(input_filename, file = nil, debug = false, output_filename = nil)
@@ -19,6 +19,22 @@ module IsoDoc
19
19
  prefix_name(elem, "<tab/>", "#{lbl}#{clausedelim}", "title")
20
20
  end
21
21
 
22
+ def floattitle(docxml)
23
+ docxml.xpath(ns("//clause | //annex | //appendix | //introduction | "\
24
+ "//foreword | //preface/abstract | //acknowledgements | "\
25
+ "//terms | //definitions | //references"))
26
+ .each do |f|
27
+ floattitle1(f)
28
+ end
29
+ end
30
+
31
+ def floattitle1(elem)
32
+ level = @xrefs.anchor(elem["id"], :level, false) || "1"
33
+ elem.xpath(ns("./p[@type = 'floating-title']")).each do |p|
34
+ p["depth"] = level.to_i + 1
35
+ end
36
+ end
37
+
22
38
  def annex(docxml)
23
39
  docxml.xpath(ns("//annex")).each do |f|
24
40
  annex1(f)
@@ -6,35 +6,40 @@ module IsoDoc
6
6
 
7
7
  def concept1(node)
8
8
  xref = node&.at(ns("./xref/@target"))&.text or
9
- return concept_render(node, ital: node["ital"] || "true",
10
- ref: node["ref"] || "true",
11
- linkref: node["linkref"] || "true",
12
- linkmention: node["linkmention"] || "false")
9
+ return concept_render(node, ital: "true", ref: "true",
10
+ linkref: "true", linkmention: "false")
13
11
  if node.at(ns("//definitions//dt[@id = '#{xref}']"))
14
- concept_render(node, ital: node["ital"] || "false",
15
- ref: node["ref"] || "false",
16
- linkref: node["linkref"] || "true",
17
- linkmention: node["linkmention"] || "false")
18
- else concept_render(node, ital: node["ital"] || "true",
19
- ref: node["ref"] || "true",
20
- linkref: node["linkref"] || "true",
21
- linkmention: node["linkmention"] || "false")
12
+ concept_render(node, ital: "false", ref: "false",
13
+ linkref: "true", linkmention: "false")
14
+ else concept_render(node, ital: "true", ref: "true",
15
+ linkref: "true", linkmention: "false")
22
16
  end
23
17
  end
24
18
 
25
- def concept_render(node, opts)
19
+ def concept_render(node, defaults)
20
+ opts, render, ref = concept_render_init(node, defaults)
26
21
  node&.at(ns("./refterm"))&.remove
27
- r = node.at(ns("./renderterm"))
28
- ref = node.at(ns("./xref | ./eref | ./termref"))
29
- ref && opts[:ref] != "false" and r&.next = " "
30
- opts[:ital] == "true" and r&.name = "em"
31
- concept1_linkmention(ref, r, opts)
22
+ ref && opts[:ref] != "false" and render&.next = " "
23
+ opts[:ital] == "true" and render&.name = "em"
24
+ concept1_linkmention(ref, render, opts)
32
25
  concept1_ref(node, ref, opts)
26
+ concept1_nonital(node, opts)
27
+ node.replace(node.children)
28
+ end
29
+
30
+ def concept1_nonital(node, opts)
33
31
  if opts[:ital] == "false"
34
32
  r = node.at(ns(".//renderterm"))
35
33
  r&.replace(r&.children)
36
34
  end
37
- node.replace(node.children)
35
+ end
36
+
37
+ def concept_render_init(node, defaults)
38
+ opts = %i(ital ref linkref linkmention).each_with_object({}) do |x, m|
39
+ m[x] = node[x.to_s] || defaults[x]
40
+ end
41
+ [opts, node.at(ns("./renderterm")),
42
+ node.at(ns("./xref | ./eref | ./termref"))]
38
43
  end
39
44
 
40
45
  def concept1_linkmention(ref, renderterm, opts)
@@ -237,7 +242,7 @@ module IsoDoc
237
242
  end
238
243
 
239
244
  def termsource_modification(mod)
240
- mod.previous_element.next = ", #{@i18n.modified}"
245
+ mod.previous_element.next = l10n(", #{@i18n.modified}")
241
246
  mod.text.strip.empty? or mod.previous = " &#x2013; "
242
247
  mod.elements.size == 1 and
243
248
  mod.elements[0].replace(mod.elements[0].children)
@@ -37,6 +37,7 @@ module IsoDoc
37
37
  references docxml
38
38
  index docxml
39
39
  clausetitle docxml
40
+ floattitle docxml
40
41
  toc docxml
41
42
  display_order docxml
42
43
  end
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "1.8.3.3".freeze
2
+ VERSION = "1.8.4".freeze
3
3
  end
@@ -33,7 +33,7 @@ module IsoDoc
33
33
  end
34
34
 
35
35
  def tmpimagedir_suffix
36
- "_pdfimages"
36
+ "_#{SecureRandom.hex(8)}_pdfimages"
37
37
  end
38
38
 
39
39
  def pdf_stylesheet(_docxml)
@@ -726,9 +726,9 @@ RSpec.describe IsoDoc do
726
726
  OUTPUT
727
727
  end
728
728
 
729
- it "moves images in HTML" do
729
+ it "moves images in HTML #1" do
730
730
  FileUtils.rm_f "test.html"
731
- FileUtils.rm_rf "test_htmlimages"
731
+ FileUtils.rm_rf Dir.glob "test_*_htmlimages"
732
732
  IsoDoc::HtmlConvert.new(
733
733
  { wordstylesheet: "spec/assets/word.css",
734
734
  htmlstylesheet: "spec/assets/html.scss" },
@@ -750,8 +750,9 @@ RSpec.describe IsoDoc do
750
750
  html = File.read("test.html")
751
751
  .sub(/^.*<main class="main-section">/m, '<main class="main-section">')
752
752
  .sub(%r{</main>.*$}m, "</main>")
753
- expect(`ls test_htmlimages`).to match(/\.png$/)
754
- expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")))
753
+ expect(`ls test_*_htmlimages`).to match(/\.png$/)
754
+ expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))
755
+ .gsub(/test_[^_]+_htmlimages/, "test_htmlimages"))
755
756
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
756
757
  <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
757
758
  <br />
@@ -771,7 +772,7 @@ RSpec.describe IsoDoc do
771
772
  OUTPUT
772
773
  end
773
774
 
774
- it "moves images in HTML" do
775
+ it "moves images in HTML #2" do
775
776
  FileUtils.rm_f "test.html"
776
777
  FileUtils.rm_rf "test_htmlimages"
777
778
  IsoDoc::HtmlConvert.new(
@@ -791,8 +792,9 @@ RSpec.describe IsoDoc do
791
792
  html = File.read("test.html")
792
793
  .sub(/^.*<main class="main-section">/m, '<main class="main-section">')
793
794
  .sub(%r{</main>.*$}m, "</main>")
794
- expect(`ls test_htmlimages`).to match(/\.png$/)
795
- expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")))
795
+ expect(`ls test_*_htmlimages`).to match(/\.png$/)
796
+ expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))
797
+ .gsub(/test_[^_]+_htmlimages/, "test_htmlimages"))
796
798
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
797
799
  <main class='main-section'>
798
800
  <button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
@@ -813,7 +815,6 @@ RSpec.describe IsoDoc do
813
815
  context "when `mathvariant` attr equal to `script`" do
814
816
  it "converts mathvariant text chars into associated plain chars" do
815
817
  FileUtils.rm_f "test.html"
816
- FileUtils.rm_rf "test_htmlimages"
817
818
  input = <<~INPUT
818
819
  <?xml version="1.0" encoding="UTF-8"?>
819
820
  <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="1.5.14">
@@ -865,7 +866,6 @@ RSpec.describe IsoDoc do
865
866
  context "when complex `mathvariant` combinations" do
866
867
  it "converts mathvariant text chars into associated plain chars" do
867
868
  FileUtils.rm_f "test.html"
868
- FileUtils.rm_rf "test_htmlimages"
869
869
  input = <<~INPUT
870
870
  <?xml version="1.0" encoding="UTF-8"?>
871
871
  <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="1.5.14">
@@ -975,7 +975,7 @@ RSpec.describe IsoDoc do
975
975
 
976
976
  it "moves images in HTML with no file suffix" do
977
977
  FileUtils.rm_f "test.html"
978
- FileUtils.rm_rf "test_htmlimages"
978
+ FileUtils.rm_rf Dir.glob "test_*_htmlimages"
979
979
  IsoDoc::HtmlConvert.new(
980
980
  { wordstylesheet: "spec/assets/word.css",
981
981
  htmlstylesheet: "spec/assets/html.scss" },
@@ -994,8 +994,9 @@ RSpec.describe IsoDoc do
994
994
  html = File.read("test.html")
995
995
  .sub(/^.*<main class="main-section">/m, '<main class="main-section">')
996
996
  .sub(%r{</main>.*$}m, "</main>")
997
- expect(`ls test_htmlimages`).to match(/\.png$/)
998
- expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")))
997
+ expect(`ls test_*_htmlimages`).to match(/\.png$/)
998
+ expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))
999
+ .gsub(/test_[^_]+_htmlimages/, "test_htmlimages"))
999
1000
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
1000
1001
  <main class='main-section'>
1001
1002
  <button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
@@ -1036,8 +1037,9 @@ RSpec.describe IsoDoc do
1036
1037
  html = File.read("spec/test.html")
1037
1038
  .sub(/^.*<main class="main-section">/m, '<main class="main-section">')
1038
1039
  .sub(%r{</main>.*$}m, "</main>")
1039
- expect(`ls test_htmlimages`).to match(/\.png$/)
1040
- expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")))
1040
+ expect(`ls test_*_htmlimages`).to match(/\.png$/)
1041
+ expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))
1042
+ .gsub(/test_[^_]+_htmlimages/, "test_htmlimages"))
1041
1043
  .to be_equivalent_to xmlpp(<<~"OUTPUT")
1042
1044
  <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
1043
1045
  <br />
@@ -1057,7 +1059,7 @@ RSpec.describe IsoDoc do
1057
1059
 
1058
1060
  it "encodes images in HTML as data URIs" do
1059
1061
  FileUtils.rm_f "test.html"
1060
- FileUtils.rm_rf "test_htmlimages"
1062
+ FileUtils.rm_rf Dir.glob "test_*_htmlimages"
1061
1063
  IsoDoc::HtmlConvert
1062
1064
  .new(htmlstylesheet: "spec/assets/html.scss", datauriimage: true)
1063
1065
  .convert("test", <<~"INPUT", false)
@@ -1093,7 +1095,7 @@ RSpec.describe IsoDoc do
1093
1095
 
1094
1096
  it "encodes images in HTML as data URIs, using relative file location" do
1095
1097
  FileUtils.rm_f "spec/test.html"
1096
- FileUtils.rm_rf "spec/test_htmlimages"
1098
+ FileUtils.rm_rf Dir.glob "test_*_htmlimages"
1097
1099
  IsoDoc::HtmlConvert
1098
1100
  .new({ htmlstylesheet: "assets/html.scss", datauriimage: true })
1099
1101
  .convert("spec/test", <<~"INPUT", false)