spec/isodoc/blocks_spec.rb in isodoc-1.1.4 vs spec/isodoc/blocks_spec.rb in isodoc-1.2.0

- old
+ new

@@ -1,18 +1,51 @@ require "spec_helper" RSpec.describe IsoDoc do - it "processes unlabelled notes" do - expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + it "processes unlabelled notes (Presentation XML)" do + expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> <note id="A" keep-with-next="true" keep-lines-together="true"> <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p> </note> </foreword></preface> </iso-standard> INPUT + <?xml version='1.0'?> +<iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <note id='A' keep-with-next='true' keep-lines-together='true'> + <name>NOTE</name> + <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'> + These results are based on a study carried out on three different + types of kernel. + </p> + </note> + </foreword> + </preface> +</iso-standard> +OUTPUT + end + + it "processes unlabelled notes (HTML)" do + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + <iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <note id='A' keep-with-next='true' keep-lines-together='true'> + <name>NOTE</name> + <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'> + These results are based on a study carried out on three different + types of kernel. + </p> + </note> + </foreword> + </preface> +</iso-standard> + INPUT #{HTML_HDR} <br/> <div> <h1 class="ForewordTitle">Foreword</h1> <div id="A" class="Note" style="page-break-after: avoid;page-break-inside: avoid;"> @@ -26,17 +59,23 @@ OUTPUT end it "processes unlabelled notes (Word)" do expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") - <iso-standard xmlns="http://riboseinc.com/isoxml"> - <preface><foreword> - <note id="A"> - <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p> -</note> - </foreword></preface> - </iso-standard> + <iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <note id='A' keep-with-next='true' keep-lines-together='true'> + <name>NOTE</name> + <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'> + These results are based on a study carried out on three different + types of kernel. + </p> + </note> + </foreword> + </preface> +</iso-standard> INPUT <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en"> <head><style/></head> <body lang="EN-US" link="blue" vlink="#954F72"> <div class="WordSection1"> @@ -45,11 +84,11 @@ <p><br clear="all" class="section"/></p> <div class="WordSection2"> <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p> <div> <h1 class="ForewordTitle">Foreword</h1> - <div id="A" class="Note"> + <div id="A" class="Note" style='page-break-after: avoid;page-break-inside: avoid;'> <p class="Note"><span class="note_label">NOTE</span><span style="mso-tab-count:1">&#160; </span>These results are based on a study carried out on three different types of kernel.</p> </div> </div> <p>&#160;</p> </div> @@ -60,48 +99,69 @@ </body> </html> OUTPUT end - - it "processes labelled notes" do - expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + it "processes sequences of notes (Presentation XML)" do + expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> <note id="note1"> <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p> </note> + <note id="note2"> + <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p> +</note> </foreword></preface> </iso-standard> INPUT - #{HTML_HDR} - <br/> - <div> - <h1 class="ForewordTitle">Foreword</h1> - <div id="note1" class="Note"> - <p><span class="note_label">NOTE</span>&#160; These results are based on a study carried out on three different types of kernel.</p> - </div> - </div> - <p class="zzSTDTitle1"/> - </div> - </body> - </html> - OUTPUT +<?xml version='1.0'?> +<iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <note id='note1'> + <name>NOTE 1</name> + <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'> + These results are based on a study carried out on three different + types of kernel. + </p> + </note> + <note id='note2'> + <name>NOTE 2</name> + <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a'> + These results are based on a study carried out on three different + types of kernel. + </p> + </note> + </foreword> + </preface> +</iso-standard> +OUTPUT end - it "processes sequences of notes" do + it "processes sequences of notes (HTML)" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") - <iso-standard xmlns="http://riboseinc.com/isoxml"> - <preface><foreword> - <note id="note1"> - <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p> -</note> - <note id="note2"> - <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p> -</note> - </foreword></preface> - </iso-standard> + <iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <note id='note1'> + <name>NOTE 1</name> + <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'> + These results are based on a study carried out on three different + types of kernel. + </p> + </note> + <note id='note2'> + <name>NOTE 2</name> + <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a'> + These results are based on a study carried out on three different + types of kernel. + </p> + </note> + </foreword> + </preface> +</iso-standard> INPUT #{HTML_HDR} <br/> <div> <h1 class="ForewordTitle">Foreword</h1> @@ -122,10 +182,11 @@ it "processes multi-para notes" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> <note> + <name>NOTE</name> <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p> <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p> </note> </foreword></preface> </iso-standard> @@ -148,11 +209,11 @@ it "processes non-para notes" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> - <note id="A"> + <note id="A"><name>NOTE</name> <dl> <dt>A</dt> <dd><p>B</p></dd> </dl> <ul> @@ -181,11 +242,11 @@ it "processes non-para notes (Word)" do expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> - <note id="A"> + <note id="A"><name>NOTE</name> <dl> <dt>A</dt> <dd><p>B</p></dd> </dl> <ul> @@ -224,12 +285,12 @@ it "processes paragraphs containing notes" do expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> - <p id="A">ABC <note id="B"><p id="C">XYZ</p></note> -<note id="B1"><p id="C1">XYZ1</p></note></p> + <p id="A">ABC <note id="B"><name>NOTE 1</name><p id="C">XYZ</p></note> +<note id="B1"><name>NOTE 2</name><p id="C1">XYZ1</p></note></p> </foreword></preface> </iso-standard> INPUT #{HTML_HDR} <br/> @@ -260,12 +321,12 @@ it "processes paragraphs containing notes (Word)" do expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> - <p id="A">ABC <note id="B"><p id="C">XYZ</p></note> -<note id="B1"><p id="C1">XYZ1</p></note></p> + <p id="A">ABC <note id="B"><name>NOTE 1</name><p id="C">XYZ</p></note> +<note id="B1"><name>NOTE 2</name><p id="C1">XYZ1</p></note></p> </foreword></preface> </iso-standard> INPUT <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en"> <head> @@ -311,12 +372,12 @@ </body> </html> OUTPUT end - it "processes figures" do - expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") + it "processes figures (Presentation XML)" do + expect(xmlpp((IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> <figure id="figureA-1" keep-with-next="true" keep-lines-together="true"> <name>Split-it-right <em>sample</em> divider<fn reference="1"><p>X</p></fn></name> <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/> @@ -339,10 +400,69 @@ B</pre> </figure> </foreword></preface> </iso-standard> INPUT + <?xml version='1.0'?> + <iso-standard xmlns="http://riboseinc.com/isoxml"> + <preface><foreword> + <figure id="figureA-1" keep-with-next="true" keep-lines-together="true"> + <name>Figure 1&#xA0;&#x2014; Split-it-right <em>sample</em> divider<fn reference="1"><p>X</p></fn></name> + <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/> + <image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f1" mimetype="image/png"/> + <image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="image/png"/> + <fn reference="a"> + <p id="_ef2c85b8-5a5a-4ecd-a1e6-92acefaaa852">The time <stem type="AsciiMath">t_90</stem> was estimated to be 18,2 min for this example.</p> +</fn> + <dl> + <dt>A</dt> + <dd><p>B</p></dd> + </dl> +</figure> +<figure id="figure-B"> +<name>Figure 2</name> +<pre alt="A B">A &lt; +B</pre> +</figure> +<figure id="figure-C" unnumbered="true"> +<pre>A &lt; +B</pre> +</figure> + </foreword></preface> + </iso-standard> +OUTPUT + end + + it "processes figures (HTML)" do + expect(xmlpp(strip_guid(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)))).to be_equivalent_to xmlpp(<<~"OUTPUT") + <iso-standard xmlns="http://riboseinc.com/isoxml"> + <preface><foreword> + <figure id="figureA-1" keep-with-next="true" keep-lines-together="true"> + <name>Figure 1&#xA0;&#x2014; Split-it-right <em>sample</em> divider<fn reference="1"><p>X</p></fn></name> + <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/> + <image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f1" mimetype="image/png"/> + <image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="image/png"/> + <fn reference="a"> + <p id="_ef2c85b8-5a5a-4ecd-a1e6-92acefaaa852">The time <stem type="AsciiMath">t_90</stem> was estimated to be 18,2 min for this example.</p> +</fn> + <dl> + <dt>A</dt> + <dd><p>B</p></dd> + </dl> +</figure> +<figure id="figure-B"> +<name>Figure 2</name> +<pre alt="A B">A &lt; +B</pre> +</figure> +<figure id="figure-C" unnumbered="true"> +<pre>A &lt; +B</pre> +</figure> + </foreword></preface> + </iso-standard> + INPUT #{HTML_HDR} <br/> <div> <h1 class="ForewordTitle">Foreword</h1> <div id="figureA-1" class="figure" style='page-break-after: avoid;page-break-inside: avoid;'> @@ -380,26 +500,31 @@ end it "processes figures (Word)" do FileUtils.rm_rf "spec/assets/odf1.emf" expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/['"][^'".]+\.gif['"]/, "'_.gif'").gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref")))).to be_equivalent_to xmlpp(<<~"OUTPUT") - <iso-standard xmlns="http://riboseinc.com/isoxml"> + <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> - <figure id="figureA-1"> - <name>Split-it-right sample divider<fn reference="1"><p>X</p></fn></name> - <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletext"/> - <image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/> - <image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/> + <figure id="figureA-1" keep-with-next="true" keep-lines-together="true"> + <name>Figure 1&#xA0;&#x2014; Split-it-right <em>sample</em> divider<fn reference="1"><p>X</p></fn></name> + <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/> + <image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f1" mimetype="image/png"/> + <image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="image/png"/> <fn reference="a"> <p id="_ef2c85b8-5a5a-4ecd-a1e6-92acefaaa852">The time <stem type="AsciiMath">t_90</stem> was estimated to be 18,2 min for this example.</p> </fn> <dl> <dt>A</dt> <dd><p>B</p></dd> </dl> </figure> <figure id="figure-B"> +<name>Figure 2</name> +<pre alt="A B">A &lt; +B</pre> +</figure> +<figure id="figure-C" unnumbered="true"> <pre>A &lt; B</pre> </figure> </foreword></preface> </iso-standard> @@ -413,21 +538,20 @@ <p><br clear="all" class="section"/></p> <div class="WordSection2"> <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p> <div> <h1 class="ForewordTitle">Foreword</h1> - <div id="figureA-1" class="figure"> - - <img src="rice_images/rice_image1.png" height="20" width="30" alt="alttext" title="titletext"/> + <div id="figureA-1" class="figure" style='page-break-after: avoid;page-break-inside: avoid;'> + <img src="rice_images/rice_image1.png" height="20" width="30" alt="alttext" title="titletxt"/> <img src="rice_images/rice_image1.png" height='20' width='auto'/> <img src='_.gif' height='20' width='auto'/> <a href="#_" class="TableFootnoteRef">a</a><aside><div id="ftn_"><span><span id="_" class="TableFootnoteRef">a</span><span style="mso-tab-count:1">&#160; </span></span> <p id="_">The time <span class="stem">(#(t_90)#)</span> was estimated to be 18,2 min for this example.</p> </div></aside> <p style='page-break-after:avoid;'><b>Key</b></p><table class="dl"><tr><td valign="top" align="left"><p align="left" style="margin-left:0pt;text-align:left;">A</p></td><td valign="top"><p>B</p></td></tr></table> <p class='FigureTitle' style='text-align:center;'> - Figure 1&#160;&#8212; Split-it-right sample divider + Figure 1&#160;&#8212; Split-it-right <i>sample</i> divider <span style='mso-bookmark:_Ref'> <a href='#ftn1' epub:type='footnote' class='FootnoteRef'> <sup>1</sup> </a> </span> @@ -435,10 +559,13 @@ </div> <div class="figure" id="figure-B"> <pre>A &lt; B</pre> <p class="FigureTitle" style="text-align:center;">Figure 2</p> + </div> + <div id='figure-C' class='figure'> + <pre>A &lt; B</pre> </div> </div> <p>&#160;</p> </div> <p><br clear="all" class="section"/></p> @@ -486,11 +613,10 @@ <h1 class='ForewordTitle'>Foreword</h1> <div id='figureA-1' class='figure'> <img src='spec/assets/odf.emf'/> <img src='spec/assets/odf1.emf'/> <img src='_.emf' height='auto' width='auto'/> - <p class='FigureTitle' style='text-align:center;'>Figure 1</p> </div> </div> <p>&#160;</p> </div> <p> @@ -543,11 +669,10 @@ <h1 class='ForewordTitle'>Foreword</h1> <div id='figureA-1' class='figure'> <img src='spec/assets/odf.emf'/> <img src='spec/assets/odf1.svg'/> <img src='_.svg' height='auto' width='auto'/> - <p class='FigureTitle' style='text-align:center;'>Figure 1</p> </div> </div> <p>&#160;</p> </div> <p> @@ -561,13 +686,12 @@ OUTPUT end end - - it "processes examples" do - expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + it "processes examples (Presentation XML)" do + expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> <example id="samplecode" keep-with-next="true" keep-lines-together="true"> <name>Title</name> <p>Hello</p> @@ -576,23 +700,49 @@ </sourcecode> </example> </foreword></preface> </iso-standard> INPUT + <?xml version='1.0'?> +<iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <example id='samplecode' keep-with-next='true' keep-lines-together='true'> + <name>EXAMPLE&#xA0;&#x2014; Title</name> + <p>Hello</p> + <sourcecode id='X'> + <name>Sample</name> + </sourcecode> + </example> + </foreword> + </preface> +</iso-standard> +OUTPUT + end + + it "processes examples (HTML)" do + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + <iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <example id='samplecode' keep-with-next='true' keep-lines-together='true'> + <name>EXAMPLE&#xA0;&#x2014; Title</name> + <p>Hello</p> + <sourcecode id='X'><name>Sample</name></sourcecode> + </example> + </foreword> + </preface> +</iso-standard> + INPUT #{HTML_HDR} <br/> <div> <h1 class="ForewordTitle">Foreword</h1> <div id="samplecode" class="example" style="page-break-after: avoid;page-break-inside: avoid;"> <p class="example-title">EXAMPLE&#160;&#8212; Title</p> <p>Hello</p> - <pre id='X' class='prettyprint '> - <br/> - &#160; - <br/> - &#160; -</pre> + <pre id='X' class='prettyprint '/> <p class='SourceTitle' style='text-align:center;'>Sample</p> </div> </div> <p class="zzSTDTitle1"/> </div> @@ -601,21 +751,21 @@ OUTPUT end it "processes examples (Word)" do expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") - <iso-standard xmlns="http://riboseinc.com/isoxml"> - <preface><foreword> - <example id="samplecode" keep-with-next="true" keep-lines-together="true"> - <name>Title</name> - <p>Hello</p> - <sourcecode id="X"> - <name>Sample</name> - </sourcecode> -</example> - </foreword></preface> - </iso-standard> + <iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <example id='samplecode' keep-with-next='true' keep-lines-together='true'> + <name>EXAMPLE&#xA0;&#x2014; Title</name> + <p>Hello</p> + <sourcecode id='X'><name>Sample</name></sourcecode> + </example> + </foreword> + </preface> +</iso-standard> INPUT <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'><head><style> </style> </head> <body lang='EN-US' link='blue' vlink='#954F72'> @@ -632,16 +782,11 @@ <div> <h1 class='ForewordTitle'>Foreword</h1> <div id='samplecode' class='example' style='page-break-after: avoid;page-break-inside: avoid;'> <p class='example-title'>EXAMPLE&#160;&#8212; Title</p> <p>Hello</p> - <p id='X' class='Sourcecode'> - <br/> - &#160; - <br/> - &#160; - </p> + <p id='X' class='Sourcecode'/> <p class='SourceTitle' style='text-align:center;'>Sample</p> </div> </div> <p>&#160;</p> </div> @@ -655,11 +800,11 @@ </html> OUTPUT end it "processes sequences of examples" do - expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> <example id="samplecode"> <p>Hello</p> </example> @@ -671,36 +816,34 @@ <p>Hello</p> </example> </foreword></preface> </iso-standard> INPUT - #{HTML_HDR} - <br/> - <div> - <h1 class="ForewordTitle">Foreword</h1> - <div id="samplecode" class="example"> - <p class="example-title">EXAMPLE 1</p> - <p>Hello</p> - </div> - <div id="samplecode2" class="example"> - <p class="example-title">EXAMPLE 2&#160;&#8212; Title</p> - <p>Hello</p> - </div> - <div id="samplecode3" class="example"> - <p class="example-title">EXAMPLE</p> - <p>Hello</p> - </div> - </div> - <p class="zzSTDTitle1"/> - </div> - </body> - </html> + <?xml version='1.0'?> +<iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <example id='samplecode'> + <name>EXAMPLE 1</name> + <p>Hello</p> + </example> + <example id='samplecode2'> + <name>EXAMPLE 2&#xA0;&#x2014; Title</name> + <p>Hello</p> + </example> + <example id='samplecode3' unnumbered='true'> + <name>EXAMPLE</name> + <p>Hello</p> + </example> + </foreword> + </preface> +</iso-standard> OUTPUT end - it "processes sourcecode" do - expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + it "processes sourcecode (Presentation XML)" do + expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> <sourcecode lang="ruby" id="samplecode"> <name>Ruby <em>code</em></name> puts x @@ -709,15 +852,52 @@ Que? </sourcecode> </foreword></preface> </iso-standard> INPUT + <?xml version='1.0'?> +<iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <sourcecode lang='ruby' id='samplecode'> + <name> + Figure 1&#xA0;&#x2014; Ruby + <em>code</em> + </name> + puts x + </sourcecode> + <sourcecode unnumbered='true'> Que? </sourcecode> + </foreword> + </preface> +</iso-standard> +OUTPUT + end + + it "processes sourcecode (HTML)" do + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + <iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <sourcecode lang='ruby' id='samplecode'> + <name> + Figure 1&#xA0;&#x2014; Ruby + <em>code</em> + </name> + puts x +</sourcecode> + <sourcecode unnumbered='true'> +Que? +</sourcecode> + </foreword> + </preface> +</iso-standard> + INPUT #{HTML_HDR} <br/> <div> <h1 class="ForewordTitle">Foreword</h1> - <pre id="samplecode" class="prettyprint lang-rb"><br/>&#160;&#160;&#160; <br/>&#160; puts x<br/></pre> + <pre id="samplecode" class="prettyprint lang-rb"><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160; puts x<br/></pre> <p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; Ruby <i>code</i></p> <pre class='prettyprint '> <br/> Que? <br/> @@ -730,21 +910,26 @@ OUTPUT end it "processes sourcecode (Word)" do expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") - <iso-standard xmlns="http://riboseinc.com/isoxml"> - <preface><foreword> - <sourcecode lang="ruby" id="samplecode"> - <name>Ruby <em>code</em></name> + <iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <sourcecode lang='ruby' id='samplecode'> + <name> + Figure 1&#xA0;&#x2014; Ruby + <em>code</em> + </name> puts x </sourcecode> -<sourcecode unnumbered="true"> + <sourcecode unnumbered='true'> Que? </sourcecode> - </foreword></preface> - </iso-standard> + </foreword> + </preface> +</iso-standard> INPUT <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en"> <head><style/></head> <body lang="EN-US" link="blue" vlink="#954F72"> <div class="WordSection1"> @@ -757,11 +942,11 @@ <p> <br clear="all" style="mso-special-character:line-break;page-break-before:always"/> </p> <div> <h1 class="ForewordTitle">Foreword</h1> - <p id="samplecode" class="Sourcecode"><br/>&#160;&#160;&#160; <br/>&#160; puts x<br/></p><p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; Ruby <i>code</i></p> + <p id="samplecode" class="Sourcecode"><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160; puts x<br/></p><p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; Ruby <i>code</i></p> <p class='Sourcecode'> <br/> Que? <br/> </p> @@ -793,11 +978,11 @@ #{HTML_HDR} <br/> <div> <h1 class="ForewordTitle">Foreword</h1> <pre id="samplecode" class="prettyprint "><br/>&#160;&#160;&#160; <br/>&#160; &lt;xml&gt;<br/></pre> - <p class="SourceTitle" style="text-align:center;">Figure 1&#160;&#8212; XML code</p> + <p class="SourceTitle" style="text-align:center;">XML code</p> </div> <p class="zzSTDTitle1"/> </div> </body> </html> @@ -822,11 +1007,10 @@ #{HTML_HDR} <br/> <div> <h1 class="ForewordTitle">Foreword</h1> <pre id="_" class="prettyprint ">puts "Hello, world." &lt;1&gt;<br/>&#160;&#160; %w{a b c}.each do |x|<br/>&#160;&#160;&#160;&#160; puts x &lt;2&gt;<br/>&#160;&#160; end<br/><br/>&lt;1&gt; This is one callout<br/>&lt;2&gt; This is another callout</pre> - <p class='SourceTitle' style='text-align:center;'>Figure 1</p> </div> <p class="zzSTDTitle1"/> </div> </body> </html> @@ -882,12 +1066,68 @@ </body> </html> OUTPUT end + it "processes formulae (PresentationXML)" do + expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + <iso-standard xmlns="http://riboseinc.com/isoxml"> + <preface><foreword> + <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true" keep-with-next="true" keep-lines-together="true"> + <stem type="AsciiMath">r = 1 %</stem> +<dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d"> + <dt> + <stem type="AsciiMath">r</stem> + </dt> + <dd> + <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p> + </dd> +</dl> + <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0"> + <p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p> +</note> + </formula> + <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935"> + <stem type="AsciiMath">r = 1 %</stem> + </formula> + </foreword></preface> + </iso-standard> + INPUT + <?xml version='1.0'?> +<iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <formula id='_be9158af-7e93-4ee2-90c5-26d31c181934' unnumbered='true' keep-with-next='true' keep-lines-together='true'> + <stem type='AsciiMath'>r = 1 %</stem> + <dl id='_e4fe94fe-1cde-49d9-b1ad-743293b7e21d'> + <dt> + <stem type='AsciiMath'>r</stem> + </dt> + <dd> + <p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the repeatability limit.</p> + </dd> + </dl> + <note id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0'> + <name>NOTE</name> + <p id='_511aaa98-4116-42af-8e5b-c87cdf5bfdc8'> + [durationUnits] is essentially a duration statement without the "P" + prefix. "P" is unnecessary because between "G" and "U" duration is + always expressed. + </p> + </note> + </formula> + <formula id='_be9158af-7e93-4ee2-90c5-26d31c181935'> + <name>1</name> + <stem type='AsciiMath'>r = 1 %</stem> + </formula> + </foreword> + </preface> +</iso-standard> +OUTPUT +end - it "processes formulae" do + it "processes formulae (HTML)" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true" keep-with-next="true" keep-lines-together="true"> <stem type="AsciiMath">r = 1 %</stem> @@ -898,14 +1138,15 @@ <dd> <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p> </dd> </dl> <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0"> + <name>NOTE</name> <p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p> </note> </formula> - <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935"> + <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935"><name>1</name> <stem type="AsciiMath">r = 1 %</stem> </formula> </foreword></preface> </iso-standard> INPUT @@ -944,14 +1185,15 @@ <dd> <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p> </dd> </dl> <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0"> + <name>NOTE</name> <p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p> </note> </formula> - <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935"> + <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935"><name>1</name> <stem type="AsciiMath">r = 1 %</stem> </formula> </foreword></preface> </iso-standard> INPUT @@ -1088,18 +1330,56 @@ </body> </html> OUTPUT end +it "processes blockquotes (Presentation XML)" do + expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + <iso-standard xmlns="http://riboseinc.com/isoxml"> + <preface><foreword> + <quote id="_044bd364-c832-4b78-8fea-92242402a1d1"> + <source type="inline" bibitemid="ISO7301" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>1</referenceFrom></locality></source> + <author>ISO</author> + <p id="_d4fd0a61-f300-4285-abe6-602707590e53">This International Standard gives the minimum specifications for rice (<em>Oryza sativa</em> L.) which is subject to international trade. It is applicable to the following types: husked rice and milled rice, parboiled or not, intended for direct human consumption. It is neither applicable to other products derived from rice, nor to waxy rice (glutinous rice).</p> +</quote> + </foreword></preface> + </iso-standard> + INPUT + <?xml version='1.0'?> + <iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <quote id='_044bd364-c832-4b78-8fea-92242402a1d1'> + <source type='inline' bibitemid='ISO7301' citeas='ISO 7301:2011'> + <locality type='clause'> + <referenceFrom>1</referenceFrom> + </locality>ISO 7301:2011, Clause 1 + </source> + <author>ISO</author> + <p id='_d4fd0a61-f300-4285-abe6-602707590e53'> + This International Standard gives the minimum specifications for rice + ( + <em>Oryza sativa</em> + L.) which is subject to international trade. It is applicable to the + following types: husked rice and milled rice, parboiled or not, + intended for direct human consumption. It is neither applicable to + other products derived from rice, nor to waxy rice (glutinous rice). + </p> + </quote> + </foreword> + </preface> + </iso-standard> + OUTPUT + end - it "processes blockquotes" do + it "processes blockquotes (HTML)" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> <quote id="_044bd364-c832-4b78-8fea-92242402a1d1"> - <source type="inline" bibitemid="ISO7301" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>1</referenceFrom></locality></source> + <source type="inline" bibitemid="ISO7301" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 7301:2011, Clause 1</source> <author>ISO</author> <p id="_d4fd0a61-f300-4285-abe6-602707590e53">This International Standard gives the minimum specifications for rice (<em>Oryza sativa</em> L.) which is subject to international trade. It is applicable to the following types: husked rice and milled rice, parboiled or not, intended for direct human consumption. It is neither applicable to other products derived from rice, nor to waxy rice (glutinous rice).</p> </quote> </foreword></preface> @@ -1125,33 +1405,33 @@ it "processes term domains" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <sections> <terms> - <term id="_extraneous_matter"><preferred>extraneous matter</preferred><admitted>EM</admitted> + <term id="_extraneous_matter"><name>1.1.</name><preferred>extraneous matter</preferred><admitted>EM</admitted> <domain>rice</domain> <definition><p id="_318b3939-be09-46c4-a284-93f9826b981e">organic and inorganic components other than whole or broken kernels</p></definition> </term> </terms> </sections> </iso-standard> INPUT #{HTML_HDR} <p class="zzSTDTitle1"/> - <div><h1>1.&#160; </h1> + <div><h1/> <p class="TermNum" id="_extraneous_matter">1.1.</p><p class="Terms" style="text-align:left;">extraneous matter</p><p class="AltTerms" style="text-align:left;">EM</p> <p id="_318b3939-be09-46c4-a284-93f9826b981e">&lt;rice&gt; organic and inorganic components other than whole or broken kernels</p> </div> </div> </body> </html> OUTPUT end - it "processes permissions" do - expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + it "processes permissions (Presentation XML)" do + expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> <permission id="_" keep-with-next="true" keep-lines-together="true"> <label>/ogc/recommendation/wfs/2</label> <inherit>/ss/584/2015/level/1</inherit> @@ -1199,12 +1479,272 @@ </permission> </foreword></preface> <bibliography><references id="_bibliography" obligation="informative" normative="false"> <title>Bibliography</title> <bibitem id="rfc2616" type="standard"> <fetched>2020-03-27</fetched> <title format="text/plain" language="en" script="Latn">Hypertext Transfer Protocol — HTTP/1.1</title> <uri type="xml">https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2616.xml</uri> <uri type="src">https://www.rfc-editor.org/info/rfc2616</uri> <docidentifier type="IETF">RFC 2616</docidentifier> <docidentifier type="rfc-anchor">RFC2616</docidentifier> <docidentifier type="DOI">10.17487/RFC2616</docidentifier> <date type="published"> <on>1999-06</on> </date> <contributor> <role type="author"/> <person> <name> <completename language="en">R. Fielding</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Gettys</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Mogul</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">H. Frystyk</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">L. Masinter</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">P. Leach</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">T. Berners-Lee</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <language>en</language> <script>Latn</script> <abstract format="text/plain" language="en" script="Latn">HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as “HTTP/1.1”, and is an update to RFC 2068. [STANDARDS-TRACK]</abstract> <series type="main"> <title format="text/plain" language="en" script="Latn">RFC</title> <number>2616</number> </series> <place>Fremont, CA</place></bibitem> +</references></bibliography> + </iso-standard> + INPUT + <?xml version='1.0'?> + <iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <permission id='_' keep-with-next='true' keep-lines-together='true'> + <name>Permission 1</name> + <label>/ogc/recommendation/wfs/2</label> + <inherit>/ss/584/2015/level/1</inherit> + <inherit> + <eref type='inline' bibitemid='rfc2616' citeas='RFC 2616'>RFC 2616 (HTTP/1.1)</eref> + </inherit> + <subject>user</subject> + <classification> + <tag>control-class</tag> + <value>Technical</value> + </classification> + <classification> + <tag>priority</tag> + <value>P0</value> + </classification> + <classification> + <tag>family</tag> + <value>System and Communications Protection</value> + </classification> + <classification> + <tag>family</tag> + <value>System and Communications Protocols</value> + </classification> + <description> + <p id='_'> + I recommend + <em>this</em> + . + </p> + </description> + <specification exclude='true' type='tabular'> + <p id='_'>This is the object of the recommendation:</p> + <table id='_'> + <tbody> + <tr> + <td style='text-align:left;'>Object</td> + <td style='text-align:left;'>Value</td> + </tr> + <tr> + <td style='text-align:left;'>Mission</td> + <td style='text-align:left;'>Accomplished</td> + </tr> + </tbody> + </table> + </specification> + <description> + <p id='_'>As for the measurement targets,</p> + </description> + <measurement-target exclude='false'> + <p id='_'>The measurement target shall be measured as:</p> + <formula id='_'> + <name>1</name> + <stem type='AsciiMath'>r/1 = 0</stem> + </formula> + </measurement-target> + <verification exclude='false'> + <p id='_'>The following code will be run for verification:</p> + <sourcecode id='_'> + CoreRoot(success): HttpResponse if (success) recommendation(label: + success-response) end + </sourcecode> + </verification> + <import exclude='true'> + <sourcecode id='_'>success-response()</sourcecode> + </import> + </permission> + </foreword> + </preface> + <bibliography> + <references id='_bibliography' obligation='informative' normative='false'> + <title depth="1">Bibliography</title> + <bibitem id='rfc2616' type='standard'> + <fetched>2020-03-27</fetched> + <title format='text/plain' language='en' script='Latn'>Hypertext Transfer Protocol&#x2009;&#x2014;&#x2009;HTTP/1.1</title> + <uri type='xml'>https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2616.xml</uri> + <uri type='src'>https://www.rfc-editor.org/info/rfc2616</uri> + <docidentifier type='IETF'>RFC 2616</docidentifier> + <docidentifier type='rfc-anchor'>RFC2616</docidentifier> + <docidentifier type='DOI'>10.17487/RFC2616</docidentifier> + <date type='published'> + <on>1999-06</on> + </date> + <contributor> + <role type='author'/> + <person> + <name> + <completename language='en'>R. Fielding</completename> + </name> + <affiliation> + <organization> + <name>IETF</name> + <abbreviation>IETF</abbreviation> + </organization> + </affiliation> + </person> + </contributor> + <contributor> + <role type='author'/> + <person> + <name> + <completename language='en'>J. Gettys</completename> + </name> + <affiliation> + <organization> + <name>IETF</name> + <abbreviation>IETF</abbreviation> + </organization> + </affiliation> + </person> + </contributor> + <contributor> + <role type='author'/> + <person> + <name> + <completename language='en'>J. Mogul</completename> + </name> + <affiliation> + <organization> + <name>IETF</name> + <abbreviation>IETF</abbreviation> + </organization> + </affiliation> + </person> + </contributor> + <contributor> + <role type='author'/> + <person> + <name> + <completename language='en'>H. Frystyk</completename> + </name> + <affiliation> + <organization> + <name>IETF</name> + <abbreviation>IETF</abbreviation> + </organization> + </affiliation> + </person> + </contributor> + <contributor> + <role type='author'/> + <person> + <name> + <completename language='en'>L. Masinter</completename> + </name> + <affiliation> + <organization> + <name>IETF</name> + <abbreviation>IETF</abbreviation> + </organization> + </affiliation> + </person> + </contributor> + <contributor> + <role type='author'/> + <person> + <name> + <completename language='en'>P. Leach</completename> + </name> + <affiliation> + <organization> + <name>IETF</name> + <abbreviation>IETF</abbreviation> + </organization> + </affiliation> + </person> + </contributor> + <contributor> + <role type='author'/> + <person> + <name> + <completename language='en'>T. Berners-Lee</completename> + </name> + <affiliation> + <organization> + <name>IETF</name> + <abbreviation>IETF</abbreviation> + </organization> + </affiliation> + </person> + </contributor> + <language>en</language> + <script>Latn</script> + <abstract format='text/plain' language='en' script='Latn'> + HTTP has been in use by the World-Wide Web global information + initiative since 1990. This specification defines the protocol + referred to as &#x201C;HTTP/1.1&#x201D;, and is an update to RFC 2068. + [STANDARDS-TRACK] + </abstract> + <series type='main'> + <title format='text/plain' language='en' script='Latn'>RFC</title> + <number>2616</number> + </series> + <place>Fremont, CA</place> + </bibitem> + </references> + </bibliography> + </iso-standard> +OUTPUT + end - + it "processes permissions (HTML)" do + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + <iso-standard xmlns="http://riboseinc.com/isoxml"> + <preface><foreword> + <permission id="_" keep-with-next="true" keep-lines-together="true"> + <name>Permission 1</name> + <label>/ogc/recommendation/wfs/2</label> + <inherit>/ss/584/2015/level/1</inherit> + <inherit><eref type="inline" bibitemid="rfc2616" citeas="RFC 2616">RFC 2616 (HTTP/1.1)</eref></inherit> + <subject>user</subject> + <classification> <tag>control-class</tag> <value>Technical</value> </classification><classification> <tag>priority</tag> <value>P0</value> </classification><classification> <tag>family</tag> <value>System and Communications Protection</value> </classification><classification> <tag>family</tag> <value>System and Communications Protocols</value> </classification> + <description> + <p id="_">I recommend <em>this</em>.</p> + </description> + <specification exclude="true" type="tabular"> + <p id="_">This is the object of the recommendation:</p> + <table id="_"> + <tbody> + <tr> + <td style="text-align:left;">Object</td> + <td style="text-align:left;">Value</td> + </tr> + <tr> + <td style="text-align:left;">Mission</td> + <td style="text-align:left;">Accomplished</td> + </tr> + </tbody> + </table> + </specification> + <description> + <p id="_">As for the measurement targets,</p> + </description> + <measurement-target exclude="false"> + <p id="_">The measurement target shall be measured as:</p> + <formula id="_"> + <stem type="AsciiMath">r/1 = 0</stem> + </formula> + </measurement-target> + <verification exclude="false"> + <p id="_">The following code will be run for verification:</p> + <sourcecode id="_">CoreRoot(success): HttpResponse + if (success) + recommendation(label: success-response) + end + </sourcecode> + </verification> + <import exclude="true"> + <sourcecode id="_">success-response()</sourcecode> + </import> +</permission> + </foreword></preface> + <bibliography><references id="_bibliography" obligation="informative" normative="false"> +<title>Bibliography</title> +<bibitem id="rfc2616" type="standard"> <fetched>2020-03-27</fetched> <title format="text/plain" language="en" script="Latn">Hypertext Transfer Protocol — HTTP/1.1</title> <uri type="xml">https://xml2rfc.tools.ietf.org/public/rfc/bibxml/reference.RFC.2616.xml</uri> <uri type="src">https://www.rfc-editor.org/info/rfc2616</uri> <docidentifier type="IETF">RFC 2616</docidentifier> <docidentifier type="rfc-anchor">RFC2616</docidentifier> <docidentifier type="DOI">10.17487/RFC2616</docidentifier> <date type="published"> <on>1999-06</on> </date> <contributor> <role type="author"/> <person> <name> <completename language="en">R. Fielding</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Gettys</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">J. Mogul</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">H. Frystyk</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">L. Masinter</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">P. Leach</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <contributor> <role type="author"/> <person> <name> <completename language="en">T. Berners-Lee</completename> </name> <affiliation> <organization> <name>IETF</name> <abbreviation>IETF</abbreviation> </organization> </affiliation> </person> </contributor> <language>en</language> <script>Latn</script> <abstract format="text/plain" language="en" script="Latn">HTTP has been in use by the World-Wide Web global information initiative since 1990. This specification defines the protocol referred to as “HTTP/1.1”, and is an update to RFC 2068. [STANDARDS-TRACK]</abstract> <series type="main"> <title format="text/plain" language="en" script="Latn">RFC</title> <number>2616</number> </series> <place>Fremont, CA</place></bibitem> </references></bibliography> </iso-standard> INPUT #{HTML_HDR} <br/> @@ -1225,11 +1765,11 @@ <div class="requirement-description"> <p id="_">As for the measurement targets,</p> </div> <div class="requirement-measurement-target"> <p id="_">The measurement target shall be measured as:</p> - <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span>&#160; (1)</p></div></div> + <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span></p></div></div> </div> <div class="requirement-verification"> <p id="_">The following code will be run for verification:</p> @@ -1251,15 +1791,126 @@ </body> </html> OUTPUT end - it "processes requirements" do + it "processes requirements (Presentation XML)" do + expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + <iso-standard xmlns="http://riboseinc.com/isoxml"> + <preface><foreword> + <requirement id="A" unnumbered="true" keep-with-next="true" keep-lines-together="true"> + <title>A New Requirement</title> + <label>/ogc/recommendation/wfs/2</label> + <inherit>/ss/584/2015/level/1</inherit> + <subject>user</subject> + <description> + <p id="_">I recommend <em>this</em>.</p> + </description> + <specification exclude="true" type="tabular"> + <p id="_">This is the object of the recommendation:</p> + <table id="_"> + <tbody> + <tr> + <td style="text-align:left;">Object</td> + <td style="text-align:left;">Value</td> + </tr> + <tr> + <td style="text-align:left;">Mission</td> + <td style="text-align:left;">Accomplished</td> + </tr> + </tbody> + </table> + </specification> + <description> + <p id="_">As for the measurement targets,</p> + </description> + <measurement-target exclude="false" keep-with-next="true" keep-lines-together="true"> + <p id="_">The measurement target shall be measured as:</p> + <formula id="B"> + <stem type="AsciiMath">r/1 = 0</stem> + </formula> + </measurement-target> + <verification exclude="false"> + <p id="_">The following code will be run for verification:</p> + <sourcecode id="_">CoreRoot(success): HttpResponse + if (success) + recommendation(label: success-response) + end + </sourcecode> + </verification> + <import exclude="true"> + <sourcecode id="_">success-response()</sourcecode> + </import> +</requirement> + </foreword></preface> + </iso-standard> + INPUT + <?xml version='1.0'?> + <iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <requirement id='A' unnumbered='true' keep-with-next='true' keep-lines-together='true'> + <name>Requirement</name> + <title>A New Requirement</title> + <label>/ogc/recommendation/wfs/2</label> + <inherit>/ss/584/2015/level/1</inherit> + <subject>user</subject> + <description> + <p id='_'> + I recommend + <em>this</em> + . + </p> + </description> + <specification exclude='true' type='tabular'> + <p id='_'>This is the object of the recommendation:</p> + <table id='_'> + <tbody> + <tr> + <td style='text-align:left;'>Object</td> + <td style='text-align:left;'>Value</td> + </tr> + <tr> + <td style='text-align:left;'>Mission</td> + <td style='text-align:left;'>Accomplished</td> + </tr> + </tbody> + </table> + </specification> + <description> + <p id='_'>As for the measurement targets,</p> + </description> + <measurement-target exclude='false' keep-with-next='true' keep-lines-together='true'> + <p id='_'>The measurement target shall be measured as:</p> + <formula id='B'> + <name>1</name> + <stem type='AsciiMath'>r/1 = 0</stem> + </formula> + </measurement-target> + <verification exclude='false'> + <p id='_'>The following code will be run for verification:</p> + <sourcecode id='_'> + CoreRoot(success): HttpResponse if (success) recommendation(label: + success-response) end + </sourcecode> + </verification> + <import exclude='true'> + <sourcecode id='_'>success-response()</sourcecode> + </import> + </requirement> + </foreword> + </preface> + </iso-standard> +OUTPUT +end + + it "processes requirements (HTML)" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> <requirement id="A" unnumbered="true" keep-with-next="true" keep-lines-together="true"> + <name>Requirement</name> <title>A New Requirement</title> <label>/ogc/recommendation/wfs/2</label> <inherit>/ss/584/2015/level/1</inherit> <subject>user</subject> <description> @@ -1318,11 +1969,11 @@ <div class="requirement-description"> <p id="_">As for the measurement targets,</p> </div> <div class="requirement-measurement-target" style='page-break-after: avoid;page-break-inside: avoid;'> <p id="_">The measurement target shall be measured as:</p> - <div id="B"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span>&#160; (1)</p></div></div> + <div id="B"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span></p></div></div> </div> <div class="requirement-verification"> <p id="_">The following code will be run for verification:</p> @@ -1336,19 +1987,138 @@ </body> </html> OUTPUT end - it "processes requirements in French" do + it "processes requirements in French (Presentation XML)" do + expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + <iso-standard xmlns="http://riboseinc.com/isoxml"> + <bibdata> + <language>fr</language> + <script>Latn</script> + </bibdata> + <preface><foreword> + <requirement id="A" unnumbered="true"> + <title>A New Requirement</title> + <label>/ogc/recommendation/wfs/2</label> + <inherit>/ss/584/2015/level/1</inherit> + <subject>user</subject> + <description> + <p id="_">I recommend <em>this</em>.</p> + </description> + <specification exclude="true" type="tabular"> + <p id="_">This is the object of the recommendation:</p> + <table id="_"> + <tbody> + <tr> + <td style="text-align:left;">Object</td> + <td style="text-align:left;">Value</td> + </tr> + <tr> + <td style="text-align:left;">Mission</td> + <td style="text-align:left;">Accomplished</td> + </tr> + </tbody> + </table> + </specification> + <description> + <p id="_">As for the measurement targets,</p> + </description> + <measurement-target exclude="false"> + <p id="_">The measurement target shall be measured as:</p> + <formula id="B"> + <stem type="AsciiMath">r/1 = 0</stem> + </formula> + </measurement-target> + <verification exclude="false"> + <p id="_">The following code will be run for verification:</p> + <sourcecode id="_">CoreRoot(success): HttpResponse + if (success) + recommendation(label: success-response) + end + </sourcecode> + </verification> + <import exclude="true"> + <sourcecode id="_">success-response()</sourcecode> + </import> +</requirement> + </foreword></preface> + </iso-standard> + INPUT + <?xml version='1.0'?> + <iso-standard xmlns='http://riboseinc.com/isoxml'> + <bibdata> + <language>fr</language> + <script>Latn</script> + </bibdata> + <preface> + <foreword> + <requirement id='A' unnumbered='true'> + <name>Exigence</name> + <title>A New Requirement</title> + <label>/ogc/recommendation/wfs/2</label> + <inherit>/ss/584/2015/level/1</inherit> + <subject>user</subject> + <description> + <p id='_'> + I recommend + <em>this</em> + . + </p> + </description> + <specification exclude='true' type='tabular'> + <p id='_'>This is the object of the recommendation:</p> + <table id='_'> + <tbody> + <tr> + <td style='text-align:left;'>Object</td> + <td style='text-align:left;'>Value</td> + </tr> + <tr> + <td style='text-align:left;'>Mission</td> + <td style='text-align:left;'>Accomplished</td> + </tr> + </tbody> + </table> + </specification> + <description> + <p id='_'>As for the measurement targets,</p> + </description> + <measurement-target exclude='false'> + <p id='_'>The measurement target shall be measured as:</p> + <formula id='B'> + <name>1</name> + <stem type='AsciiMath'>r/1 = 0</stem> + </formula> + </measurement-target> + <verification exclude='false'> + <p id='_'>The following code will be run for verification:</p> + <sourcecode id='_'> + CoreRoot(success): HttpResponse if (success) recommendation(label: + success-response) end + </sourcecode> + </verification> + <import exclude='true'> + <sourcecode id='_'>success-response()</sourcecode> + </import> + </requirement> + </foreword> + </preface> + </iso-standard> +OUTPUT +end + + it "processes requirements in French (HTML)" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <bibdata> <language>fr</language> <script>Latn</script> </bibdata> <preface><foreword> <requirement id="A" unnumbered="true"> + <name>Exigence</name> <title>A New Requirement</title> <label>/ogc/recommendation/wfs/2</label> <inherit>/ss/584/2015/level/1</inherit> <subject>user</subject> <description> @@ -1423,11 +2193,10 @@ <div class='requirement-measurement-target'> <p id='_'>The measurement target shall be measured as:</p> <div id='B'><div class='formula'> <p> <span class='stem'>(#(r/1 = 0)#)</span> - &#160; (1) </p> </div> </div> </div> <div class='requirement-verification'> @@ -1452,15 +2221,134 @@ </body> </html> OUTPUT end - it "processes recommendation" do + it "processes recommendation (Presentation XML)" do + expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + <iso-standard xmlns="http://riboseinc.com/isoxml"> + <preface><foreword> + <recommendation id="_" obligation="shall,could" keep-with-next="true" keep-lines-together="true"> + <label>/ogc/recommendation/wfs/2</label> + <inherit>/ss/584/2015/level/1</inherit> + <classification><tag>type</tag><value>text</value></classification> + <classification><tag>language</tag><value>BASIC</value></classification> + <subject>user</subject> + <description> + <p id="_">I recommend <em>this</em>.</p> + </description> + <specification exclude="true" type="tabular"> + <p id="_">This is the object of the recommendation:</p> + <table id="_"> + <tbody> + <tr> + <td style="text-align:left;">Object</td> + <td style="text-align:left;">Value</td> + </tr> + <tr> + <td style="text-align:left;">Mission</td> + <td style="text-align:left;">Accomplished</td> + </tr> + </tbody> + </table> + </specification> + <description> + <p id="_">As for the measurement targets,</p> + </description> + <measurement-target exclude="false"> + <p id="_">The measurement target shall be measured as:</p> + <formula id="_"> + <stem type="AsciiMath">r/1 = 0</stem> + </formula> + </measurement-target> + <verification exclude="false"> + <p id="_">The following code will be run for verification:</p> + <sourcecode id="_">CoreRoot(success): HttpResponse + if (success) + recommendation(label: success-response) + end + </sourcecode> + </verification> + <import exclude="true"> + <sourcecode id="_">success-response()</sourcecode> + </import> +</recommendation> + </foreword></preface> + </iso-standard> + INPUT + <?xml version='1.0'?> + <iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <recommendation id='_' obligation='shall,could' keep-with-next='true' keep-lines-together='true'> + <name>Recommendation 1</name> + <label>/ogc/recommendation/wfs/2</label> + <inherit>/ss/584/2015/level/1</inherit> + <classification> + <tag>type</tag> + <value>text</value> + </classification> + <classification> + <tag>language</tag> + <value>BASIC</value> + </classification> + <subject>user</subject> + <description> + <p id='_'> + I recommend + <em>this</em> + . + </p> + </description> + <specification exclude='true' type='tabular'> + <p id='_'>This is the object of the recommendation:</p> + <table id='_'> + <tbody> + <tr> + <td style='text-align:left;'>Object</td> + <td style='text-align:left;'>Value</td> + </tr> + <tr> + <td style='text-align:left;'>Mission</td> + <td style='text-align:left;'>Accomplished</td> + </tr> + </tbody> + </table> + </specification> + <description> + <p id='_'>As for the measurement targets,</p> + </description> + <measurement-target exclude='false'> + <p id='_'>The measurement target shall be measured as:</p> + <formula id='_'> + <name>1</name> + <stem type='AsciiMath'>r/1 = 0</stem> + </formula> + </measurement-target> + <verification exclude='false'> + <p id='_'>The following code will be run for verification:</p> + <sourcecode id='_'> + CoreRoot(success): HttpResponse if (success) recommendation(label: + success-response) end + </sourcecode> + </verification> + <import exclude='true'> + <sourcecode id='_'>success-response()</sourcecode> + </import> + </recommendation> + </foreword> + </preface> + </iso-standard> +OUTPUT +end + + it "processes recommendation (HTML)" do expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface><foreword> <recommendation id="_" obligation="shall,could" keep-with-next="true" keep-lines-together="true"> + <name>Recommendation 1</name> <label>/ogc/recommendation/wfs/2</label> <inherit>/ss/584/2015/level/1</inherit> <classification><tag>type</tag><value>text</value></classification> <classification><tag>language</tag><value>BASIC</value></classification> <subject>user</subject> @@ -1519,11 +2407,11 @@ <div class="requirement-description"> <p id="_">As for the measurement targets,</p> </div> <div class="requirement-measurement-target"> <p id="_">The measurement target shall be measured as:</p> - <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span>&#160; (1)</p></div></div> + <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span></p></div></div> </div> <div class="requirement-verification"> <p id="_">The following code will be run for verification:</p> @@ -1537,22 +2425,75 @@ </body> </html> OUTPUT end - it "processes pseudocode" do - expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") + it "processes pseudocode (Presentation XML)" do + expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") <itu-standard xmlns="http://riboseinc.com/isoxml"> <bibdata> <language>en</language> </bibdata> <preface><foreword> <figure id="_" class="pseudocode" keep-with-next="true" keep-lines-together="true"><name>Label</name><p id="_">  <strong>A</strong><br/>         <smallcap>B</smallcap></p> <p id="_">  <em>C</em></p></figure> </preface></itu-standard> INPUT +<?xml version='1.0'?> +<itu-standard xmlns='http://riboseinc.com/isoxml'> + <bibdata> + <language>en</language> + </bibdata> + <preface> + <foreword> + <figure id='_' class='pseudocode' keep-with-next='true' keep-lines-together='true'> + <name>Figure 1&#xA0;&#x2014; Label</name> + <p id='_'> + &#xA0;&#xA0; + <strong>A</strong> + <br/> + &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0; + <smallcap>B</smallcap> + </p> + <p id='_'> + &#xA0;&#xA0; + <em>C</em> + </p> + </figure> + </foreword> + </preface> +</itu-standard> +OUTPUT +end + + it "processes pseudocode (HTML)" do + expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT") +<itu-standard xmlns='http://riboseinc.com/isoxml'> + <bibdata> + <language>en</language> + </bibdata> + <preface> + <foreword> + <figure id='_' class='pseudocode' keep-with-next='true' keep-lines-together='true'> + <name>Figure 1&#xA0;&#x2014; Label</name> + <p id='_'> + &#xA0;&#xA0; + <strong>A</strong> + <br/> + &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0; + <smallcap>B</smallcap> + </p> + <p id='_'> + &#xA0;&#xA0; + <em>C</em> + </p> + </figure> + </foreword> + </preface> +</itu-standard> +INPUT #{HTML_HDR} <br/> <div> <h1 class="ForewordTitle">Foreword</h1> <div id="_" class="pseudocode" style='page-break-after: avoid;page-break-inside: avoid;'><p id="_">&#160;&#160;<b>A</b><br/> @@ -1567,22 +2508,36 @@ end it "processes pseudocode (Word)" do FileUtils.rm_f "test.doc" IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", false) -<itu-standard xmlns="http://riboseinc.com/isoxml"> - <bibdata> + <itu-standard xmlns='http://riboseinc.com/isoxml'> + <bibdata> <language>en</language> - </bibdata> - <preface><foreword> - <figure id="_" class="pseudocode"><name>Label</name><p id="_">  <strong>A</strong><br/> -        <smallcap>B</smallcap></p> -<p id="_">  <em>C</em></p></figure> -</preface></itu-standard> + </bibdata> + <preface> + <foreword> + <figure id='_' class='pseudocode' keep-with-next='true' keep-lines-together='true'> + <name>Figure 1&#xA0;&#x2014; Label</name> + <p id='_'> + &#xA0;&#xA0; + <strong>A</strong> + <br/> + &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0; + <smallcap>B</smallcap> + </p> + <p id='_'> + &#xA0;&#xA0; + <em>C</em> + </p> + </figure> + </foreword> + </preface> +</itu-standard> INPUT expect(xmlpp( File.read("test.doc").gsub(%r{^.*<h1 class="ForewordTitle">Foreword</h1>}m, "").gsub(%r{</div>.*}m, "</div>"))).to be_equivalent_to xmlpp(<<~"OUTPUT") - <div class="pseudocode"><a name="_" id="_"></a><p class="pseudocode"><a name="_" id="_"></a>&#xA0;&#xA0;<b>A</b><br/> + <div class="pseudocode" style='page-break-after: avoid;page-break-inside: avoid;'><a name="_" id="_"></a><p class="pseudocode"><a name="_" id="_"></a>&#xA0;&#xA0;<b>A</b><br/> &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span style="font-variant:small-caps;">B</span></p> <p class="pseudocode" style="page-break-after:avoid;"><a name="_" id="_"></a>&#xA0;&#xA0;<i>C</i></p><p class="SourceTitle" style="text-align:center;">Figure 1&#xA0;&#x2014; Label</p></div> OUTPUT end @@ -1604,10 +2559,9 @@ #{HTML_HDR} <br/> <div> <h1 class='ForewordTitle'>Foreword</h1> <div class='example'> - <p class='example-title'>EXAMPLE</p> <pre id='B' class='prettyprint '> A B C </pre> <p class='SourceTitle' style='text-align:center;'>Label</p> <div id='A' class='pseudocode'>