isodoc 1.7.1 → 1.7.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/isodoc.gemspec +2 -1
- data/lib/isodoc/convert.rb +1 -0
- data/lib/isodoc/css.rb +3 -3
- data/lib/isodoc/function/blocks.rb +180 -168
- data/lib/isodoc/function/blocks_example_note.rb +85 -79
- data/lib/isodoc/function/cleanup.rb +181 -175
- data/lib/isodoc/function/inline.rb +110 -108
- data/lib/isodoc/function/inline_simple.rb +55 -55
- data/lib/isodoc/function/lists.rb +75 -71
- data/lib/isodoc/function/references.rb +165 -160
- data/lib/isodoc/function/reqt.rb +91 -85
- data/lib/isodoc/function/section.rb +140 -190
- data/lib/isodoc/function/section_titles.rb +82 -0
- data/lib/isodoc/function/table.rb +90 -87
- data/lib/isodoc/function/terms.rb +58 -56
- data/lib/isodoc/function/to_word_html.rb +208 -204
- data/lib/isodoc/html_convert.rb +0 -4
- data/lib/isodoc/html_function/mathvariant_to_plain.rb +5 -3
- data/lib/isodoc/presentation_function/inline.rb +1 -1
- data/lib/isodoc/presentation_function/math.rb +9 -0
- data/lib/isodoc/presentation_function/section.rb +12 -1
- data/lib/isodoc/presentation_xml_convert.rb +2 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +5 -5
- data/lib/isodoc/xslfo_convert.rb +2 -2
- data/lib/isodoc.rb +2 -1
- data/lib/metanorma/output/base.rb +13 -0
- data/lib/metanorma/output/utils.rb +17 -0
- data/lib/metanorma/output/xslfo.rb +21 -0
- data/lib/metanorma/output.rb +7 -0
- data/spec/assets/outputtest/a.xml +66 -0
- data/spec/assets/outputtest/iso.international-standard.xsl +3011 -0
- data/spec/isodoc/blocks_spec.rb +441 -243
- data/spec/isodoc/inline_spec.rb +197 -114
- data/spec/isodoc/postproc_spec.rb +2 -2
- data/spec/isodoc/presentation_xml_spec.rb +84 -0
- data/spec/isodoc/section_spec.rb +639 -0
- metadata +23 -18
- data/lib/isodoc/html_function/sectionsplit.rb +0 -244
- data/spec/isodoc/sectionsplit_spec.rb +0 -190
data/spec/isodoc/blocks_spec.rb
CHANGED
@@ -1535,7 +1535,7 @@ RSpec.describe IsoDoc do
|
|
1535
1535
|
end
|
1536
1536
|
|
1537
1537
|
it "processes term domains" do
|
1538
|
-
|
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
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
</
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
</
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
</
|
1644
|
-
</
|
1645
|
-
</
|
1646
|
-
</
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
</
|
1656
|
-
</
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
</
|
1665
|
-
|
1666
|
-
|
1667
|
-
</
|
1668
|
-
</
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
<
|
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>  (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/>      if (success)<br/>      recommendation(label: success-response)<br/>      end<br/>    </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
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
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>  (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/>      if (success)<br/>      recommendation(label: success-response)<br/>      end<br/>    </pre>
|
1713
|
+
</div>
|
1714
|
+
<div class='requirement-component1'> <p id='_'>Hello</p> </div>
|
1715
|
+
</div>
|
1713
1716
|
</div>
|
1714
|
-
|
1715
|
-
|
1717
|
+
<p class="zzSTDTitle1"/>
|
1718
|
+
<br/>
|
1719
|
+
<div>
|
1720
|
+
<h1 class='Section3'>Bibliography</h1>
|
1721
|
+
<p id='rfc2616' class='Biblio'>
|
1722
|
+
[1]  IETF RFC 2616,
|
1723
|
+
<i>Hypertext Transfer Protocol — HTTP/1.1</i>
|
1724
|
+
</p>
|
1725
|
+
</div>
|
1726
|
+
</div>
|
1727
|
+
</body>
|
1728
|
+
</html>
|
1716
1729
|
OUTPUT
|
1717
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1718
|
-
|
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
|
1722
|
-
|
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
|
-
|
1818
|
-
|
1819
|
-
|
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
|
-
|
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
|
1864
|
+
<div id="B"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span>   (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/>      if (success)<br/>      recommendation(label: success-response)<br/>      end<br/>    </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({})
|
2082
|
-
|
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
|
2086
|
-
|
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
|
-
|
2190
|
-
|
2191
|
-
|
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
|
-
|
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
|
2205
|
+
<div id="_"><div class="formula"><p><span class="stem">(#(r/1 = 0)#)</span>  (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/>      if (success)<br/>      recommendation(label: success-response)<br/>      end<br/>    </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({})
|
2329
|
-
|
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")
|
2332
|
-
|
2333
|
-
|
2334
|
-
|
2335
|
-
|
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>  <b>A</b><br/>
|
2281
|
+
        <span style="font-variant:small-caps;">B</span></p>
|
2282
|
+
<p class="pseudocode" style="page-break-after:avoid;"><a name="_" id="_"></a>  <i>C</i></p><p class="SourceTitle" style="text-align:center;">Figure 1 — Label</p></div>
|
2283
|
+
OUTPUT
|
2336
2284
|
end
|
2337
2285
|
|
2338
2286
|
it "does not label embedded figures, sourcecode" do
|
2339
|
-
|
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")
|
2395
|
-
|
2396
|
-
|
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
|
-
|
2356
|
+
input = <<~INPUT
|
2404
2357
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
2405
2358
|
<preface><foreword>
|
2406
2359
|
<passthrough format="html,rfc"><A></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
|
-
|
2373
|
+
input = <<~INPUT
|
2417
2374
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
2418
2375
|
<preface><foreword>
|
2419
2376
|
<passthrough format="doc,rfc"><A></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
|
-
|
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,242 @@ 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
|
+
presxml = <<~INPUT
|
2538
|
+
<standard-document xmlns="https://www.metanorma.org/ns/standoc" type="presentation" version="1.10.2">
|
2539
|
+
<bibdata type="standard">
|
2540
|
+
<title language="en" format="text/plain">Document title</title>
|
2541
|
+
<language current="true">en</language>
|
2542
|
+
<script current="true">Latn</script>
|
2543
|
+
<status>
|
2544
|
+
<stage language="">published</stage>
|
2545
|
+
</status>
|
2546
|
+
<copyright>
|
2547
|
+
<from>2021</from>
|
2548
|
+
</copyright>
|
2549
|
+
<ext>
|
2550
|
+
<doctype language="">article</doctype>
|
2551
|
+
</ext>
|
2552
|
+
</bibdata>
|
2553
|
+
<sections>
|
2554
|
+
<clause id="clause1" inline-header="false" obligation="normative" displayorder="1">
|
2555
|
+
<title depth="1">1.<tab/>Clause 1</title>
|
2556
|
+
<clause id="clause1A" inline-header="false" obligation="normative">
|
2557
|
+
<title depth="2">1.1.<tab/>Clause 1A</title>
|
2558
|
+
<clause id="clause1Aa" inline-header="false" obligation="normative">
|
2559
|
+
<title depth="3">1.1.1.<tab/>Clause 1Aa</title>
|
2560
|
+
</clause>
|
2561
|
+
<clause id="clause1Ab" inline-header="false" obligation="normative">
|
2562
|
+
<title depth="3">1.1.2.<tab/>Clause 1Ab</title>
|
2563
|
+
</clause>
|
2564
|
+
</clause>
|
2565
|
+
<clause id="clause1B" inline-header="false" obligation="normative">
|
2566
|
+
<title depth="2">1.2.<tab/>Clause 1B</title>
|
2567
|
+
<clause id="clause1Ba" inline-header="false" obligation="normative">
|
2568
|
+
<title depth="3">1.2.1.<tab/>Clause 1Ba</title>
|
2569
|
+
</clause>
|
2570
|
+
</clause>
|
2571
|
+
</clause>
|
2572
|
+
<clause id="clause2" inline-header="false" obligation="normative" displayorder="2">
|
2573
|
+
<title depth="1">2.<tab/>Clause 2</title>
|
2574
|
+
<p id="A">And introducing: </p>
|
2575
|
+
<toc>
|
2576
|
+
<ul id="B">
|
2577
|
+
<li>
|
2578
|
+
<xref target="clause1A">1.1<tab/>Clause 1A</xref>
|
2579
|
+
</li>
|
2580
|
+
<li>
|
2581
|
+
<ul id="C">
|
2582
|
+
<li>
|
2583
|
+
<xref target="clause1Aa">1.1.1<tab/>Clause 1Aa</xref>
|
2584
|
+
</li>
|
2585
|
+
<li>
|
2586
|
+
<xref target="clause1Ab">1.1.2<tab/>Clause 1Ab</xref>
|
2587
|
+
</li>
|
2588
|
+
</ul>
|
2589
|
+
</li>
|
2590
|
+
<li>
|
2591
|
+
<xref target="clause1B">1.2<tab/>Clause 1B</xref>
|
2592
|
+
</li>
|
2593
|
+
<li>
|
2594
|
+
<ul id="D">
|
2595
|
+
<li>
|
2596
|
+
<xref target="clause1Ba">1.2.1<tab/>Clause 1Ba</xref>
|
2597
|
+
</li>
|
2598
|
+
</ul>
|
2599
|
+
</li>
|
2600
|
+
</ul>
|
2601
|
+
</toc>
|
2602
|
+
<toc>
|
2603
|
+
<ul id="E">
|
2604
|
+
<li>
|
2605
|
+
<xref target="clause1A">1.1<tab/>Clause 1A</xref>
|
2606
|
+
</li>
|
2607
|
+
<li>
|
2608
|
+
<xref target="clause1B">1.2<tab/>Clause 1B</xref>
|
2609
|
+
</li>
|
2610
|
+
</ul>
|
2611
|
+
</toc>
|
2612
|
+
</clause>
|
2613
|
+
</sections>
|
2614
|
+
</standard-document>
|
2615
|
+
INPUT
|
2616
|
+
output = <<~OUTPUT
|
2617
|
+
#{HTML_HDR}
|
2618
|
+
<p class='zzSTDTitle1'>Document title</p>
|
2619
|
+
<div id='clause1'>
|
2620
|
+
<h1>1.  Clause 1</h1>
|
2621
|
+
<div id='clause1A'>
|
2622
|
+
<h2>1.1.  Clause 1A</h2>
|
2623
|
+
<div id='clause1Aa'>
|
2624
|
+
<h3>1.1.1.  Clause 1Aa</h3>
|
2625
|
+
</div>
|
2626
|
+
<div id='clause1Ab'>
|
2627
|
+
<h3>1.1.2.  Clause 1Ab</h3>
|
2628
|
+
</div>
|
2629
|
+
</div>
|
2630
|
+
<div id='clause1B'>
|
2631
|
+
<h2>1.2.  Clause 1B</h2>
|
2632
|
+
<div id='clause1Ba'>
|
2633
|
+
<h3>1.2.1.  Clause 1Ba</h3>
|
2634
|
+
</div>
|
2635
|
+
</div>
|
2636
|
+
</div>
|
2637
|
+
<div id='clause2'>
|
2638
|
+
<h1>2.  Clause 2</h1>
|
2639
|
+
<p id='A'>And introducing: </p>
|
2640
|
+
<div class='toc'>
|
2641
|
+
<ul id='B'>
|
2642
|
+
<li>
|
2643
|
+
<a href='#clause1A'>1.1  Clause 1A</a>
|
2644
|
+
</li>
|
2645
|
+
<li>
|
2646
|
+
<ul id='C'>
|
2647
|
+
<li>
|
2648
|
+
<a href='#clause1Aa'>1.1.1  Clause 1Aa</a>
|
2649
|
+
</li>
|
2650
|
+
<li>
|
2651
|
+
<a href='#clause1Ab'>1.1.2  Clause 1Ab</a>
|
2652
|
+
</li>
|
2653
|
+
</ul>
|
2654
|
+
</li>
|
2655
|
+
<li>
|
2656
|
+
<a href='#clause1B'>1.2  Clause 1B</a>
|
2657
|
+
</li>
|
2658
|
+
<li>
|
2659
|
+
<ul id='D'>
|
2660
|
+
<li>
|
2661
|
+
<a href='#clause1Ba'>1.2.1  Clause 1Ba</a>
|
2662
|
+
</li>
|
2663
|
+
</ul>
|
2664
|
+
</li>
|
2665
|
+
</ul>
|
2666
|
+
</div>
|
2667
|
+
<div class='toc'>
|
2668
|
+
<ul id='E'>
|
2669
|
+
<li>
|
2670
|
+
<a href='#clause1A'>1.1  Clause 1A</a>
|
2671
|
+
</li>
|
2672
|
+
<li>
|
2673
|
+
<a href='#clause1B'>1.2  Clause 1B</a>
|
2674
|
+
</li>
|
2675
|
+
</ul>
|
2676
|
+
</div>
|
2677
|
+
</div>
|
2678
|
+
</div>
|
2679
|
+
</body>
|
2680
|
+
</html>
|
2681
|
+
OUTPUT
|
2682
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
2683
|
+
.convert("test", input, true)
|
2684
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, "")))
|
2685
|
+
.to be_equivalent_to xmlpp(presxml)
|
2686
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
2687
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
2490
2688
|
end
|
2491
2689
|
end
|