metanorma-iec 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/bin/rspec +18 -0
  4. data/lib/asciidoctor/iec/biblio.rng +949 -0
  5. data/lib/asciidoctor/iec/converter.rb +68 -0
  6. data/lib/asciidoctor/iec/iec_intro_en.xml +15 -0
  7. data/lib/asciidoctor/iec/iec_intro_fr.xml +15 -0
  8. data/lib/asciidoctor/iec/isodoc.rng +1132 -0
  9. data/lib/asciidoctor/iec/isostandard.rng +789 -0
  10. data/lib/asciidoctor/iec/reqt.rng +162 -0
  11. data/lib/isodoc/iec/base_convert.rb +69 -0
  12. data/lib/isodoc/iec/html/header.html +160 -0
  13. data/lib/isodoc/iec/html/html_iec_intro.html +34 -0
  14. data/lib/isodoc/iec/html/html_iec_titlepage.html +62 -0
  15. data/lib/isodoc/iec/html/htmlstyle.scss +840 -0
  16. data/lib/isodoc/iec/html/isodoc.scss +785 -0
  17. data/lib/isodoc/iec/html/scripts.html +176 -0
  18. data/lib/isodoc/iec/html/word_iec_intro.html +72 -0
  19. data/lib/isodoc/iec/html/word_iec_titlepage.html +92 -0
  20. data/lib/isodoc/iec/html/wordstyle.scss +1849 -0
  21. data/lib/isodoc/iec/html_convert.rb +33 -0
  22. data/lib/isodoc/iec/i18n-en.yaml +3 -0
  23. data/lib/isodoc/iec/i18n-fr.yaml +3 -0
  24. data/lib/isodoc/iec/i18n-zh-Hans.yaml +3 -0
  25. data/lib/isodoc/iec/metadata.rb +20 -0
  26. data/lib/isodoc/iec/word_convert.rb +165 -0
  27. data/lib/metanorma-iec.rb +12 -0
  28. data/lib/metanorma/iec.rb +8 -0
  29. data/lib/metanorma/iec/processor.rb +40 -0
  30. data/lib/metanorma/iec/version.rb +6 -0
  31. data/metanorma-iec.gemspec +47 -0
  32. data/spec/asciidoctor-iec/base_spec.rb +609 -0
  33. data/spec/asciidoctor-iec/blocks_spec.rb +467 -0
  34. data/spec/asciidoctor-iec/cleanup_spec.rb +766 -0
  35. data/spec/asciidoctor-iec/inline_spec.rb +162 -0
  36. data/spec/asciidoctor-iec/lists_spec.rb +190 -0
  37. data/spec/asciidoctor-iec/macros_spec.rb +21 -0
  38. data/spec/asciidoctor-iec/refs_spec.rb +268 -0
  39. data/spec/asciidoctor-iec/section_spec.rb +341 -0
  40. data/spec/asciidoctor-iec/table_spec.rb +307 -0
  41. data/spec/asciidoctor-iec/validate_spec.rb +132 -0
  42. data/spec/examples/rice.adoc +723 -0
  43. data/spec/examples/rice.doc +19162 -0
  44. data/spec/examples/rice.html +1787 -0
  45. data/spec/examples/rice.xml +1951 -0
  46. data/spec/isodoc/i18n_spec.rb +642 -0
  47. data/spec/isodoc/inline_spec.rb +265 -0
  48. data/spec/isodoc/iso_spec.rb +319 -0
  49. data/spec/isodoc/metadata_spec.rb +153 -0
  50. data/spec/isodoc/postproc_spec.rb +569 -0
  51. data/spec/isodoc/section_spec.rb +686 -0
  52. data/spec/isodoc/terms_spec.rb +206 -0
  53. data/spec/isodoc/xref_spec.rb +1323 -0
  54. data/spec/metanorma/processor_spec.rb +88 -0
  55. data/spec/spec_helper.rb +253 -0
  56. metadata +325 -0
