spec/isodoc/postproc_spec.rb in isodoc-0.9.1 vs spec/isodoc/postproc_spec.rb in isodoc-0.9.2
- old
+ new
@@ -499,9 +499,39 @@
</main>
OUTPUT
end
+ it "encodes images in HTML as data URIs" do
+ system "rm -f test.html"
+ system "rm -rf test_images"
+ IsoDoc::HtmlConvert.new({htmlstylesheet: "spec/assets/html.css", datauriimage: true}).convert("test", <<~"INPUT", false)
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
+ <preface><foreword>
+ <figure id="_">
+ <name>Split-it-right sample divider</name>
+ <image src="spec/assets/rice_image1.png" id="_" imagetype="PNG"/>
+ </figure>
+ </foreword></preface>
+ </iso-standard>
+ INPUT
+ html = File.read("test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
+ sub(%r{</main>.*$}m, "</main>")
+ expect(html.gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"})).to be_equivalent_to <<~"OUTPUT"
+ <main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
+ <br />
+ <div>
+ <h1 class="ForewordTitle">Foreword</h1>
+ <div id="_" class="figure">
+ <img src="data:image/png;base64,_" height="auto" width="auto" />
+ <p class="FigureTitle" align="center">Figure 1 — Split-it-right sample divider</p></div>
+ </div>
+ <p class="zzSTDTitle1"></p>
+ </main>
+ OUTPUT
+
+ end
+
it "processes IsoXML terms for HTML" do
system "rm -f test.doc"
system "rm -f test.html"
IsoDoc::HtmlConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
<iso-standard xmlns="http://riboseinc.com/isoxml">