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

- old
+ new

@@ -1,15 +1,165 @@ require "spec_helper" RSpec.describe IsoDoc do + it "processes IsoXML tables (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> + <table id="tableD-1" alt="tool tip" summary="long desc" width="70%" keep-with-next="true" keep-lines-together="true"> + <name>Repeatability and reproducibility of <em>husked</em> rice yield<fn reference="1"><p>X</p></fn></name> + <thead> + <tr> + <td rowspan="2" align="left">Description</td> + <td colspan="4" align="center">Rice sample</td> + </tr> + <tr> + <td align="left">Arborio</td> + <td align="center">Drago<fn reference="a"> + <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p> +</fn></td> + <td align="center">Balilla<fn reference="a"> + <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p> +</fn></td> + <td align="center">Thaibonnet</td> + </tr> + </thead> + <tbody> + <tr> + <th align="left">Number of laboratories retained after eliminating outliers</th> + <td align="center">13</td> + <td align="center">11</td> + <td align="center">13</td> + <td align="center">13</td> + </tr> + <tr> + <td align="left">Mean value, g/100 g</td> + <td align="center">81,2</td> + <td align="center">82,0</td> + <td align="center">81,8</td> + <td align="center">77,7</td> + </tr> + </tbody> + <tfoot> + <tr> + <td align="left">Reproducibility limit, <stem type="AsciiMath">R</stem> (= 2,83 <stem type="AsciiMath">s_R</stem>)</td> + <td align="center">2,89</td> + <td align="center">0,57</td> + <td align="center">2,26</td> + <td align="center">6,06</td> + </tr> + </tfoot> + <dl> + <dt>Drago</dt> +<dd>A type of rice</dd> +</dl> +<note><name>NOTE</name><p>This is a table about rice</p></note> +</table> + +<table id="tableD-2" unnumbered="true"> +<tbody><tr><td>A</td></tr></tbody> +</table> +</foreword> +</preface> +</iso-standard> + INPUT + <?xml version='1.0'?> + <iso-standard xmlns='http://riboseinc.com/isoxml'> + <preface> + <foreword> + <table id='tableD-1' alt='tool tip' summary='long desc' width='70%' keep-with-next='true' keep-lines-together='true'> + <name> + Table 1&#xA0;&#x2014; Repeatability and reproducibility of + <em>husked</em> + rice yield + <fn reference='1'> + <p>X</p> + </fn> + </name> + <thead> + <tr> + <td rowspan='2' align='left'>Description</td> + <td colspan='4' align='center'>Rice sample</td> + </tr> + <tr> + <td align='left'>Arborio</td> + <td align='center'> + Drago + <fn reference='a'> + <p id='_0fe65e9a-5531-408e-8295-eeff35f41a55'>Parboiled rice.</p> + </fn> + </td> + <td align='center'> + Balilla + <fn reference='a'> + <p id='_0fe65e9a-5531-408e-8295-eeff35f41a55'>Parboiled rice.</p> + </fn> + </td> + <td align='center'>Thaibonnet</td> + </tr> + </thead> + <tbody> + <tr> + <th align='left'>Number of laboratories retained after eliminating outliers</th> + <td align='center'>13</td> + <td align='center'>11</td> + <td align='center'>13</td> + <td align='center'>13</td> + </tr> + <tr> + <td align='left'>Mean value, g/100 g</td> + <td align='center'>81,2</td> + <td align='center'>82,0</td> + <td align='center'>81,8</td> + <td align='center'>77,7</td> + </tr> + </tbody> + <tfoot> + <tr> + <td align='left'> + Reproducibility limit, + <stem type='AsciiMath'>R</stem> + (= 2,83 + <stem type='AsciiMath'>s_R</stem> + ) + </td> + <td align='center'>2,89</td> + <td align='center'>0,57</td> + <td align='center'>2,26</td> + <td align='center'>6,06</td> + </tr> + </tfoot> + <dl> + <dt>Drago</dt> + <dd>A type of rice</dd> + </dl> + <note> + <name>NOTENOTE</name> + <p>This is a table about rice</p> + </note> + </table> + <table id='tableD-2' unnumbered='true'> + <tbody> + <tr> + <td>A</td> + </tr> + </tbody> + </table> + </foreword> + </preface> + </iso-standard> +OUTPUT + end + it "processes IsoXML tables" 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> <table id="tableD-1" alt="tool tip" summary="long desc" width="70%" keep-with-next="true" keep-lines-together="true"> - <name>Repeatability and reproducibility of <em>husked</em> rice yield<fn reference="1"><p>X</p></fn></name> + <name>Table 1&#xA0;&#x2014; Repeatability and reproducibility of <em>husked</em> rice yield<fn reference="1"><p>X</p></fn></name> <thead> <tr> <td rowspan="2" align="left">Description</td> <td colspan="4" align="center">Rice sample</td> </tr> @@ -51,11 +201,11 @@ </tfoot> <dl> <dt>Drago</dt> <dd>A type of rice</dd> </dl> -<note><p>This is a table about rice</p></note> +<note><name>NOTE</name><p>This is a table about rice</p></note> </table> <table id="tableD-2" unnumbered="true"> <tbody><tr><td>A</td></tr></tbody> </table> @@ -147,14 +297,15 @@ expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true).gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref"))).to be_equivalent_to xmlpp(<<~"OUTPUT") <iso-standard xmlns="http://riboseinc.com/isoxml"> <preface> <foreword> <table id="tableD-0"> + <name>Table 1</name> <tbody><tr><td>A</td></tr></tbody> </table> <table id="tableD-1" alt="tool tip" summary="long desc" width="70%"> - <name>Repeatability and reproducibility of husked rice yield<fn reference="1"><p>X</p></fn></name> + <name>Table 2&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield<fn reference="1"><p>X</p></fn></name> <thead> <tr> <td rowspan="2" align="left">Description</td> <td colspan="4" align="center">Rice sample</td> </tr> @@ -196,10 +347,10 @@ </tfoot> <dl> <dt>Drago</dt> <dd>A type of rice</dd> </dl> -<note><p>This is a table about rice</p></note> +<note><name>NOTE</name><p>This is a table about rice</p></note> </table> </foreword> </preface> </iso-standard> INPUT