@@ -0,0 +1,206 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "processes IsoXML terms" do
5
+ expect(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <sections>
8
+ <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
9
+
10
+ <term id="paddy1"><preferred>paddy</preferred>
11
+ <domain>rice</domain>
12
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
13
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
14
+ <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
15
+ <ul>
16
+ <li>A</li>
17
+ </ul>
18
+ </termexample>
19
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
20
+ <ul>
21
+ <li>A</li>
22
+ </ul>
23
+ </termexample>
24
+
25
+ <termsource status="modified">
26
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
27
+ <modification>
28
+ <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
29
+ </modification>
30
+ </termsource></term>
31
+
32
+ <term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
33
+ <admitted>rough rice</admitted>
34
+ <deprecates>cargo rice</deprecates>
35
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
36
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
37
+ <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
38
+ </termnote>
39
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
40
+ <ul><li>A</li></ul>
41
+ <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
42
+ </termnote>
43
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
44
+ <ul>
45
+ <li>A</li>
46
+ </ul>
47
+ </termexample>
48
+ <termsource status="identical">
49
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
50
+ </termsource></term>
51
+ </terms>
52
+ </sections>
53
+ </iso-standard>
54
+ INPUT
55
+ #{HTML_HDR}
56
+ <div id="">
57
+ <h1 class="ForewordTitle">FOREWORD</h1>
58
+ <div class="boilerplate_legal"/>
59
+ </div>
60
+ #{IEC_TITLE}
61
+ <div id="_terms_and_definitions"><h1>1&#160; Terms and definitions</h1><p>For the purposes of this document,
62
+ the following terms and definitions apply.</p>
63
+ <p>ISO and IEC maintain terminological databases for use in
64
+ standardization at the following addresses:</p>
65
+
66
+ <ul>
67
+ <li> <p>ISO Online browsing platform: available at
68
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
69
+ <li> <p>IEC Electropedia: available at
70
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
71
+ </p> </li> </ul>
72
+ <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
73
+
74
+ <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">&lt;rice&gt; rice retaining its husk after threshing</p>
75
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p><span class="example_label">EXAMPLE 1</span>&#160; Foreign seeds, husks, bran, sand, dust.</p><ul>
76
+ <li>A</li>
77
+ </ul></div>
78
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><p><span class="example_label">EXAMPLE 2</span>&#160; </p>
79
+ <ul>
80
+ <li>A</li>
81
+ </ul>
82
+ </div>
83
+
84
+ <p>[TERMREF]
85
+ <a href="#ISO7301">ISO 7301:2011, 3.1</a>
86
+ [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
87
+ [/TERMREF]</p><p class="TermNum" id="paddy">1.2</p><p class="Terms" style="text-align:left;">paddy</p><p class="AltTerms" style="text-align:left;">paddy rice</p>
88
+ <p class="AltTerms" style="text-align:left;">rough rice</p>
89
+ <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
90
+ <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
91
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p><span class="example_label">EXAMPLE</span>&#160; </p>
92
+ <ul>
93
+ <li>A</li>
94
+ </ul>
95
+ </div>
96
+ <div class="Note"><p>Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div>
97
+ <div class="Note"><p>Note 2 to entry: <ul><li>A</li></ul><p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></p></div>
98
+ <p>[TERMREF]
99
+ <a href="#ISO7301">ISO 7301:2011, 3.1</a>
100
+ [/TERMREF]</p></div>
101
+ </div>
102
+ </body>
103
+ </html>
104
+ OUTPUT
105
+ end
106
+
107
+ it "processes IsoXML terms (Word)" do
108
+ expect(IsoDoc::Iec::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{^.*<div id="_terms_and_definitions">}m, '<div id="_terms_and_definitions">')).to be_equivalent_to <<~"OUTPUT"
109
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
110
+ <sections>
111
+ <terms id="_terms_and_definitions" obligation="normative"><title>Terms and Definitions</title>
112
+
113
+ <term id="paddy1"><preferred>paddy</preferred>
114
+ <domain>rice</domain>
115
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
116
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
117
+ <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
118
+ <ul>
119
+ <li>A</li>
120
+ </ul>
121
+ </termexample>
122
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
123
+ <ul>
124
+ <li>A</li>
125
+ </ul>
126
+ </termexample>
127
+
128
+ <termsource status="modified">
129
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
130
+ <modification>
131
+ <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
132
+ </modification>
133
+ </termsource></term>
134
+
135
+ <term id="paddy"><preferred>paddy</preferred><admitted>paddy rice</admitted>
136
+ <admitted>rough rice</admitted>
137
+ <deprecates>cargo rice</deprecates>
138
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
139
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
140
+ <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
141
+ </termnote>
142
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
143
+ <ul><li>A</li></ul>
144
+ <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
145
+ </termnote>
146
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
147
+ <ul>
148
+ <li>A</li>
149
+ </ul>
150
+ </termexample>
151
+ <termsource status="identical">
152
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
153
+ </termsource></term>
154
+ </terms>
155
+ </sections>
156
+ </iso-standard>
157
+ INPUT
158
+ <div id="_terms_and_definitions"><h1>1<span style="mso-tab-count:1">&#160; </span>Terms and definitions</h1><p>For the purposes of this document,
159
+ the following terms and definitions apply.</p>
160
+ <p>ISO and IEC maintain terminological databases for use in
161
+ standardization at the following addresses:</p>
162
+
163
+ <ul>
164
+ <li> <p>ISO Online browsing platform: available at
165
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
166
+ <li> <p>IEC Electropedia: available at
167
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
168
+ </p> </li> </ul>
169
+ <p class="TermNum" id="paddy1">1.1</p><p class="Terms" style="text-align:left;">paddy</p>
170
+
171
+ <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">&lt;rice&gt; rice retaining its husk after threshing</p>
172
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p><span class="example_label">EXAMPLE 1</span><span style="mso-tab-count:1">&#160; </span>Foreign seeds, husks, bran, sand, dust.</p><ul>
173
+ <li>A</li>
174
+ </ul></div>
175
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><p><span class="example_label">EXAMPLE 2</span><span style="mso-tab-count:1">&#160; </span></p>
176
+ <ul>
177
+ <li>A</li>
178
+ </ul>
179
+ </div>
180
+
181
+ <p>[TERMREF]
182
+ <a href="#ISO7301">ISO 7301:2011, 3.1</a>
183
+ [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
184
+ [/TERMREF]</p><p class="TermNum" id="paddy">1.2</p><p class="Terms" style="text-align:left;">paddy</p><p class="AltTerms" style="text-align:left;">paddy rice</p>
185
+ <p class="AltTerms" style="text-align:left;">rough rice</p>
186
+ <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
187
+ <div class="Note"><p class="Note">Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div>
188
+ <div class="Note"><p class="Note">Note 2 to entry: <ul><li>A</li></ul><p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></p></div>
189
+ <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
190
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p><span class="example_label">EXAMPLE</span><span style="mso-tab-count:1">&#160; </span></p>
191
+ <ul>
192
+ <li>A</li>
193
+ </ul>
194
+ </div>
195
+ <p>[TERMREF]
196
+ <a href="#ISO7301">ISO 7301:2011, 3.1</a>
197
+ [/TERMREF]</p></div>
198
+ </div>
199
+ <br clear="all" style="page-break-before:left;mso-break-type:section-break"/>
200
+ <div class="colophon"/>
201
+ </body>
202
+ </html>
203
+
204
+ OUTPUT
205
+ end
206
+ end
@@ -0,0 +1,1323 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "cross-references notes" do
5
+ expect(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true)). to be_equivalent_to <<~"OUTPUT"
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <preface>
8
+ <foreword>
9
+ <p>
10
+ <xref target="N"/>
11
+ <xref target="note1"/>
12
+ <xref target="note2"/>
13
+ <xref target="AN"/>
14
+ <xref target="Anote1"/>
15
+ <xref target="Anote2"/>
16
+ </p>
17
+ </foreword>
18
+ </preface>
19
+ <sections>
20
+ <clause id="scope"><title>Scope</title>
21
+ <note id="N">
22
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
23
+ </note>
24
+ <p><xref target="N"/></p>
25
+
26
+ </clause>
27
+ <terms id="terms"/>
28
+ <clause id="widgets"><title>Widgets</title>
29
+ <clause id="widgets1">
30
+ <note id="note1">
31
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
32
+ </note>
33
+ <note id="note2">
34
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
35
+ </note>
36
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
37
+
38
+ </clause>
39
+ </clause>
40
+ </sections>
41
+ <annex id="annex1">
42
+ <clause id="annex1a">
43
+ <note id="AN">
44
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
45
+ </note>
46
+ </clause>
47
+ <clause id="annex1b">
48
+ <note id="Anote1">
49
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
50
+ </note>
51
+ <note id="Anote2">
52
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
53
+ </note>
54
+ </clause>
55
+ </annex>
56
+ </iso-standard>
57
+ INPUT
58
+ #{HTML_HDR}
59
+ <div>
60
+ <h1 class="ForewordTitle">FOREWORD</h1>
61
+ <div class="boilerplate_legal"/>
62
+ <p>
63
+ <a href="#N">Clause 1, Note</a>
64
+ <a href="#note1">3.1, Note 1</a>
65
+ <a href="#note2">3.1, Note 2</a>
66
+ <a href="#AN">A.1, Note</a>
67
+ <a href="#Anote1">A.2, Note 1</a>
68
+ <a href="#Anote2">A.2, Note 2</a>
69
+ </p>
70
+ </div>
71
+ #{IEC_TITLE}
72
+ <div id="scope">
73
+ <h1>1&#160; Scope</h1>
74
+ <div id="N" class="Note">
75
+ <p><span class="note_label">NOTE</span>&#160; These results are based on a study carried out on three different types of kernel.</p>
76
+ </div>
77
+ <p>
78
+ <a href="#N">Note</a>
79
+ </p>
80
+ </div>
81
+ <div id="terms"><h1>2&#160; Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
82
+ <p>ISO and IEC maintain terminological databases for use in
83
+ standardization at the following addresses:</p>
84
+
85
+ <ul>
86
+ <li> <p>ISO Online browsing platform: available at
87
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
88
+ <li> <p>IEC Electropedia: available at
89
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
90
+ </p> </li> </ul>
91
+ </div>
92
+ <div id="widgets">
93
+ <h1>3&#160; Widgets</h1>
94
+ <div id="widgets1"><h2>3.1 </h2>
95
+ <div id="note1" class="Note"><p><span class="note_label">NOTE 1</span>&#160; These results are based on a study carried out on three different types of kernel.</p></div>
96
+ <div id="note2" class="Note"><p><span class="note_label">NOTE 2</span>&#160; These results are based on a study carried out on three different types of kernel.</p></div>
97
+ <p> <a href="#note1">Note 1</a> <a href="#note2">Note 2</a> </p>
98
+
99
+ </div>
100
+ </div>
101
+ <br/>
102
+ <div id="annex1" class="Section3">
103
+ <div id="annex1a"><h2>A.1 </h2>
104
+ <div id="AN" 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>
105
+ </div>
106
+ <div id="annex1b"><h2>A.2 </h2>
107
+ <div id="Anote1" class="Note"><p><span class="note_label">NOTE 1</span>&#160; These results are based on a study carried out on three different types of kernel.</p></div>
108
+ <div id="Anote2" class="Note"><p><span class="note_label">NOTE 2</span>&#160; These results are based on a study carried out on three different types of kernel.</p></div>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </body>
113
+ </html>
114
+ OUTPUT
115
+ end
116
+
117
+ it "cross-references figures" do
118
+ expect(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
119
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
120
+ <preface>
121
+ <foreword id="fwd">
122
+ <p>
123
+ <xref target="N"/>
124
+ <xref target="note1"/>
125
+ <xref target="note2"/>
126
+ <xref target="AN"/>
127
+ <xref target="Anote1"/>
128
+ <xref target="Anote2"/>
129
+ </p>
130
+ </foreword>
131
+ </preface>
132
+ <sections>
133
+ <clause id="scope"><title>Scope</title>
134
+ <figure id="N">
135
+ <name>Split-it-right sample divider</name>
136
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
137
+ </figure>
138
+ <p><xref target="N"/></p>
139
+ </clause>
140
+ <terms id="terms"/>
141
+ <clause id="widgets"><title>Widgets</title>
142
+ <clause id="widgets1">
143
+ <figure id="note1">
144
+ <name>Split-it-right sample divider</name>
145
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
146
+ </figure>
147
+ <figure id="note2">
148
+ <name>Split-it-right sample divider</name>
149
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
150
+ </figure>
151
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
152
+ </clause>
153
+ </clause>
154
+ </sections>
155
+ <annex id="annex1">
156
+ <clause id="annex1a">
157
+ <figure id="AN">
158
+ <name>Split-it-right sample divider</name>
159
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
160
+ </figure>
161
+ </clause>
162
+ <clause id="annex1b">
163
+ <figure id="Anote1">
164
+ <name>Split-it-right sample divider</name>
165
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
166
+ </figure>
167
+ <figure id="Anote2">
168
+ <name>Split-it-right sample divider</name>
169
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
170
+ </figure>
171
+ </clause>
172
+ </annex>
173
+ </iso-standard>
174
+ INPUT
175
+ #{HTML_HDR}
176
+ <div id="fwd">
177
+ <h1 class="ForewordTitle">FOREWORD</h1>
178
+ <div class="boilerplate_legal"/>
179
+ <p>
180
+ <a href="#N">Figure 1</a>
181
+ <a href="#note1">Figure 2</a>
182
+ <a href="#note2">Figure 3</a>
183
+ <a href="#AN">Figure A.1</a>
184
+ <a href="#Anote1">Figure A.2</a>
185
+ <a href="#Anote2">Figure A.3</a>
186
+ </p>
187
+ </div>
188
+ #{IEC_TITLE}
189
+ <div id="scope">
190
+ <h1>1&#160; Scope</h1>
191
+ <div id="N" class="figure">
192
+
193
+ <img src="rice_images/rice_image1.png" height="auto" width="auto"/>
194
+ <p class="FigureTitle" align="center">Figure 1&#160;&#8212; Split-it-right sample divider</p></div>
195
+ <p>
196
+ <a href="#N">Figure 1</a>
197
+ </p>
198
+ </div>
199
+ <div id="terms"><h1>2&#160; Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
200
+ <p>ISO and IEC maintain terminological databases for use in
201
+ standardization at the following addresses:</p>
202
+
203
+ <ul>
204
+ <li> <p>ISO Online browsing platform: available at
205
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
206
+ <li> <p>IEC Electropedia: available at
207
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
208
+ </p> </li> </ul>
209
+ </div>
210
+ <div id="widgets">
211
+ <h1>3&#160; Widgets</h1>
212
+ <div id="widgets1"><h2>3.1 </h2>
213
+ <div id="note1" class="figure">
214
+
215
+ <img src="rice_images/rice_image1.png" height="auto" width="auto"/>
216
+ <p class="FigureTitle" align="center">Figure 2&#160;&#8212; Split-it-right sample divider</p></div>
217
+ <div id="note2" class="figure">
218
+
219
+ <img src="rice_images/rice_image1.png" height="auto" width="auto"/>
220
+ <p class="FigureTitle" align="center">Figure 3&#160;&#8212; Split-it-right sample divider</p></div>
221
+ <p> <a href="#note1">Figure 2</a> <a href="#note2">Figure 3</a> </p>
222
+ </div>
223
+ </div>
224
+ <br/>
225
+ <div id="annex1" class="Section3">
226
+ <div id="annex1a"><h2>A.1 </h2>
227
+ <div id="AN" class="figure">
228
+
229
+ <img src="rice_images/rice_image1.png" height="auto" width="auto"/>
230
+ <p class="FigureTitle" align="center">Figure A.1&#160;&#8212; Split-it-right sample divider</p></div>
231
+ </div>
232
+ <div id="annex1b"><h2>A.2 </h2>
233
+ <div id="Anote1" class="figure">
234
+
235
+ <img src="rice_images/rice_image1.png" height="auto" width="auto"/>
236
+ <p class="FigureTitle" align="center">Figure A.2&#160;&#8212; Split-it-right sample divider</p></div>
237
+ <div id="Anote2" class="figure">
238
+
239
+ <img src="rice_images/rice_image1.png" height="auto" width="auto"/>
240
+ <p class="FigureTitle" align="center">Figure A.3&#160;&#8212; Split-it-right sample divider</p></div>
241
+ </div>
242
+ </div>
243
+ </div>
244
+ </body>
245
+ </html>
246
+ OUTPUT
247
+ end
248
+
249
+ it "cross-references subfigures" do
250
+ expect(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
251
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
252
+ <preface>
253
+ <foreword id="fwd">
254
+ <p>
255
+ <xref target="N"/>
256
+ <xref target="note1"/>
257
+ <xref target="note2"/>
258
+ <xref target="AN"/>
259
+ <xref target="Anote1"/>
260
+ <xref target="Anote2"/>
261
+ </p>
262
+ </foreword>
263
+ </preface>
264
+ <sections>
265
+ <clause id="scope"><title>Scope</title>
266
+ </clause>
267
+ <terms id="terms"/>
268
+ <clause id="widgets"><title>Widgets</title>
269
+ <clause id="widgets1">
270
+ <figure id="N">
271
+ <figure id="note1">
272
+ <name>Split-it-right sample divider</name>
273
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
274
+ </figure>
275
+ <figure id="note2">
276
+ <name>Split-it-right sample divider</name>
277
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
278
+ </figure>
279
+ </figure>
280
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
281
+ </clause>
282
+ </clause>
283
+ </sections>
284
+ <annex id="annex1">
285
+ <clause id="annex1a">
286
+ </clause>
287
+ <clause id="annex1b">
288
+ <figure id="AN">
289
+ <figure id="Anote1">
290
+ <name>Split-it-right sample divider</name>
291
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
292
+ </figure>
293
+ <figure id="Anote2">
294
+ <name>Split-it-right sample divider</name>
295
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
296
+ </figure>
297
+ </figure>
298
+ </clause>
299
+ </annex>
300
+ </iso-standard>
301
+ INPUT
302
+ #{HTML_HDR}
303
+ <div id="fwd">
304
+ <h1 class="ForewordTitle">FOREWORD</h1>
305
+ <div class="boilerplate_legal"/>
306
+ <p>
307
+ <a href="#N">Figure 1</a>
308
+ <a href="#note1">Figure 1-1</a>
309
+ <a href="#note2">Figure 1-2</a>
310
+ <a href="#AN">Figure A.1</a>
311
+ <a href="#Anote1">Figure A.1-1</a>
312
+ <a href="#Anote2">Figure A.1-2</a>
313
+ </p>
314
+ </div>
315
+ #{IEC_TITLE}
316
+ <div id="scope">
317
+ <h1>1&#160; Scope</h1>
318
+ </div>
319
+ <div id="terms"><h1>2&#160; Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
320
+ <p>ISO and IEC maintain terminological databases for use in
321
+ standardization at the following addresses:</p>
322
+
323
+ <ul>
324
+ <li> <p>ISO Online browsing platform: available at
325
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
326
+ <li> <p>IEC Electropedia: available at
327
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
328
+ </p> </li> </ul>
329
+ </div>
330
+ <div id="widgets">
331
+ <h1>3&#160; Widgets</h1>
332
+ <div id="widgets1"><h2>3.1 </h2>
333
+ <div id="N" class="figure">
334
+ <div id="note1" class="figure">
335
+
336
+ <img src="rice_images/rice_image1.png" height="auto" width="auto"/>
337
+ <p class="FigureTitle" align="center">Figure 1-1&#160;&#8212; Split-it-right sample divider</p></div>
338
+ <div id="note2" class="figure">
339
+
340
+ <img src="rice_images/rice_image1.png" height="auto" width="auto"/>
341
+ <p class="FigureTitle" align="center">Figure 1-2&#160;&#8212; Split-it-right sample divider</p></div>
342
+ </div>
343
+ <p> <a href="#note1">Figure 1-1</a> <a href="#note2">Figure 1-2</a> </p>
344
+ </div>
345
+ </div>
346
+ <br/>
347
+ <div id="annex1" class="Section3">
348
+ <div id="annex1a"><h2>A.1 </h2>
349
+ </div>
350
+ <div id="annex1b"><h2>A.2 </h2>
351
+ <div id="AN" class="figure">
352
+ <div id="Anote1" class="figure">
353
+
354
+ <img src="rice_images/rice_image1.png" height="auto" width="auto"/>
355
+ <p class="FigureTitle" align="center">Figure A.1-1&#160;&#8212; Split-it-right sample divider</p></div>
356
+ <div id="Anote2" class="figure">
357
+
358
+ <img src="rice_images/rice_image1.png" height="auto" width="auto"/>
359
+ <p class="FigureTitle" align="center">Figure A.1-2&#160;&#8212; Split-it-right sample divider</p></div>
360
+ </div>
361
+ </div>
362
+ </div>
363
+ </div>
364
+ </body>
365
+ </html>
366
+ OUTPUT
367
+ end
368
+
369
+ it "cross-references examples" do
370
+ expect(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
371
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
372
+ <preface>
373
+ <foreword>
374
+ <p>
375
+ <xref target="N"/>
376
+ <xref target="note1"/>
377
+ <xref target="note2"/>
378
+ <xref target="AN"/>
379
+ <xref target="Anote1"/>
380
+ <xref target="Anote2"/>
381
+ </p>
382
+ </foreword>
383
+ </preface>
384
+ <sections>
385
+ <clause id="scope"><title>Scope</title>
386
+ <example id="N">
387
+ <p>Hello</p>
388
+ </example>
389
+ <p><xref target="N"/></p>
390
+ </clause>
391
+ <terms id="terms"/>
392
+ <clause id="widgets"><title>Widgets</title>
393
+ <clause id="widgets1">
394
+ <example id="note1">
395
+ <p>Hello</p>
396
+ </example>
397
+ <example id="note2">
398
+ <p>Hello</p>
399
+ </example>
400
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
401
+ </clause>
402
+ </clause>
403
+ </sections>
404
+ <annex id="annex1">
405
+ <clause id="annex1a">
406
+ <example id="AN">
407
+ <p>Hello</p>
408
+ </example>
409
+ </clause>
410
+ <clause id="annex1b">
411
+ <example id="Anote1">
412
+ <p>Hello</p>
413
+ </example>
414
+ <example id="Anote2">
415
+ <p>Hello</p>
416
+ </example>
417
+ </clause>
418
+ </annex>
419
+ </iso-standard>
420
+ INPUT
421
+ #{HTML_HDR}
422
+ <div>
423
+ <h1 class="ForewordTitle">FOREWORD</h1>
424
+ <div class="boilerplate_legal"/>
425
+ <p>
426
+ <a href="#N">Clause 1, Example</a>
427
+ <a href="#note1">3.1, Example 1</a>
428
+ <a href="#note2">3.1, Example 2</a>
429
+ <a href="#AN">A.1, Example</a>
430
+ <a href="#Anote1">A.2, Example 1</a>
431
+ <a href="#Anote2">A.2, Example 2</a>
432
+ </p>
433
+ </div>
434
+ #{IEC_TITLE}
435
+ <div id="scope">
436
+ <h1>1&#160; Scope</h1>
437
+ <div id="N" class="example">
438
+ <p><span class="example_label">EXAMPLE</span>&#160; Hello</p>
439
+ </div>
440
+ <p>
441
+ <a href="#N">Example</a>
442
+ </p>
443
+ </div>
444
+ <div id="terms"><h1>2&#160; Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
445
+ <p>ISO and IEC maintain terminological databases for use in
446
+ standardization at the following addresses:</p>
447
+ <ul>
448
+ <li> <p>ISO Online browsing platform: available at
449
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
450
+ <li> <p>IEC Electropedia: available at
451
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
452
+ </p> </li> </ul>
453
+ </div>
454
+ <div id="widgets">
455
+ <h1>3&#160; Widgets</h1>
456
+ <div id="widgets1"><h2>3.1 </h2>
457
+ <div id="note1" class="example"><p><span class="example_label">EXAMPLE 1</span>&#160; Hello</p></div>
458
+ <div id="note2" class="example"><p><span class="example_label">EXAMPLE 2</span>&#160; Hello</p></div>
459
+ <p> <a href="#note1">Example 1</a> <a href="#note2">Example 2</a> </p>
460
+ </div>
461
+ </div>
462
+ <br/>
463
+ <div id="annex1" class="Section3">
464
+ <div id="annex1a"><h2>A.1 </h2>
465
+ <div id="AN" class="example"><p><span class="example_label">EXAMPLE</span>&#160; Hello</p></div>
466
+ </div>
467
+ <div id="annex1b"><h2>A.2 </h2>
468
+ <div id="Anote1" class="example"><p><span class="example_label">EXAMPLE 1</span>&#160; Hello</p></div>
469
+ <div id="Anote2" class="example"><p><span class="example_label">EXAMPLE 2</span>&#160; Hello</p></div>
470
+ </div>
471
+ </div>
472
+ </div>
473
+ </body>
474
+ </html>
475
+
476
+ OUTPUT
477
+ end
478
+
479
+ it "cross-references formulae" do
480
+ expect(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
481
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
482
+ <preface>
483
+ <foreword>
484
+ <p>
485
+ <xref target="N"/>
486
+ <xref target="note1"/>
487
+ <xref target="note2"/>
488
+ <xref target="AN"/>
489
+ <xref target="Anote1"/>
490
+ <xref target="Anote2"/>
491
+ </p>
492
+ </foreword>
493
+ </preface>
494
+ <sections>
495
+ <clause id="scope"><title>Scope</title>
496
+ <formula id="N">
497
+ <stem type="AsciiMath">r = 1 %</stem>
498
+ </formula>
499
+ <p><xref target="N"/></p>
500
+ </clause>
501
+ <terms id="terms"/>
502
+ <clause id="widgets"><title>Widgets</title>
503
+ <clause id="widgets1">
504
+ <formula id="note1">
505
+ <stem type="AsciiMath">r = 1 %</stem>
506
+ </formula>
507
+ <formula id="note2">
508
+ <stem type="AsciiMath">r = 1 %</stem>
509
+ </formula>
510
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
511
+ </clause>
512
+ </clause>
513
+ </sections>
514
+ <annex id="annex1">
515
+ <clause id="annex1a">
516
+ <formula id="AN">
517
+ <stem type="AsciiMath">r = 1 %</stem>
518
+ </formula>
519
+ </clause>
520
+ <clause id="annex1b">
521
+ <formula id="Anote1">
522
+ <stem type="AsciiMath">r = 1 %</stem>
523
+ </formula>
524
+ <formula id="Anote2">
525
+ <stem type="AsciiMath">r = 1 %</stem>
526
+ </formula>
527
+ </clause>
528
+ </annex>
529
+ </iso-standard>
530
+
531
+ <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934">
532
+ <stem type="AsciiMath">r = 1 %</stem>
533
+ <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
534
+ <dt>
535
+ <stem type="AsciiMath">r</stem>
536
+ </dt>
537
+ <dd>
538
+ <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
539
+ </dd>
540
+ </dl></formula>
541
+ </foreword>
542
+ </preface>
543
+ </iso-standard>
544
+ INPUT
545
+ #{HTML_HDR}
546
+ <div>
547
+ <h1 class="ForewordTitle">FOREWORD</h1>
548
+ <div class="boilerplate_legal"/>
549
+ <p>
550
+ <a href="#N">Clause 1, Formula (1)</a>
551
+ <a href="#note1">3.1, Formula (2)</a>
552
+ <a href="#note2">3.1, Formula (3)</a>
553
+ <a href="#AN">A.1, Formula (A.1)</a>
554
+ <a href="#Anote1">A.2, Formula (A.2)</a>
555
+ <a href="#Anote2">A.2, Formula (A.3)</a>
556
+ </p>
557
+ </div>
558
+ #{IEC_TITLE}
559
+ <div id="scope">
560
+ <h1>1&#160; Scope</h1>
561
+ <div id="N" class="formula"><p><span class="stem">(#(r = 1 %)#)</span>&#160; (1)</p></div>
562
+ <p>
563
+ <a href="#N">Formula (1)</a>
564
+ </p>
565
+ </div>
566
+ <div id="terms"><h1>2&#160; Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
567
+ <p>ISO and IEC maintain terminological databases for use in
568
+ standardization at the following addresses:</p>
569
+
570
+ <ul>
571
+ <li> <p>ISO Online browsing platform: available at
572
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
573
+ <li> <p>IEC Electropedia: available at
574
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
575
+ </p> </li> </ul>
576
+ </div>
577
+ <div id="widgets">
578
+ <h1>3&#160; Widgets</h1>
579
+ <div id="widgets1"><h2>3.1 </h2>
580
+ <div id="note1" class="formula"><p><span class="stem">(#(r = 1 %)#)</span>&#160; (2)</p></div>
581
+ <div id="note2" class="formula"><p><span class="stem">(#(r = 1 %)#)</span>&#160; (3)</p></div>
582
+ <p> <a href="#note1">Formula (2)</a> <a href="#note2">Formula (3)</a> </p>
583
+ </div>
584
+ </div>
585
+ <br/>
586
+ <div id="annex1" class="Section3">
587
+ <div id="annex1a"><h2>A.1 </h2>
588
+ <div id="AN" class="formula"><p><span class="stem">(#(r = 1 %)#)</span>&#160; (A.1)</p></div>
589
+ </div>
590
+ <div id="annex1b"><h2>A.2 </h2>
591
+ <div id="Anote1" class="formula"><p><span class="stem">(#(r = 1 %)#)</span>&#160; (A.2)</p></div>
592
+ <div id="Anote2" class="formula"><p><span class="stem">(#(r = 1 %)#)</span>&#160; (A.3)</p></div>
593
+ </div>
594
+ </div>
595
+ </div>
596
+ </body>
597
+ </html>
598
+ OUTPUT
599
+ end
600
+
601
+ it "cross-references tables" do
602
+ expect(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
603
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
604
+ <preface>
605
+ <foreword>
606
+ <p>
607
+ <xref target="N"/>
608
+ <xref target="note1"/>
609
+ <xref target="note2"/>
610
+ <xref target="AN"/>
611
+ <xref target="Anote1"/>
612
+ <xref target="Anote2"/>
613
+ </p>
614
+ </foreword>
615
+ </preface>
616
+ <sections>
617
+ <clause id="scope"><title>Scope</title>
618
+ <table id="N">
619
+ <name>Repeatability and reproducibility of husked rice yield</name>
620
+ <tbody>
621
+ <tr>
622
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
623
+ <td align="center">13</td>
624
+ <td align="center">11</td>
625
+ </tr>
626
+ </tbody>
627
+ </table>
628
+ <p><xref target="N"/></p>
629
+ </clause>
630
+ <terms id="terms"/>
631
+ <clause id="widgets"><title>Widgets</title>
632
+ <clause id="widgets1">
633
+ <table id="note1">
634
+ <name>Repeatability and reproducibility of husked rice yield</name>
635
+ <tbody>
636
+ <tr>
637
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
638
+ <td align="center">13</td>
639
+ <td align="center">11</td>
640
+ </tr>
641
+ </tbody>
642
+ </table>
643
+ <table id="note2">
644
+ <name>Repeatability and reproducibility of husked rice yield</name>
645
+ <tbody>
646
+ <tr>
647
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
648
+ <td align="center">13</td>
649
+ <td align="center">11</td>
650
+ </tr>
651
+ </tbody>
652
+ </table>
653
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
654
+ </clause>
655
+ </clause>
656
+ </sections>
657
+ <annex id="annex1">
658
+ <clause id="annex1a">
659
+ <table id="AN">
660
+ <name>Repeatability and reproducibility of husked rice yield</name>
661
+ <tbody>
662
+ <tr>
663
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
664
+ <td align="center">13</td>
665
+ <td align="center">11</td>
666
+ </tr>
667
+ </tbody>
668
+ </table>
669
+ </clause>
670
+ <clause id="annex1b">
671
+ <table id="Anote1">
672
+ <name>Repeatability and reproducibility of husked rice yield</name>
673
+ <tbody>
674
+ <tr>
675
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
676
+ <td align="center">13</td>
677
+ <td align="center">11</td>
678
+ </tr>
679
+ </tbody>
680
+ </table>
681
+ <table id="Anote2">
682
+ <name>Repeatability and reproducibility of husked rice yield</name>
683
+ <tbody>
684
+ <tr>
685
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
686
+ <td align="center">13</td>
687
+ <td align="center">11</td>
688
+ </tr>
689
+ </tbody>
690
+ </table>
691
+ </clause>
692
+ </annex>
693
+ </iso-standard>
694
+ INPUT
695
+ #{HTML_HDR}
696
+ <div>
697
+ <h1 class="ForewordTitle">FOREWORD</h1>
698
+ <div class="boilerplate_legal"/>
699
+ <p>
700
+ <a href="#N">Table 1</a>
701
+ <a href="#note1">Table 2</a>
702
+ <a href="#note2">Table 3</a>
703
+ <a href="#AN">Table A.1</a>
704
+ <a href="#Anote1">Table A.2</a>
705
+ <a href="#Anote2">Table A.3</a>
706
+ </p>
707
+ </div>
708
+ #{IEC_TITLE}
709
+ <div id="scope">
710
+ <h1>1&#160; Scope</h1>
711
+ <p class="TableTitle" align="center">
712
+ Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield
713
+ </p>
714
+ <table id="N" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
715
+ <tbody>
716
+ <tr>
717
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Number of laboratories retained after eliminating outliers</td>
718
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">13</td>
719
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">11</td>
720
+ </tr>
721
+ </tbody>
722
+ </table>
723
+ <p>
724
+ <a href="#N">Table 1</a>
725
+ </p>
726
+ </div>
727
+ <div id="terms"><h1>2&#160; Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
728
+ <p>ISO and IEC maintain terminological databases for use in
729
+ standardization at the following addresses:</p>
730
+
731
+ <ul>
732
+ <li> <p>ISO Online browsing platform: available at
733
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
734
+ <li> <p>IEC Electropedia: available at
735
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
736
+ </p> </li> </ul>
737
+ </div>
738
+ <div id="widgets">
739
+ <h1>3&#160; Widgets</h1>
740
+ <div id="widgets1"><h2>3.1 </h2>
741
+ <p class="TableTitle" align="center">Table 2&#160;&#8212; Repeatability and reproducibility of husked rice yield</p><table id="note1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Number of laboratories retained after eliminating outliers</td><td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">13</td><td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">11</td></tr></tbody></table>
742
+ <p class="TableTitle" align="center">Table 3&#160;&#8212; Repeatability and reproducibility of husked rice yield</p><table id="note2" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Number of laboratories retained after eliminating outliers</td><td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">13</td><td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">11</td></tr></tbody></table>
743
+ <p> <a href="#note1">Table 2</a> <a href="#note2">Table 3</a> </p>
744
+ </div>
745
+ </div>
746
+ <br/>
747
+ <div id="annex1" class="Section3">
748
+ <div id="annex1a"><h2>A.1 </h2>
749
+ <p class="TableTitle" align="center">Table A.1&#160;&#8212; Repeatability and reproducibility of husked rice yield</p><table id="AN" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Number of laboratories retained after eliminating outliers</td><td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">13</td><td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">11</td></tr></tbody></table>
750
+ </div>
751
+ <div id="annex1b"><h2>A.2 </h2>
752
+ <p class="TableTitle" align="center">Table A.2&#160;&#8212; Repeatability and reproducibility of husked rice yield</p><table id="Anote1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Number of laboratories retained after eliminating outliers</td><td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">13</td><td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">11</td></tr></tbody></table>
753
+ <p class="TableTitle" align="center">Table A.3&#160;&#8212; Repeatability and reproducibility of husked rice yield</p><table id="Anote2" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Number of laboratories retained after eliminating outliers</td><td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">13</td><td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">11</td></tr></tbody></table>
754
+ </div>
755
+ </div>
756
+ </div>
757
+ </body>
758
+ </html>
759
+ OUTPUT
760
+ end
761
+
762
+ it "cross-references term notes" do
763
+ expect(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
764
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
765
+ <preface>
766
+ <foreword>
767
+ <p>
768
+ <xref target="note1"/>
769
+ <xref target="note2"/>
770
+ <xref target="note3"/>
771
+ </p>
772
+ </foreword>
773
+ </preface>
774
+ <sections>
775
+ <clause id="scope"><title>Scope</title>
776
+ </clause>
777
+ <terms id="terms">
778
+ <term id="_waxy_rice"><preferred>waxy rice</preferred>
779
+ <termnote id="note1">
780
+ <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
781
+ </termnote></term>
782
+ <term id="_nonwaxy_rice"><preferred>nonwaxy rice</preferred>
783
+ <termnote id="note2">
784
+ <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
785
+ </termnote>
786
+ <termnote id="note3">
787
+ <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
788
+ </termnote></term>
789
+ </terms>
790
+
791
+ </iso-standard>
792
+ INPUT
793
+ #{HTML_HDR}
794
+ <div>
795
+ <h1 class="ForewordTitle">FOREWORD</h1>
796
+ <div class="boilerplate_legal"/>
797
+ <p>
798
+ <a href="#note1">2.1, Note 1</a>
799
+ <a href="#note2">2.2, Note 1</a>
800
+ <a href="#note3">2.2, Note 2</a>
801
+ </p>
802
+ </div>
803
+ #{IEC_TITLE}
804
+ <div id="scope">
805
+ <h1>1&#160; Scope</h1>
806
+ </div>
807
+ <div id="terms"><h1>2&#160; Terms and definitions</h1><p>For the purposes of this document,
808
+ the following terms and definitions apply.</p>
809
+ <p>ISO and IEC maintain terminological databases for use in
810
+ standardization at the following addresses:</p>
811
+
812
+ <ul>
813
+ <li> <p>ISO Online browsing platform: available at
814
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
815
+ <li> <p>IEC Electropedia: available at
816
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
817
+ </p> </li> </ul>
818
+ <p class="TermNum" id="_waxy_rice">2.1</p><p class="Terms" style="text-align:left;">waxy rice</p>
819
+ <div class="Note"><p>Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div><p class="TermNum" id="_nonwaxy_rice">2.2</p><p class="Terms" style="text-align:left;">nonwaxy rice</p>
820
+ <div class="Note"><p>Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div>
821
+ <div class="Note"><p>Note 2 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div></div>
822
+ </div>
823
+ </body>
824
+ </html>
825
+ OUTPUT
826
+ end
827
+
828
+ it "cross-references sections" do
829
+ expect(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
830
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
831
+ <preface>
832
+ <foreword obligation="informative">
833
+ <title>Foreword</title>
834
+ <p id="A">This is a preamble
835
+ <xref target="C"/>
836
+ <xref target="C1"/>
837
+ <xref target="D"/>
838
+ <xref target="H"/>
839
+ <xref target="I"/>
840
+ <xref target="J"/>
841
+ <xref target="K"/>
842
+ <xref target="L"/>
843
+ <xref target="M"/>
844
+ <xref target="N"/>
845
+ <xref target="O"/>
846
+ <xref target="P"/>
847
+ <xref target="Q"/>
848
+ <xref target="Q1"/>
849
+ <xref target="Q2"/>
850
+ <xref target="R"/>
851
+ </p>
852
+ </foreword>
853
+ <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
854
+ <title>Introduction Subsection</title>
855
+ </clause>
856
+ <clause id="C1" inline-header="false" obligation="informative">Text</clause>
857
+ </introduction></preface><sections>
858
+ <clause id="D" obligation="normative">
859
+ <title>Scope</title>
860
+ <p id="E">Text</p>
861
+ </clause>
862
+
863
+ <terms id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
864
+ <title>Normal Terms</title>
865
+ <term id="J">
866
+ <preferred>Term2</preferred>
867
+ </term>
868
+ </terms>
869
+ <definitions id="K">
870
+ <dl>
871
+ <dt>Symbol</dt>
872
+ <dd>Definition</dd>
873
+ </dl>
874
+ </definitions>
875
+ </terms>
876
+ <definitions id="L">
877
+ <dl>
878
+ <dt>Symbol</dt>
879
+ <dd>Definition</dd>
880
+ </dl>
881
+ </definitions>
882
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
883
+ <title>Introduction</title>
884
+ </clause>
885
+ <clause id="O" inline-header="false" obligation="normative">
886
+ <title>Clause 4.2</title>
887
+ </clause></clause>
888
+
889
+ </sections><annex id="P" inline-header="false" obligation="normative">
890
+ <title>Annex</title>
891
+ <clause id="Q" inline-header="false" obligation="normative">
892
+ <title>Annex A.1</title>
893
+ <clause id="Q1" inline-header="false" obligation="normative">
894
+ <title>Annex A.1a</title>
895
+ </clause>
896
+ </clause>
897
+ <appendix id="Q2" inline-header="false" obligation="normative">
898
+ <title>An Appendix</title>
899
+ </appendix>
900
+ </annex><bibliography><references id="R" obligation="informative">
901
+ <title>Normative References</title>
902
+ </references><clause id="S" obligation="informative">
903
+ <title>Bibliography</title>
904
+ <references id="T" obligation="informative">
905
+ <title>Bibliography Subsection</title>
906
+ </references>
907
+ </clause>
908
+ </bibliography>
909
+ </iso-standard>
910
+ INPUT
911
+ #{HTML_HDR}
912
+ <div>
913
+ <h1 class="ForewordTitle">FOREWORD</h1>
914
+ <div class="boilerplate_legal"/>
915
+ <p id="A">This is a preamble
916
+ <a href="#C">0.1</a>
917
+ <a href="#C1">0.2</a>
918
+ <a href="#D">Clause 1</a>
919
+ <a href="#H">Clause 3</a>
920
+ <a href="#I">3.1</a>
921
+ <a href="#J">3.1.1</a>
922
+ <a href="#K">3.2</a>
923
+ <a href="#L">Clause 4</a>
924
+ <a href="#M">Clause 5</a>
925
+ <a href="#N">5.1</a>
926
+ <a href="#O">5.2</a>
927
+ <a href="#P">Annex A</a>
928
+ <a href="#Q">A.1</a>
929
+ <a href="#Q1">A.1.1</a>
930
+ <a href="#Q2">Annex A, Appendix 1</a>
931
+ <a href="#R">Clause 2</a>
932
+ </p>
933
+ </div>
934
+ <br/>
935
+ <div class="Section3" id="B">
936
+ <h1 class="IntroTitle">0&#160; INTRODUCTION</h1>
937
+ <div id="C">
938
+ <h2>0.1 Introduction Subsection</h2>
939
+ </div>
940
+ <div id="C1"><h2>0.2 </h2>Text</div>
941
+ </div>
942
+ #{IEC_TITLE}
943
+ <div id="D">
944
+ <h1>1&#160; Scope</h1>
945
+ <p id="E">Text</p>
946
+ </div>
947
+ <div>
948
+ <h1>2&#160; Normative references</h1>
949
+ <p>There are no normative references in this document.</p>
950
+ </div>
951
+ <div id="H"><h1>3&#160; Terms, definitions, symbols and abbreviated terms</h1><p>For the purposes of this document,
952
+ the following terms and definitions apply.</p>
953
+ <p>ISO and IEC maintain terminological databases for use in
954
+ standardization at the following addresses:</p>
955
+
956
+ <ul>
957
+ <li> <p>ISO Online browsing platform: available at
958
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
959
+ <li> <p>IEC Electropedia: available at
960
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
961
+ </p> </li> </ul>
962
+ <div id="I">
963
+ <h2>3.1 Normal Terms</h2>
964
+ <p class="TermNum" id="J">3.1.1</p>
965
+ <p class="Terms" style="text-align:left;">Term2</p>
966
+
967
+ </div><div id="K"><h2>3.2 Symbols and abbreviated terms</h2>
968
+ <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
969
+ </div></div>
970
+ <div id="L" class="Symbols">
971
+ <h1>4&#160; Symbols and abbreviated terms</h1>
972
+ <dl>
973
+ <dt>
974
+ <p>Symbol</p>
975
+ </dt>
976
+ <dd>Definition</dd>
977
+ </dl>
978
+ </div>
979
+ <div id="M">
980
+ <h1>5&#160; Clause 4</h1>
981
+ <div id="N">
982
+ <h2>5.1 Introduction</h2>
983
+ </div>
984
+ <div id="O">
985
+ <h2>5.2 Clause 4.2</h2>
986
+ </div>
987
+ </div>
988
+ <br/>
989
+ <div id="P" class="Section3">
990
+ <h1 class="Annex"><b>Annex A</b><br/><br/>(normative)<br/><br/><b>Annex</b></h1>
991
+ <div id="Q">
992
+ <h2>A.1 Annex A.1</h2>
993
+ <div id="Q1">
994
+ <h3>A.1.1 Annex A.1a</h3>
995
+ </div>
996
+ </div>
997
+ <div id="Q2">
998
+ <h2>Appendix 1 An Appendix</h2>
999
+ </div>
1000
+ </div>
1001
+ <br/>
1002
+ <div>
1003
+ <h1 class="Section3">Bibliography</h1>
1004
+ <div>
1005
+ <h2 class="Section3">Bibliography Subsection</h2>
1006
+ </div>
1007
+ </div>
1008
+ </div>
1009
+ </body>
1010
+ </html>
1011
+ OUTPUT
1012
+ end
1013
+
1014
+ it "cross-references lists" do
1015
+ expect(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
1016
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1017
+ <preface>
1018
+ <foreword>
1019
+ <p>
1020
+ <xref target="N"/>
1021
+ <xref target="note1"/>
1022
+ <xref target="note2"/>
1023
+ <xref target="AN"/>
1024
+ <xref target="Anote1"/>
1025
+ <xref target="Anote2"/>
1026
+ </p>
1027
+ </foreword>
1028
+ </preface>
1029
+ <sections>
1030
+ <clause id="scope"><title>Scope</title>
1031
+ <ol id="N">
1032
+ <li><p>A</p></li>
1033
+ </ol>
1034
+ </clause>
1035
+ <terms id="terms"/>
1036
+ <clause id="widgets"><title>Widgets</title>
1037
+ <clause id="widgets1">
1038
+ <ol id="note1">
1039
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1040
+ </ol>
1041
+ <ol id="note2">
1042
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
1043
+ </ol>
1044
+ </clause>
1045
+ </clause>
1046
+ </sections>
1047
+ <annex id="annex1">
1048
+ <clause id="annex1a">
1049
+ <ol id="AN">
1050
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1051
+ </ol>
1052
+ </clause>
1053
+ <clause id="annex1b">
1054
+ <ol id="Anote1">
1055
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1056
+ </ol>
1057
+ <ol id="Anote2">
1058
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
1059
+ </ol>
1060
+ </clause>
1061
+ </annex>
1062
+ </iso-standard>
1063
+ INPUT
1064
+ #{HTML_HDR}
1065
+ <div>
1066
+ <h1 class="ForewordTitle">FOREWORD</h1>
1067
+ <div class="boilerplate_legal"/>
1068
+ <p>
1069
+ <a href="#N">Clause 1, List</a>
1070
+ <a href="#note1">3.1, List 1</a>
1071
+ <a href="#note2">3.1, List 2</a>
1072
+ <a href="#AN">A.1, List</a>
1073
+ <a href="#Anote1">A.2, List 1</a>
1074
+ <a href="#Anote2">A.2, List 2</a>
1075
+ </p>
1076
+ </div>
1077
+ #{IEC_TITLE}
1078
+ <div id="scope">
1079
+ <h1>1&#160; Scope</h1>
1080
+ <ol type="a" id="N">
1081
+ <li><p>A</p></li>
1082
+ </ol>
1083
+ </div>
1084
+ <div id="terms"><h1>2&#160; Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
1085
+ <p>ISO and IEC maintain terminological databases for use in
1086
+ standardization at the following addresses:</p>
1087
+
1088
+ <ul>
1089
+ <li> <p>ISO Online browsing platform: available at
1090
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
1091
+ <li> <p>IEC Electropedia: available at
1092
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
1093
+ </p> </li> </ul>
1094
+ </div>
1095
+ <div id="widgets">
1096
+ <h1>3&#160; Widgets</h1>
1097
+ <div id="widgets1"><h2>3.1 </h2>
1098
+ <ol type="a" id="note1">
1099
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1100
+ </ol>
1101
+ <ol type="a" id="note2">
1102
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
1103
+ </ol>
1104
+ </div>
1105
+ </div>
1106
+ <br/>
1107
+ <div id="annex1" class="Section3">
1108
+ <div id="annex1a"><h2>A.1 </h2>
1109
+ <ol type="a" id="AN">
1110
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1111
+ </ol>
1112
+ </div>
1113
+ <div id="annex1b"><h2>A.2 </h2>
1114
+ <ol type="a" id="Anote1">
1115
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1116
+ </ol>
1117
+ <ol type="a" id="Anote2">
1118
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
1119
+ </ol>
1120
+ </div>
1121
+ </div>
1122
+ </div>
1123
+ </body>
1124
+ </html>
1125
+
1126
+ OUTPUT
1127
+ end
1128
+
1129
+ it "cross-references list items" do
1130
+ expect(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
1131
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1132
+ <preface>
1133
+ <foreword>
1134
+ <p>
1135
+ <xref target="N"/>
1136
+ <xref target="note1"/>
1137
+ <xref target="note2"/>
1138
+ <xref target="AN"/>
1139
+ <xref target="Anote1"/>
1140
+ <xref target="Anote2"/>
1141
+ </p>
1142
+ </foreword>
1143
+ </preface>
1144
+ <sections>
1145
+ <clause id="scope"><title>Scope</title>
1146
+ <ol id="N1">
1147
+ <li id="N"><p>A</p></li>
1148
+ </ol>
1149
+ </clause>
1150
+ <terms id="terms"/>
1151
+ <clause id="widgets"><title>Widgets</title>
1152
+ <clause id="widgets1">
1153
+ <ol id="note1l">
1154
+ <li id="note1"><p>A</p></li>
1155
+ </ol>
1156
+ <ol id="note2l">
1157
+ <li id="note2"><p>A</p></li>
1158
+ </ol>
1159
+ </clause>
1160
+ </clause>
1161
+ </sections>
1162
+ <annex id="annex1">
1163
+ <clause id="annex1a">
1164
+ <ol id="ANl">
1165
+ <li id="AN"><p>A</p></li>
1166
+ </ol>
1167
+ </clause>
1168
+ <clause id="annex1b">
1169
+ <ol id="Anote1l">
1170
+ <li id="Anote1"><p>A</p></li>
1171
+ </ol>
1172
+ <ol id="Anote2l">
1173
+ <li id="Anote2"><p>A</p></li>
1174
+ </ol>
1175
+ </clause>
1176
+ </annex>
1177
+ </iso-standard>
1178
+ INPUT
1179
+ #{HTML_HDR}
1180
+ <div>
1181
+ <h1 class="ForewordTitle">FOREWORD</h1>
1182
+ <div class="boilerplate_legal"/>
1183
+ <p>
1184
+ <a href="#N">Clause 1 a)</a>
1185
+ <a href="#note1">3.1 List 1 a)</a>
1186
+ <a href="#note2">3.1 List 2 a)</a>
1187
+ <a href="#AN">A.1 a)</a>
1188
+ <a href="#Anote1">A.2 List 1 a)</a>
1189
+ <a href="#Anote2">A.2 List 2 a)</a>
1190
+ </p>
1191
+ </div>
1192
+ #{IEC_TITLE}
1193
+ <div id="scope">
1194
+ <h1>1&#160; Scope</h1>
1195
+ <ol type="a" id="N1">
1196
+ <li id="N"><p>A</p></li>
1197
+ </ol>
1198
+ </div>
1199
+ <div id="terms"><h1>2&#160; Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
1200
+ <p>ISO and IEC maintain terminological databases for use in
1201
+ standardization at the following addresses:</p>
1202
+
1203
+ <ul>
1204
+ <li> <p>ISO Online browsing platform: available at
1205
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
1206
+ <li> <p>IEC Electropedia: available at
1207
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
1208
+ </p> </li> </ul>
1209
+ </div>
1210
+ <div id="widgets">
1211
+ <h1>3&#160; Widgets</h1>
1212
+ <div id="widgets1"><h2>3.1 </h2>
1213
+ <ol type="a" id="note1l">
1214
+ <li id="note1"><p>A</p></li>
1215
+ </ol>
1216
+ <ol type="a" id="note2l">
1217
+ <li id="note2"><p>A</p></li>
1218
+ </ol>
1219
+ </div>
1220
+ </div>
1221
+ <br/>
1222
+ <div id="annex1" class="Section3">
1223
+ <div id="annex1a"><h2>A.1 </h2>
1224
+ <ol type="a" id="ANl">
1225
+ <li id="AN"><p>A</p></li>
1226
+ </ol>
1227
+ </div>
1228
+ <div id="annex1b"><h2>A.2 </h2>
1229
+ <ol type="a" id="Anote1l">
1230
+ <li id="Anote1"><p>A</p></li>
1231
+ </ol>
1232
+ <ol type="a" id="Anote2l">
1233
+ <li id="Anote2"><p>A</p></li>
1234
+ </ol>
1235
+ </div>
1236
+ </div>
1237
+ </div>
1238
+ </body>
1239
+ </html>
1240
+ OUTPUT
1241
+ end
1242
+
1243
+ it "cross-references nested list items" do
1244
+ expect(IsoDoc::Iec::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
1245
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1246
+ <preface>
1247
+ <foreword>
1248
+ <p>
1249
+ <xref target="N"/>
1250
+ <xref target="note1"/>
1251
+ <xref target="note2"/>
1252
+ <xref target="AN"/>
1253
+ <xref target="Anote1"/>
1254
+ <xref target="Anote2"/>
1255
+ </p>
1256
+ </foreword>
1257
+ </preface>
1258
+ <sections>
1259
+ <clause id="scope"><title>Scope</title>
1260
+ <ol id="N1">
1261
+ <li id="N"><p>A</p>
1262
+ <ol>
1263
+ <li id="note1"><p>A</p>
1264
+ <ol>
1265
+ <li id="note2"><p>A</p>
1266
+ <ol>
1267
+ <li id="AN"><p>A</p>
1268
+ <ol>
1269
+ <li id="Anote1"><p>A</p>
1270
+ <ol>
1271
+ <li id="Anote2"><p>A</p></li>
1272
+ </ol></li>
1273
+ </ol></li>
1274
+ </ol></li>
1275
+ </ol></li>
1276
+ </ol></li>
1277
+ </ol>
1278
+ </clause>
1279
+ </sections>
1280
+ </iso-standard>
1281
+ INPUT
1282
+ #{HTML_HDR}
1283
+ <div>
1284
+ <h1 class="ForewordTitle">FOREWORD</h1>
1285
+ <div class="boilerplate_legal"/>
1286
+ <p>
1287
+ <a href="#N">Clause 1 a)</a>
1288
+ <a href="#note1">Clause 1 a.1)</a>
1289
+ <a href="#note2">Clause 1 a.1.i)</a>
1290
+ <a href="#AN">Clause 1 a.1.i.A)</a>
1291
+ <a href="#Anote1">Clause 1 a.1.i.A.I)</a>
1292
+ <a href="#Anote2">Clause 1 a.1.i.A.I.a)</a>
1293
+ </p>
1294
+ </div>
1295
+ #{IEC_TITLE}
1296
+ <div id="scope">
1297
+ <h1>1&#160; Scope</h1>
1298
+ <ol type="a" id="N1">
1299
+ <li id="N"><p>A</p>
1300
+ <ol type="1">
1301
+ <li id="note1"><p>A</p>
1302
+ <ol type="i">
1303
+ <li id="note2"><p>A</p>
1304
+ <ol type="A">
1305
+ <li id="AN"><p>A</p>
1306
+ <ol type="I">
1307
+ <li id="Anote1"><p>A</p>
1308
+ <ol type="a">
1309
+ <li id="Anote2"><p>A</p></li>
1310
+ </ol></li>
1311
+ </ol></li>
1312
+ </ol></li>
1313
+ </ol></li>
1314
+ </ol></li>
1315
+ </ol>
1316
+ </div>
1317
+ </div>
1318
+ </body>
1319
+ </html>
1320
+ OUTPUT
1321
+ end
1322
+
1323
+ end