spec/isodoc/postproc_spec.rb in isodoc-1.8.3.3 vs spec/isodoc/postproc_spec.rb in isodoc-1.8.4

- old
+ new

@@ -724,13 +724,13 @@ <a href="#fnref:2">&#x21A9;</a></aside> </main> OUTPUT end - it "moves images in HTML" do + it "moves images in HTML #1" do FileUtils.rm_f "test.html" - FileUtils.rm_rf "test_htmlimages" + FileUtils.rm_rf Dir.glob "test_*_htmlimages" IsoDoc::HtmlConvert.new( { wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss" }, ).convert("test", <<~"INPUT", false) <iso-standard xmlns="http://riboseinc.com/isoxml"> @@ -748,12 +748,13 @@ </iso-standard> INPUT html = File.read("test.html") .sub(/^.*<main class="main-section">/m, '<main class="main-section">') .sub(%r{</main>.*$}m, "</main>") - expect(`ls test_htmlimages`).to match(/\.png$/) - expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))) + expect(`ls test_*_htmlimages`).to match(/\.png$/) + expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")) + .gsub(/test_[^_]+_htmlimages/, "test_htmlimages")) .to be_equivalent_to xmlpp(<<~"OUTPUT") <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button> <br /> <div> <h1 class="ForewordTitle">Foreword</h1> @@ -769,11 +770,11 @@ <p class="zzSTDTitle1"></p> </main> OUTPUT end - it "moves images in HTML" do + it "moves images in HTML #2" do FileUtils.rm_f "test.html" FileUtils.rm_rf "test_htmlimages" IsoDoc::HtmlConvert.new( { baseassetpath: "spec/assets", wordstylesheet: "word.css", @@ -789,12 +790,13 @@ </iso-standard> INPUT html = File.read("test.html") .sub(/^.*<main class="main-section">/m, '<main class="main-section">') .sub(%r{</main>.*$}m, "</main>") - expect(`ls test_htmlimages`).to match(/\.png$/) - expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))) + expect(`ls test_*_htmlimages`).to match(/\.png$/) + expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")) + .gsub(/test_[^_]+_htmlimages/, "test_htmlimages")) .to be_equivalent_to xmlpp(<<~"OUTPUT") <main class='main-section'> <button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button> <br/> <div> @@ -811,11 +813,10 @@ describe "mathvariant to plain" do context "when `mathvariant` attr equal to `script`" do it "converts mathvariant text chars into associated plain chars" do FileUtils.rm_f "test.html" - FileUtils.rm_rf "test_htmlimages" input = <<~INPUT <?xml version="1.0" encoding="UTF-8"?> <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="1.5.14"> <sections> <clause id="_clause" inline-header="false" obligation="normative"> @@ -863,11 +864,10 @@ end context "when complex `mathvariant` combinations" do it "converts mathvariant text chars into associated plain chars" do FileUtils.rm_f "test.html" - FileUtils.rm_rf "test_htmlimages" input = <<~INPUT <?xml version="1.0" encoding="UTF-8"?> <iso-standard xmlns="https://www.metanorma.org/ns/iso" type="semantic" version="1.5.14"> <sections> <clause id="_clause" inline-header="false" obligation="normative"> @@ -973,11 +973,11 @@ end end it "moves images in HTML with no file suffix" do FileUtils.rm_f "test.html" - FileUtils.rm_rf "test_htmlimages" + FileUtils.rm_rf Dir.glob "test_*_htmlimages" IsoDoc::HtmlConvert.new( { wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss" }, ).convert("test", <<~"INPUT", false) <iso-standard xmlns="http://riboseinc.com/isoxml"> @@ -992,12 +992,13 @@ </iso-standard> INPUT html = File.read("test.html") .sub(/^.*<main class="main-section">/m, '<main class="main-section">') .sub(%r{</main>.*$}m, "</main>") - expect(`ls test_htmlimages`).to match(/\.png$/) - expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))) + expect(`ls test_*_htmlimages`).to match(/\.png$/) + expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")) + .gsub(/test_[^_]+_htmlimages/, "test_htmlimages")) .to be_equivalent_to xmlpp(<<~"OUTPUT") <main class='main-section'> <button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button> <br/> <div> @@ -1034,12 +1035,13 @@ </iso-standard> INPUT html = File.read("spec/test.html") .sub(/^.*<main class="main-section">/m, '<main class="main-section">') .sub(%r{</main>.*$}m, "</main>") - expect(`ls test_htmlimages`).to match(/\.png$/) - expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))) + expect(`ls test_*_htmlimages`).to match(/\.png$/) + expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")) + .gsub(/test_[^_]+_htmlimages/, "test_htmlimages")) .to be_equivalent_to xmlpp(<<~"OUTPUT") <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button> <br /> <div> <h1 class="ForewordTitle">Foreword</h1> @@ -1055,11 +1057,11 @@ OUTPUT end it "encodes images in HTML as data URIs" do FileUtils.rm_f "test.html" - FileUtils.rm_rf "test_htmlimages" + FileUtils.rm_rf Dir.glob "test_*_htmlimages" IsoDoc::HtmlConvert .new(htmlstylesheet: "spec/assets/html.scss", datauriimage: true) .convert("test", <<~"INPUT", false) <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> @@ -1091,10 +1093,10 @@ OUTPUT end it "encodes images in HTML as data URIs, using relative file location" do FileUtils.rm_f "spec/test.html" - FileUtils.rm_rf "spec/test_htmlimages" + FileUtils.rm_rf Dir.glob "test_*_htmlimages" IsoDoc::HtmlConvert .new({ htmlstylesheet: "assets/html.scss", datauriimage: true }) .convert("spec/test", <<~"INPUT", false) <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword>