isodoc 1.6.7.1 → 1.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +1 -1
  3. data/lib/isodoc-yaml/i18n-ar.yaml +19 -25
  4. data/lib/isodoc-yaml/i18n-de.yaml +1 -0
  5. data/lib/isodoc-yaml/i18n-en.yaml +1 -0
  6. data/lib/isodoc-yaml/i18n-es.yaml +1 -0
  7. data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
  8. data/lib/isodoc-yaml/i18n-ru.yaml +1 -0
  9. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
  10. data/lib/isodoc.rb +1 -0
  11. data/lib/isodoc/convert.rb +1 -1
  12. data/lib/isodoc/css.rb +3 -3
  13. data/lib/isodoc/function/blocks.rb +180 -168
  14. data/lib/isodoc/function/form.rb +39 -36
  15. data/lib/isodoc/function/inline.rb +5 -1
  16. data/lib/isodoc/function/reqt.rb +91 -85
  17. data/lib/isodoc/function/to_word_html.rb +207 -204
  18. data/lib/isodoc/html_convert.rb +0 -4
  19. data/lib/isodoc/html_function/form.rb +48 -45
  20. data/lib/isodoc/html_function/html.rb +2 -0
  21. data/lib/isodoc/html_function/postprocess.rb +9 -4
  22. data/lib/isodoc/presentation_function/block.rb +7 -4
  23. data/lib/isodoc/presentation_function/inline.rb +29 -12
  24. data/lib/isodoc/presentation_function/section.rb +1 -2
  25. data/lib/isodoc/presentation_xml_convert.rb +2 -2
  26. data/lib/isodoc/version.rb +1 -1
  27. data/lib/isodoc/xref.rb +8 -7
  28. data/lib/isodoc/xref/xref_anchor.rb +45 -44
  29. data/lib/isodoc/xref/xref_counter.rb +113 -103
  30. data/lib/isodoc/xref/xref_gen.rb +39 -11
  31. data/lib/metanorma/output.rb +7 -0
  32. data/lib/metanorma/output/base.rb +13 -0
  33. data/lib/metanorma/output/utils.rb +17 -0
  34. data/lib/metanorma/output/xslfo.rb +21 -0
  35. data/spec/assets/outputtest/a.xml +66 -0
  36. data/spec/assets/outputtest/iso.international-standard.xsl +3011 -0
  37. data/spec/isodoc/blocks_spec.rb +358 -243
  38. data/spec/isodoc/form_spec.rb +94 -90
  39. data/spec/isodoc/inline_spec.rb +413 -234
  40. data/spec/isodoc/postproc_spec.rb +70 -27
  41. data/spec/isodoc/terms_spec.rb +2 -2
  42. data/spec/isodoc/xref_spec.rb +274 -652
  43. metadata +8 -18
  44. data/lib/isodoc/html_function/sectionsplit.rb +0 -230
  45. data/spec/isodoc/sectionsplit_spec.rb +0 -190
@@ -1535,7 +1535,7 @@ RSpec.describe IsoDoc do
1535
1535
  end
1536
1536
 
1537
1537
  it "processes term domains" do
1538
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1538
+ input = <<~INPUT
1539
1539
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1540
1540
  <sections>
1541
1541
  <terms>
@@ -1547,6 +1547,7 @@ RSpec.describe IsoDoc do
1547
1547
  </sections>
1548
1548
  </iso-standard>
1549
1549
  INPUT
1550
+ output = <<~OUTPUT
1550
1551
  #{HTML_HDR}
1551
1552
  <p class="zzSTDTitle1"/>
1552
1553
  <div><h1/>
@@ -1558,6 +1559,8 @@ RSpec.describe IsoDoc do
1558
1559
  </body>
1559
1560
  </html>
1560
1561
  OUTPUT
1562
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", input, true)))
1563
+ .to be_equivalent_to xmlpp(output)
1561
1564
  end
1562
1565
 
1563
1566
  it "processes permissions" do
@@ -1569,6 +1572,7 @@ RSpec.describe IsoDoc do
1569
1572
  <inherit>/ss/584/2015/level/1</inherit>
1570
1573
  <inherit><eref type="inline" bibitemid="rfc2616" citeas="RFC 2616">RFC 2616 (HTTP/1.1)</eref></inherit>
1571
1574
  <subject>user</subject>
1575
+ <subject>non-user</subject>
1572
1576
  <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>
1573
1577
  <description>
1574
1578
  <p id="_">I recommend <em>this</em>.</p>
@@ -1608,6 +1612,9 @@ RSpec.describe IsoDoc do
1608
1612
  <import exclude="true">
1609
1613
  <sourcecode id="_">success-response()</sourcecode>
1610
1614
  </import>
1615
+ <component exclude='false' class='component1'>
1616
+ <p id='_'>Hello</p>
1617
+ </component>
1611
1618
  </permission>
1612
1619
  </foreword></preface>
1613
1620
  <bibliography><references id="_bibliography" obligation="informative" normative="false" displayorder="2">
