spec/isodoc/xref_spec.rb in isodoc-1.0.6 vs spec/isodoc/xref_spec.rb in isodoc-1.0.7

- old
+ new

@@ -1,10 +1,10 @@ require "spec_helper" RSpec.describe IsoDoc do it "cross-references external documents in HTML" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <p> <xref target="a#b"/> @@ -27,11 +27,11 @@ </html> OUTPUT end it "cross-references external documents in DOC" do - expect(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').sub(%r{</div>.*$}m, "</div>")).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').sub(%r{</div>.*$}m, "</div></div>"))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <p> <xref target="a#b"/> @@ -45,11 +45,11 @@ <div> <h1 class="ForewordTitle">Foreword</h1> <p> <a href="a.doc#b">a#b</a> </p> - </div> + </div></div> OUTPUT end it "warns of missing crossreference" do expect { IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true) }.to output(/No label has been processed for ID N1/).to_stderr @@ -63,11 +63,11 @@ INPUT end it "cross-references notes" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <p> <xref target="N1"/> @@ -191,19 +191,20 @@ </html> OUTPUT end it "cross-references figures" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword id="fwd"> <p> <xref target="N1"/> <xref target="N2"/> <xref target="N"/> <xref target="note1"/> + <xref target="note3"/> <xref target="note2"/> <xref target="AN"/> <xref target="Anote1"/> <xref target="Anote2"/> </p> @@ -234,10 +235,13 @@ <clause id="widgets1"> <figure id="note1"> <name>Split-it-right sample divider</name> <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/> </figure> + <figure id="note3" class="pseudocode"> + <p>pseudocode</p> + </figure> <figure id="note2"> <name>Split-it-right sample divider</name> <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/> </figure> <p> <xref target="note1"/> <xref target="note2"/> </p> @@ -271,10 +275,11 @@ <p> <a href="#N1">Figure 1</a> <a href="#N2">Figure (??)</a> <a href="#N">Figure 2</a> <a href="#note1">Figure 3</a> + <a href="#note3">[note3]</a> <a href="#note2">Figure 4</a> <a href="#AN">Figure A.1</a> <a href="#Anote1">Figure (??)</a> <a href="#Anote2">Figure A.2</a> </p> @@ -311,10 +316,13 @@ <div id="widgets1"><h2>3.1.&#160;</h2> <div id="note1" class="figure"> <img src="rice_images/rice_image1.png" height="auto" width="auto"/> <p class="FigureTitle" style="text-align:center;">Figure 3&#160;&#8212; Split-it-right sample divider</p></div> + <div id="note3" class="pseudocode"> +<p>pseudocode</p> +</div> <div id="note2" class="figure"> <img src="rice_images/rice_image1.png" height="auto" width="auto"/> <p class="FigureTitle" style="text-align:center;">Figure 4&#160;&#8212; Split-it-right sample divider</p></div> <p> <a href="#note1">Figure 3</a> <a href="#note2">Figure 4</a> </p> @@ -344,11 +352,11 @@ </html> OUTPUT end it "cross-references subfigures" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword id="fwd"> <p> <xref target="N"/> @@ -455,11 +463,11 @@ </html> OUTPUT end it "cross-references examples" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <p> <xref target="N1"/> @@ -592,11 +600,11 @@ </html> OUTPUT end it "cross-references formulae" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <p> <xref target="N1"/> @@ -713,11 +721,11 @@ </html> OUTPUT end it "cross-references requirements" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <p> <xref target="N1"/> @@ -850,11 +858,11 @@ </html> OUTPUT end it "cross-references recommendations" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <p> <xref target="N1"/> @@ -987,11 +995,11 @@ </html> OUTPUT end it "cross-references permissions" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <p> <xref target="N1"/> @@ -1124,11 +1132,11 @@ </html> OUTPUT end it "labels and cross-references nested requirements" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <p> <xref target="N1"/> @@ -1223,11 +1231,11 @@ OUTPUT end it "cross-references tables" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <p> <xref target="N1"/> @@ -1420,11 +1428,11 @@ </html> OUTPUT end it "cross-references term notes" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <p> <xref target="note1"/> @@ -1476,11 +1484,11 @@ </html> OUTPUT end it "cross-references sections" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword obligation="informative"> <title>Foreword</title> <p id="A">This is a preamble @@ -1645,11 +1653,11 @@ </html> OUTPUT end it "cross-references lists" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <p> <xref target="N1"/> @@ -1776,11 +1784,11 @@ </html> OUTPUT end it "cross-references list items" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <p> <xref target="N1"/> @@ -1907,11 +1915,11 @@ </html> OUTPUT end it "cross-references nested list items" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <p> <xref target="N"/> @@ -1987,10 +1995,10 @@ </html> OUTPUT end it "realises subsequences" do - expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT" + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword id="fwd"> <p> <xref target="N1"/>