@@ -1617,109 +1624,117 @@ RSpec.describe IsoDoc do
1617
1624
  </iso-standard>
1618
1625
  INPUT
1619
1626
  presxml = <<~OUTPUT
1620
- <iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
1621
- <preface><foreword displayorder='1'>
1622
- <permission id="_" keep-with-next="true" keep-lines-together="true">
1623
- <name>Permission 1</name>
1624
- <label>/ogc/recommendation/wfs/2</label>
1625
- <inherit>/ss/584/2015/level/1</inherit>
1626
- <inherit><eref type="inline" bibitemid="rfc2616" citeas="RFC 2616">RFC 2616 (HTTP/1.1)</eref></inherit>
1627
- <subject>user</subject>
1628
- <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>
1629
- <description>
1630
- <p id="_">I recommend <em>this</em>.</p>
1631
- </description>
1632
- <specification exclude="true" type="tabular">
1633
- <p id="_">This is the object of the recommendation:</p>
1634
- <table id="_">
1635
- <tbody>
1636
- <tr>
1637
- <td style="text-align:left;">Object</td>
1638
- <td style="text-align:left;">Value</td>
1639
- </tr>
1640
- <tr>
1641
- <td style="text-align:left;">Mission</td>
1642
- <td style="text-align:left;">Accomplished</td>
1643
- </tr>
1644
- </tbody>
1645
- </table>
1646
- </specification>
1647
- <description>
1648
- <p id="_">As for the measurement targets,</p>
1649
- </description>
1650
- <measurement-target exclude="false">
1651
- <p id="_">The measurement target shall be measured as:</p>
1652
- <formula id="_">
1653
- <name>1</name>
1654
- <stem type="AsciiMath">r/1 = 0</stem>
1655
- </formula>
1656
- </measurement-target>
1657
- <verification exclude="false">
1658
- <p id="_">The following code will be run for verification:</p>
1659
- <sourcecode id="_">CoreRoot(success): HttpResponse
1660
- if (success)
1661
- recommendation(label: success-response)
1662
- end
1663
- </sourcecode>
1664
- </verification>
1665
- <import exclude="true">
1666
- <sourcecode id="_">success-response()</sourcecode>
1667
- </import>
1668
- </permission>
1669
- </foreword></preface>
1670
- <bibliography><references id="_bibliography" obligation="informative" normative="false" displayorder='2'>
1671
- <title depth='1'>Bibliography</title>
1672
- <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">IETF RFC 2616</docidentifier> <docidentifier type="rfc-anchor">RFC2616</docidentifier> <docidentifier type="DOI">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>
1673
- </references></bibliography>
1674
- </iso-standard>
1675
- OUTPUT
1676
- html = <<~OUTPUT
1677
- #{HTML_HDR}
1678
- <br/>
1679
- <div>
1680
- <h1 class="ForewordTitle">Foreword</h1>
1681
- <div class="permission" id='_' style='page-break-after: avoid;page-break-inside: avoid;'>
1682
- <p class="RecommendationTitle">Permission 1:<br/>/ogc/recommendation/wfs/2</p>
1683
- <p><i>Subject: user<br/>
1684
- Inherits: /ss/584/2015/level/1
1685
- <br/>
1686
- Inherits: <a href='#rfc2616'>RFC 2616 (HTTP/1.1)</a>
1687
- <br/>Control-class: Technical<br/>Priority: P0<br/>Family: System and Communications Protection<br/>Family: System and Communications Protocols</i></p>
1688
- <div class="requirement-description">
1689
- <p id="_">I recommend <i>this</i>.</p>
1690
- </div>
1691
- <div class="requirement-description">
1692
- <p id="_">As for the measurement targets,</p>
1693
- </div>
1694
- <div class="requirement-measurement-target">
1695
- <p id="_">The measurement target shall be measured as:</p>
1696
- <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span>&#160; (1)</p></div></div>
1697
- </div>
1698
- <div class="requirement-verification">
1699
- <p id="_">The following code will be run for verification:</p>
1700
- <pre id="_" class="prettyprint ">CoreRoot(success): HttpResponse<br/>&#160;&#160;&#160;&#160;&#160; if (success)<br/>&#160;&#160;&#160;&#160;&#160; recommendation(label: success-response)<br/>&#160;&#160;&#160;&#160;&#160; end<br/>&#160;&#160;&#160; </pre>
1701
- </div>
1627
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type='presentation'>
1628
+ <preface><foreword displayorder='1'>
1629
+ <permission id="_" keep-with-next="true" keep-lines-together="true">
1630
+ <name>Permission 1</name>
1631
+ <label>/ogc/recommendation/wfs/2</label>
1632
+ <inherit>/ss/584/2015/level/1</inherit>
1633
+ <inherit><eref type="inline" bibitemid="rfc2616" citeas="RFC 2616">RFC 2616 (HTTP/1.1)</eref></inherit>
1634
+ <subject>user</subject>
1635
+ <subject>non-user</subject>
1636
+ <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>
1637
+ <description>
1638
+ <p id="_">I recommend <em>this</em>.</p>
1639
+ </description>
1640
+ <specification exclude="true" type="tabular">
1641
+ <p id="_">This is the object of the recommendation:</p>
1642
+ <table id="_">
1643
+ <tbody>
1644
+ <tr>
1645
+ <td style="text-align:left;">Object</td>
1646
+ <td style="text-align:left;">Value</td>
1647
+ </tr>
1648
+ <tr>
1649
+ <td style="text-align:left;">Mission</td>
1650
+ <td style="text-align:left;">Accomplished</td>
1651
+ </tr>
1652
+ </tbody>
1653
+ </table>
1654
+ </specification>
1655
+ <description>
1656
+ <p id="_">As for the measurement targets,</p>
1657
+ </description>
1658
+ <measurement-target exclude="false">
1659
+ <p id="_">The measurement target shall be measured as:</p>
1660
+ <formula id="_">
1661
+ <name>1</name>
1662
+ <stem type="AsciiMath">r/1 = 0</stem>
1663
+ </formula>
1664
+ </measurement-target>
1665
+ <verification exclude="false">
1666
+ <p id="_">The following code will be run for verification:</p>
1667
+ <sourcecode id="_">CoreRoot(success): HttpResponse
1668
+ if (success)
1669
+ recommendation(label: success-response)
1670
+ end
1671
+ </sourcecode>
1672
+ </verification>
1673
+ <import exclude="true">
1674
+ <sourcecode id="_">success-response()</sourcecode>
1675
+ </import>
1676
+ <component exclude='false' class='component1'>
1677
+ <p id='_'>Hello</p>
1678
+ </component>
1679
+ </permission>
1680
+ </foreword></preface>
1681
+ <bibliography><references id="_bibliography" obligation="informative" normative="false" displayorder='2'>
1682
+ <title depth='1'>Bibliography</title>
1683
+ <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">IETF RFC 2616</docidentifier> <docidentifier type="rfc-anchor">RFC2616</docidentifier> <docidentifier type="DOI">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>
1684
+ </references></bibliography>
1685
+ </iso-standard>
1686
+ OUTPUT
1687
+ html = <<~OUTPUT
1688
+ #{HTML_HDR}
1689
+ <br/>
1690
+ <div>
1691
+ <h1 class="ForewordTitle">Foreword</h1>
1692
+ <div class="permission" id='_' style='page-break-after: avoid;page-break-inside: avoid;'>
1693
+ <p class="RecommendationTitle">Permission 1:<br/>/ogc/recommendation/wfs/2</p>
1694
+ <p><i>Subject: user<br/>
1695
+ Subject: non-user<br/>
1696
+ Inherits: /ss/584/2015/level/1
1697
+ <br/>
1698
+ Inherits: <a href='#rfc2616'>RFC 2616 (HTTP/1.1)</a>
1699
+ <br/>Control-class: Technical<br/>Priority: P0<br/>Family: System and Communications Protection<br/>Family: System and Communications Protocols</i></p>
1700
+ <div class="requirement-description">
1701
+ <p id="_">I recommend <i>this</i>.</p>
1702
1702
  </div>
1703
- </div>
1704
- <p class="zzSTDTitle1"/>
1705
- <br/>
1706
- <div>
1707
- <h1 class='Section3'>Bibliography</h1>
1708
- <p id='rfc2616' class='Biblio'>
1709
- [1]&#160; IETF RFC 2616,
1710
- <i>Hypertext Transfer Protocol&#8201;&#8212;&#8201;HTTP/1.1</i>
1711
- </p>
1712
- </div>
1703
+ <div class="requirement-description">
1704
+ <p id="_">As for the measurement targets,</p>
1705
+ </div>
1706
+ <div class="requirement-measurement-target">
1707
+ <p id="_">The measurement target shall be measured as:</p>
1708
+ <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span>&#160; (1)</p></div></div>
1709
+ </div>
1710
+ <div class="requirement-verification">
1711
+ <p id="_">The following code will be run for verification:</p>
1712
+ <pre id="_" class="prettyprint ">CoreRoot(success): HttpResponse<br/>&#160;&#160;&#160;&#160;&#160; if (success)<br/>&#160;&#160;&#160;&#160;&#160; recommendation(label: success-response)<br/>&#160;&#160;&#160;&#160;&#160; end<br/>&#160;&#160;&#160; </pre>
1713
+ </div>
1714
+ <div class='requirement-component1'> <p id='_'>Hello</p> </div>
1715
+ </div>
1713
1716
  </div>
1714
- </body>
1715
- </html>
1717
+ <p class="zzSTDTitle1"/>
1718
+ <br/>
1719
+ <div>
1720
+ <h1 class='Section3'>Bibliography</h1>
1721
+ <p id='rfc2616' class='Biblio'>
1722
+ [1]&#160; IETF RFC 2616,
1723
+ <i>Hypertext Transfer Protocol&#8201;&#8212;&#8201;HTTP/1.1</i>
1724
+ </p>
1725
+ </div>
1726
+ </div>
1727
+ </body>
1728
+ </html>
1716
1729
  OUTPUT
1717
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1718
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1730
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1731
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1732
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1733
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1719
1734
  end
1720
1735
 
1721
- it "processes requirements (Presentation XML)" do
1722
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1736
+ it "processes requirements" do
1737
+ input = <<~INPUT
1723
1738
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1724
1739
  <preface><foreword>
1725
1740
  <requirement id="A" unnumbered="true" keep-with-next="true" keep-lines-together="true">
@@ -1765,10 +1780,14 @@ RSpec.describe IsoDoc do
1765
1780
  <import exclude="true">
1766
1781
  <sourcecode id="_">success-response()</sourcecode>
1767
1782
  </import>
1783
+ <component exclude='false' class='component1'>
1784
+ <p id='_'>Hello</p>
1785
+ </component>
1768
1786
  </requirement>
1769
1787
  </foreword></preface>
1770
1788
  </iso-standard>
1771
1789
  INPUT
1790
+ presxml = <<~OUTPUT
1772
1791
  <?xml version='1.0'?>
1773
1792
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1774
1793
  <preface>
@@ -1806,80 +1825,28 @@ RSpec.describe IsoDoc do
1806
1825
  </description>
1807
1826
  <measurement-target exclude='false' keep-with-next='true' keep-lines-together='true'>
1808
1827
  <p id='_'>The measurement target shall be measured as:</p>
1809
- <formula id='B'>
1810
- <name>1</name>
1811
- <stem type='AsciiMath'>r/1 = 0</stem>
1812
- </formula>
1813
- </measurement-target>
1828
+ <formula id='B'><name>1</name><stem type='AsciiMath'>r/1 = 0</stem></formula></measurement-target>
1814
1829
  <verification exclude='false'>
1815
1830
  <p id='_'>The following code will be run for verification:</p>
1816
- <sourcecode id='_'>
1817
- CoreRoot(success): HttpResponse if (success) recommendation(label:
1818
- success-response) end
1819
- </sourcecode>
1831
+ <sourcecode id='_'>CoreRoot(success): HttpResponse
1832
+ if (success)
1833
+ recommendation(label: success-response)
1834
+ end
1835
+ </sourcecode>
1820
1836
  </verification>
1821
1837
  <import exclude='true'>
1822
1838
  <sourcecode id='_'>success-response()</sourcecode>
1823
1839
  </import>
1840
+ <component exclude='false' class='component1'>
1841
+ <p id='_'>Hello</p>
1842
+ </component>
1824
1843
  </requirement>
1825
1844
  </foreword>
1826
1845
  </preface>
1827
1846
  </iso-standard>
1828
1847
  OUTPUT
1829
- end
1830
1848
 
1831
- it "processes requirements (HTML)" do
1832
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1833
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1834
- <preface><foreword>
1835
- <requirement id="A" unnumbered="true" keep-with-next="true" keep-lines-together="true">
1836
- <name>Requirement</name>
1837
- <title>A New Requirement</title>
1838
- <label>/ogc/recommendation/wfs/2</label>
1839
- <inherit>/ss/584/2015/level/1</inherit>
1840
- <subject>user</subject>
1841
- <description>
1842
- <p id="_">I recommend <em>this</em>.</p>
1843
- </description>
1844
- <specification exclude="true" type="tabular">
1845
- <p id="_">This is the object of the recommendation:</p>
1846
- <table id="_">
1847
- <tbody>
1848
- <tr>
1849
- <td style="text-align:left;">Object</td>
1850
- <td style="text-align:left;">Value</td>
1851
- </tr>
1852
- <tr>
1853
- <td style="text-align:left;">Mission</td>
1854
- <td style="text-align:left;">Accomplished</td>
1855
- </tr>
1856
- </tbody>
1857
- </table>
1858
- </specification>
1859
- <description>
1860
- <p id="_">As for the measurement targets,</p>
1861
- </description>
1862
- <measurement-target exclude="false" keep-with-next="true" keep-lines-together="true">
1863
- <p id="_">The measurement target shall be measured as:</p>
1864
- <formula id="B">
1865
- <stem type="AsciiMath">r/1 = 0</stem>
1866
- </formula>
1867
- </measurement-target>
1868
- <verification exclude="false">
1869
- <p id="_">The following code will be run for verification:</p>
1870
- <sourcecode id="_">CoreRoot(success): HttpResponse
1871
- if (success)
1872
- recommendation(label: success-response)
1873
- end
1874
- </sourcecode>
1875
- </verification>
1876
- <import exclude="true">
1877
- <sourcecode id="_">success-response()</sourcecode>
1878
- </import>
1879
- </requirement>
1880
- </foreword></preface>
1881
- </iso-standard>
1882
- INPUT
1849
+ output = <<~OUTPUT
1883
1850
  #{HTML_HDR}
1884
1851
  <br/>
1885
1852
  <div>
@@ -1894,12 +1861,13 @@ RSpec.describe IsoDoc do
1894
1861
  </div>
1895
1862
  <div class="requirement-measurement-target" style='page-break-after: avoid;page-break-inside: avoid;'>
1896
1863
  <p id="_">The measurement target shall be measured as:</p>
1897
- <div id="B"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span></p></div></div>
1864
+ <div id="B"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span> &#160; (1)</p></div></div>
1898
1865
  </div>
1899
1866
  <div class="requirement-verification">
1900
1867
  <p id="_">The following code will be run for verification:</p>
1901
1868
  <pre id="_" class="prettyprint ">CoreRoot(success): HttpResponse<br/>&#160;&#160;&#160;&#160;&#160; if (success)<br/>&#160;&#160;&#160;&#160;&#160; recommendation(label: success-response)<br/>&#160;&#160;&#160;&#160;&#160; end<br/>&#160;&#160;&#160; </pre>
1902
1869
  </div>
1870
+ <div class='requirement-component1'> <p id='_'>Hello</p> </div>
1903
1871
  </div>
1904
1872
  </div>
1905
1873
  <p class="zzSTDTitle1"/>
@@ -1907,6 +1875,10 @@ RSpec.describe IsoDoc do
1907
1875
  </body>
1908
1876
  </html>
1909
1877
  OUTPUT
1878
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1879
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1880
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1881
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
1910
1882
  end
1911
1883
 
1912
1884
  it "processes requirements in French" do
@@ -1960,6 +1932,9 @@ RSpec.describe IsoDoc do
1960
1932
  <import exclude="true">
1961
1933
  <sourcecode id="_">success-response()</sourcecode>
1962
1934
  </import>
1935
+ <component exclude='false' class='component1'>
1936
+ <p id='_'>Hello</p>
1937
+ </component>
1963
1938
  </requirement>
1964
1939
  </foreword></preface>
1965
1940
  </iso-standard>
@@ -2015,6 +1990,9 @@ RSpec.describe IsoDoc do
2015
1990
  <import exclude="true">
2016
1991
  <sourcecode id="_">success-response()</sourcecode>
2017
1992
  </import>
1993
+ <component exclude='false' class='component1'>
1994
+ <p id='_'>Hello</p>
1995
+ </component>
2018
1996
  </requirement>
2019
1997
  </foreword></preface>
2020
1998
  </iso-standard>
@@ -2071,6 +2049,7 @@ RSpec.describe IsoDoc do
2071
2049
  <br/>
2072
2050
  </pre>
2073
2051
  </div>
2052
+ <div class='requirement-component1'> <p id='_'>Hello</p> </div>
2074
2053
  </div>
2075
2054
  </div>
2076
2055
  <p class='zzSTDTitle1'/>
@@ -2078,12 +2057,16 @@ RSpec.describe IsoDoc do
2078
2057
  </body>
2079
2058
  </html>
2080
2059
  OUTPUT
2081
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(presxml)
2082
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
2060
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2061
+ .convert("test", input, true))
2062
+ .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
2063
+ .to be_equivalent_to xmlpp(presxml)
2064
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
2065
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
2083
2066
  end
2084
2067
 
2085
- it "processes recommendation (Presentation XML)" do
2086
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2068
+ it "processes recommendation" do
2069
+ input = <<~INPUT
2087
2070
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2088
2071
  <preface><foreword>
2089
2072
  <recommendation id="_" obligation="shall,could" keep-with-next="true" keep-lines-together="true">
@@ -2130,10 +2113,14 @@ RSpec.describe IsoDoc do
2130
2113
  <import exclude="true">
2131
2114
  <sourcecode id="_">success-response()</sourcecode>
2132
2115
  </import>
2116
+ <component exclude='false' class='component1'>
2117
+ <p id='_'>Hello</p>
2118
+ </component>
2133
2119
  </recommendation>
2134
2120
  </foreword></preface>
2135
2121
  </iso-standard>
2136
2122
  INPUT
2123
+ presxml = <<~OUTPUT
2137
2124
  <?xml version='1.0'?>
2138
2125
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2139
2126
  <preface>
@@ -2178,81 +2165,29 @@ RSpec.describe IsoDoc do
2178
2165
  </description>
2179
2166
  <measurement-target exclude='false'>
2180
2167
  <p id='_'>The measurement target shall be measured as:</p>
2181
- <formula id='_'>
2182
- <name>1</name>
2183
- <stem type='AsciiMath'>r/1 = 0</stem>
2184
- </formula>
2168
+ <formula id='_'><name>1</name><stem type='AsciiMath'>r/1 = 0</stem></formula>
2185
2169
  </measurement-target>
2186
2170
  <verification exclude='false'>
2187
2171
  <p id='_'>The following code will be run for verification:</p>
2188
- <sourcecode id='_'>
2189
- CoreRoot(success): HttpResponse if (success) recommendation(label:
2190
- success-response) end
2191
- </sourcecode>
2172
+ <sourcecode id='_'>CoreRoot(success): HttpResponse
2173
+ if (success)
2174
+ recommendation(label: success-response)
2175
+ end
2176
+ </sourcecode>
2192
2177
  </verification>
2193
2178
  <import exclude='true'>
2194
2179
  <sourcecode id='_'>success-response()</sourcecode>
2195
2180
  </import>
2181
+ <component exclude='false' class='component1'>
2182
+ <p id='_'>Hello</p>
2183
+ </component>
2196
2184
  </recommendation>
2197
2185
  </foreword>
2198
2186
  </preface>
2199
2187
  </iso-standard>
2200
2188
  OUTPUT
2201
- end
2202
2189
 
2203
- it "processes recommendation (HTML)" do
2204
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2205
- <iso-standard xmlns="http://riboseinc.com/isoxml">
2206
- <preface><foreword>
2207
- <recommendation id="_" obligation="shall,could" keep-with-next="true" keep-lines-together="true">
2208
- <name>Recommendation 1</name>
2209
- <label>/ogc/recommendation/wfs/2</label>
2210
- <inherit>/ss/584/2015/level/1</inherit>
2211
- <classification><tag>type</tag><value>text</value></classification>
2212
- <classification><tag>language</tag><value>BASIC</value></classification>
2213
- <subject>user</subject>
2214
- <description>
2215
- <p id="_">I recommend <em>this</em>.</p>
2216
- </description>
2217
- <specification exclude="true" type="tabular">
2218
- <p id="_">This is the object of the recommendation:</p>
2219
- <table id="_">
2220
- <tbody>
2221
- <tr>
2222
- <td style="text-align:left;">Object</td>
2223
- <td style="text-align:left;">Value</td>
2224
- </tr>
2225
- <tr>
2226
- <td style="text-align:left;">Mission</td>
2227
- <td style="text-align:left;">Accomplished</td>
2228
- </tr>
2229
- </tbody>
2230
- </table>
2231
- </specification>
2232
- <description>
2233
- <p id="_">As for the measurement targets,</p>
2234
- </description>
2235
- <measurement-target exclude="false">
2236
- <p id="_">The measurement target shall be measured as:</p>
2237
- <formula id="_">
2238
- <stem type="AsciiMath">r/1 = 0</stem>
2239
- </formula>
2240
- </measurement-target>
2241
- <verification exclude="false">
2242
- <p id="_">The following code will be run for verification:</p>
2243
- <sourcecode id="_">CoreRoot(success): HttpResponse
2244
- if (success)
2245
- recommendation(label: success-response)
2246
- end
2247
- </sourcecode>
2248
- </verification>
2249
- <import exclude="true">
2250
- <sourcecode id="_">success-response()</sourcecode>
2251
- </import>
2252
- </recommendation>
2253
- </foreword></preface>
2254
- </iso-standard>
2255
- INPUT
2190
+ output = <<~OUTPUT
2256
2191
  #{HTML_HDR}
2257
2192
  <br/>
2258
2193
  <div>
@@ -2267,12 +2202,13 @@ RSpec.describe IsoDoc do
2267
2202
  </div>
2268
2203
  <div class="requirement-measurement-target">
2269
2204
  <p id="_">The measurement target shall be measured as:</p>
2270
- <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span></p></div></div>
2205
+ <div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span>&#160; (1)</p></div></div>
2271
2206
  </div>
2272
2207
  <div class="requirement-verification">
2273
2208
  <p id="_">The following code will be run for verification:</p>
2274
2209
  <pre id="_" class="prettyprint ">CoreRoot(success): HttpResponse<br/>&#160;&#160;&#160;&#160;&#160; if (success)<br/>&#160;&#160;&#160;&#160;&#160; recommendation(label: success-response)<br/>&#160;&#160;&#160;&#160;&#160; end<br/>&#160;&#160;&#160; </pre>
2275
2210
  </div>
2211
+ <div class='requirement-component1'> <p id='_'>Hello</p> </div>
2276
2212
  </div>
2277
2213
  </div>
2278
2214
  <p class="zzSTDTitle1"/>
@@ -2280,6 +2216,11 @@ RSpec.describe IsoDoc do
2280
2216
  </body>
2281
2217
  </html>
2282
2218
  OUTPUT
2219
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2220
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
2221
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
2222
+ .convert("test", presxml, true)))
2223
+ .to be_equivalent_to xmlpp(output)
2283
2224
  end
2284
2225
 
2285
2226
  it "processes pseudocode" do
@@ -2325,18 +2266,25 @@ RSpec.describe IsoDoc do
2325
2266
  OUTPUT
2326
2267
 
2327
2268
  FileUtils.rm_f "test.doc"
2328
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(presxml)
2329
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
2269
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2270
+ .convert("test", input, true))
2271
+ .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
2272
+ .to be_equivalent_to xmlpp(presxml)
2273
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
2274
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
2330
2275
  IsoDoc::WordConvert.new({}).convert("test", presxml, false)
2331
- 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")
2332
- <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/>
2333
- &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span style="font-variant:small-caps;">B</span></p>
2334
- <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>
2335
- OUTPUT
2276
+ expect(xmlpp(File.read("test.doc")
2277
+ .gsub(%r{^.*<h1 class="ForewordTitle">Foreword</h1>}m, "")
2278
+ .gsub(%r{</div>.*}m, "</div>")))
2279
+ .to be_equivalent_to xmlpp(<<~"OUTPUT")
2280
+ <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/>
2281
+ &#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;&#xA0;<span style="font-variant:small-caps;">B</span></p>
2282
+ <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>
2283
+ OUTPUT
2336
2284
  end
2337
2285
 
2338
2286
  it "does not label embedded figures, sourcecode" do
2339
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2287
+ input = <<~INPUT
2340
2288
  <itu-standard xmlns="http://riboseinc.com/isoxml">
2341
2289
  <bibdata>
2342
2290
  <language>en</language>
@@ -2350,6 +2298,7 @@ RSpec.describe IsoDoc do
2350
2298
  </example>
2351
2299
  </preface></itu-standard>
2352
2300
  INPUT
2301
+ output = <<~OUTPUT
2353
2302
  #{HTML_HDR}
2354
2303
  <br/>
2355
2304
  <div>
@@ -2380,6 +2329,8 @@ RSpec.describe IsoDoc do
2380
2329
  </body>
2381
2330
  </html>
2382
2331
  OUTPUT
2332
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
2333
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
2383
2334
  end
2384
2335
 
2385
2336
  it "processes passthrough with compatible format" do
@@ -2391,35 +2342,42 @@ RSpec.describe IsoDoc do
2391
2342
  </foreword></preface>
2392
2343
  </iso-standard>
2393
2344
  INPUT
2394
- expect((File.read("test.html").gsub(%r{^.*<h1 class="ForewordTitle">Foreword</h1>}m, "").gsub(%r{</div>.*}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2395
- <A><i>Hello</i></A>
2396
- OUTPUT
2345
+ expect((File.read("test.html")
2346
+ .gsub(%r{^.*<h1 class="ForewordTitle">Foreword</h1>}m, "")
2347
+ .gsub(%r{</div>.*}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2348
+ <A><i>Hello</i></A>
2349
+ OUTPUT
2397
2350
  end
2398
2351
 
2399
2352
  it "aborts if passthrough results in malformed XML" do
2400
2353
  FileUtils.rm_f "test.html"
2401
2354
  FileUtils.rm_f "test.html.err"
2402
2355
  begin
2403
- expect { IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", false) }.to raise_error(SystemExit)
2356
+ input = <<~INPUT
2404
2357
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2405
2358
  <preface><foreword>
2406
2359
  <passthrough format="html,rfc">&lt;A&gt;</passthrough><em>Hello</em>
2407
2360
  </foreword></preface>
2408
2361
  </iso-standard>
2409
2362
  INPUT
2363
+ expect do
2364
+ IsoDoc::HtmlConvert.new({})
2365
+ .convert("test", input, false)
2366
+ end.to raise_error(SystemExit)
2410
2367
  rescue SystemExit
2411
2368
  end
2412
2369
  expect(File.exist?("test.html.err")).to be true
2413
2370
  end
2414
2371
 
2415
2372
  it "ignores passthrough with incompatible format" do
2416
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2373
+ input = <<~INPUT
2417
2374
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2418
2375
  <preface><foreword>
2419
2376
  <passthrough format="doc,rfc">&lt;A&gt;</passthrough>
2420
2377
  </foreword></preface>
2421
2378
  </iso-standard>
2422
2379
  INPUT
2380
+ output = <<~OUTPUT
2423
2381
  #{HTML_HDR}
2424
2382
  <br/>
2425
2383
  <div>
@@ -2430,10 +2388,12 @@ RSpec.describe IsoDoc do
2430
2388
  </body>
2431
2389
  </html>
2432
2390
  OUTPUT
2391
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
2392
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
2433
2393
  end
2434
2394
 
2435
2395
  it "processes svgmap" do
2436
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~INPUT, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(<<~OUTPUT)
2396
+ input = <<~INPUT
2437
2397
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2438
2398
  <sections>
2439
2399
  <svgmap id='_'>
@@ -2469,6 +2429,7 @@ RSpec.describe IsoDoc do
2469
2429
  </bibliography>
2470
2430
  </iso-standard>
2471
2431
  INPUT
2432
+ output = <<~OUTPUT
2472
2433
  <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
2473
2434
  <sections>
2474
2435
  <figure id='_'>
@@ -2487,5 +2448,159 @@ RSpec.describe IsoDoc do
2487
2448
  </bibliography>
2488
2449
  </iso-standard>
2489
2450
  OUTPUT
2451
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2452
+ .convert("test", input, true))
2453
+ .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
2454
+ .to be_equivalent_to xmlpp(output)
2455
+ end
2456
+
2457
+ it "processes toc" do
2458
+ input = <<~INPUT
2459
+ <standard-document xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='1.10.2'>
2460
+ <bibdata type='standard'>
2461
+ <title language='en' format='text/plain'>Document title</title>
2462
+ <language>en</language>
2463
+ <script>Latn</script>
2464
+ <status>
2465
+ <stage>published</stage>
2466
+ </status>
2467
+ <copyright>
2468
+ <from>2021</from>
2469
+ </copyright>
2470
+ <ext>
2471
+ <doctype>article</doctype>
2472
+ </ext>
2473
+ </bibdata>
2474
+ <sections>
2475
+ <clause id='clause1' inline-header='false' obligation='normative'>
2476
+ <title>Clause 1</title>
2477
+ <clause id='clause1A' inline-header='false' obligation='normative'>
2478
+ <title>Clause 1A</title>
2479
+ <clause id='clause1Aa' inline-header='false' obligation='normative'>
2480
+ <title>Clause 1Aa</title>
2481
+ </clause>
2482
+ <clause id='clause1Ab' inline-header='false' obligation='normative'>
2483
+ <title>Clause 1Ab</title>
2484
+ </clause>
2485
+ </clause>
2486
+ <clause id='clause1B' inline-header='false' obligation='normative'>
2487
+ <title>Clause 1B</title>
2488
+ <clause id='clause1Ba' inline-header='false' obligation='normative'>
2489
+ <title>Clause 1Ba</title>
2490
+ </clause>
2491
+ </clause>
2492
+ </clause>
2493
+ <clause id='clause2' inline-header='false' obligation='normative'>
2494
+ <title>Clause 2</title>
2495
+ <p id='A'>And introducing: </p>
2496
+ <toc>
2497
+ <ul id='B'>
2498
+ <li>
2499
+ <xref target='clause1A'>Clause 1A</xref>
2500
+ </li>
2501
+ <li>
2502
+ <ul id='C'>
2503
+ <li>
2504
+ <xref target='clause1Aa'>Clause 1Aa</xref>
2505
+ </li>
2506
+ <li>
2507
+ <xref target='clause1Ab'>Clause 1Ab</xref>
2508
+ </li>
2509
+ </ul>
2510
+ </li>
2511
+ <li>
2512
+ <xref target='clause1B'>Clause 1B</xref>
2513
+ </li>
2514
+ <li>
2515
+ <ul id='D'>
2516
+ <li>
2517
+ <xref target='clause1Ba'>Clause 1Ba</xref>
2518
+ </li>
2519
+ </ul>
2520
+ </li>
2521
+ </ul>
2522
+ </toc>
2523
+ <toc>
2524
+ <ul id='E'>
2525
+ <li>
2526
+ <xref target='clause1A'>Clause 1A</xref>
2527
+ </li>
2528
+ <li>
2529
+ <xref target='clause1B'>Clause 1B</xref>
2530
+ </li>
2531
+ </ul>
2532
+ </toc>
2533
+ </clause>
2534
+ </sections>
2535
+ </standard-document>
2536
+ INPUT
2537
+ output = <<~OUTPUT
2538
+ #{HTML_HDR}
2539
+ <p class='zzSTDTitle1'>Document title</p>
2540
+ <div id='clause1'>
2541
+ <h1>Clause 1</h1>
2542
+ <div id='clause1A'>
2543
+ <h2>Clause 1A</h2>
2544
+ <div id='clause1Aa'>
2545
+ <h3>Clause 1Aa</h3>
2546
+ </div>
2547
+ <div id='clause1Ab'>
2548
+ <h3>Clause 1Ab</h3>
2549
+ </div>
2550
+ </div>
2551
+ <div id='clause1B'>
2552
+ <h2>Clause 1B</h2>
2553
+ <div id='clause1Ba'>
2554
+ <h3>Clause 1Ba</h3>
2555
+ </div>
2556
+ </div>
2557
+ </div>
2558
+ <div id='clause2'>
2559
+ <h1>Clause 2</h1>
2560
+ <p id='A'>And introducing: </p>
2561
+ <div class='toc'>
2562
+ <ul id='B'>
2563
+ <li>
2564
+ <a href='#clause1A'>Clause 1A</a>
2565
+ </li>
2566
+ <li>
2567
+ <ul id='C'>
2568
+ <li>
2569
+ <a href='#clause1Aa'>Clause 1Aa</a>
2570
+ </li>
2571
+ <li>
2572
+ <a href='#clause1Ab'>Clause 1Ab</a>
2573
+ </li>
2574
+ </ul>
2575
+ </li>
2576
+ <li>
2577
+ <a href='#clause1B'>Clause 1B</a>
2578
+ </li>
2579
+ <li>
2580
+ <ul id='D'>
2581
+ <li>
2582
+ <a href='#clause1Ba'>Clause 1Ba</a>
2583
+ </li>
2584
+ </ul>
2585
+ </li>
2586
+ </ul>
2587
+ </div>
2588
+ <div class='toc'>
2589
+ <ul id='E'>
2590
+ <li>
2591
+ <a href='#clause1A'>Clause 1A</a>
2592
+ </li>
2593
+ <li>
2594
+ <a href='#clause1B'>Clause 1B</a>
2595
+ </li>
2596
+ </ul>
2597
+ </div>
2598
+ </div>
2599
+ </div>
2600
+ </body>
2601
+ </html>
2602
+ OUTPUT
2603
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
2604
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
2490
2605
  end
2491
2606
  end