isodoc 0.4.5 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,135 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "processes IsoXML tables" do
5
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <foreword>
8
+ <table id="tableD-1">
9
+ <name>Repeatability and reproducibility of husked rice yield</name>
10
+ <thead>
11
+ <tr>
12
+ <td rowspan="2" align="left">Description</td>
13
+ <td colspan="4" align="center">Rice sample</td>
14
+ </tr>
15
+ <tr>
16
+ <td align="left">Arborio</td>
17
+ <td align="center">Drago<fn reference="a">
18
+ <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
19
+ </fn></td>
20
+ <td align="center">Balilla</td>
21
+ <td align="center">Thaibonnet</td>
22
+ </tr>
23
+ </thead>
24
+ <tbody>
25
+ <tr>
26
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
27
+ <td align="center">13</td>
28
+ <td align="center">11</td>
29
+ <td align="center">13</td>
30
+ <td align="center">13</td>
31
+ </tr>
32
+ <tr>
33
+ <td align="left">Mean value, g/100 g</td>
34
+ <td align="center">81,2</td>
35
+ <td align="center">82,0</td>
36
+ <td align="center">81,8</td>
37
+ <td align="center">77,7</td>
38
+ </tr>
39
+ </tbody>
40
+ <tfoot>
41
+ <tr>
42
+ <td align="left">Reproducibility limit, <stem type="AsciiMath">R</stem> (= 2,83 <stem type="AsciiMath">s_R</stem>)</td>
43
+ <td align="center">2,89</td>
44
+ <td align="center">0,57</td>
45
+ <td align="center">2,26</td>
46
+ <td align="center">6,06</td>
47
+ </tr>
48
+ </tfoot>
49
+ <dl>
50
+ <dt>Drago</dt>
51
+ <dd>A type of rice</dd>
52
+ </dl>
53
+ <note><p>This is a table about rice</p></note>
54
+ </table>
55
+ </foreword>
56
+ </iso-standard>
57
+ INPUT
58
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
59
+ <head>
60
+ <title>test</title>
61
+ <body lang="EN-US" link="blue" vlink="#954F72">
62
+ <div class="WordSection1">
63
+ <p>&#160;</p>
64
+ </div>
65
+ <br clear="all" class="section"/>
66
+ <div class="WordSection2">
67
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
68
+ <div>
69
+ <h1 class="ForewordTitle">Foreword</h1>
70
+ <p class="TableTitle" align="center">
71
+ <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
72
+ </p>
73
+ <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
74
+ <thead>
75
+ <tr>
76
+ <td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Description</td>
77
+ <td colspan="4" align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt:solid windowtext 1.0pt;">Rice sample</td>
78
+ </tr>
79
+ <tr>
80
+ <td align="left" style="border-top:none;mso-border-top-alt:none;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Arborio</td>
81
+ <td align="center" style="border-top:none;mso-border-top-alt:none;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Drago<a href="#tableD-1a" class="TableFootnoteRef">a</a><aside><div id="ftntableD-1a"><a id="tableD-1a" class="TableFootnoteRef">a<span style="mso-tab-count:1">&#160; </span></a>
82
+ <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
83
+ </div></aside></td>
84
+ <td align="center" style="border-top:none;mso-border-top-alt:none;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Balilla</td>
85
+ <td align="center" style="border-top:none;mso-border-top-alt:none;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Thaibonnet</td>
86
+ </tr>
87
+ </thead>
88
+ <tbody>
89
+ <tr>
90
+ <td align="left" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt:solid windowtext 1.0pt;">Number of laboratories retained after eliminating outliers</td>
91
+ <td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt:solid windowtext 1.0pt;">13</td>
92
+ <td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt:solid windowtext 1.0pt;">11</td>
93
+ <td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt:solid windowtext 1.0pt;">13</td>
94
+ <td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt:solid windowtext 1.0pt;">13</td>
95
+ </tr>
96
+ <tr>
97
+ <td align="left" style="border-top:none;mso-border-top-alt:none;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Mean value, g/100 g</td>
98
+ <td align="center" style="border-top:none;mso-border-top-alt:none;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">81,2</td>
99
+ <td align="center" style="border-top:none;mso-border-top-alt:none;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">82,0</td>
100
+ <td align="center" style="border-top:none;mso-border-top-alt:none;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">81,8</td>
101
+ <td align="center" style="border-top:none;mso-border-top-alt:none;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">77,7</td>
102
+ </tr>
103
+ </tbody>
104
+ <tfoot>
105
+ <tr>
106
+ <td align="left" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Reproducibility limit, <span class="stem">(#(R)#)</span> (= 2,83 <span class="stem">(#(s_R)#)</span>)</td>
107
+ <td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">2,89</td>
108
+ <td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">0,57</td>
109
+ <td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">2,26</td>
110
+ <td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">6,06</td>
111
+ </tr>
112
+ </tfoot>
113
+ <dl>
114
+ <dt>
115
+ <p>Drago</p>
116
+ </dt>
117
+ <dd>A type of rice</dd>
118
+ </dl>
119
+ <div id="" class="Note">
120
+ <p class="Note">NOTE<span style="mso-tab-count:1">&#160; </span>This is a table about rice</p>
121
+ </div>
122
+ </table>
123
+ </div>
124
+ <p>&#160;</p>
125
+ </div>
126
+ <br clear="all" class="section"/>
127
+ <div class="WordSection3">
128
+ <p class="zzSTDTitle1"/>
129
+ </div>
130
+ </body>
131
+ </head>
132
+ </html>
133
+ OUTPUT
134
+ end
135
+ end
@@ -0,0 +1,1073 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "cross-references notes" do
5
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <foreword>
8
+ <p>
9
+ <xref target="N"/>
10
+ <xref target="note1"/>
11
+ <xref target="note2"/>
12
+ <xref target="AN"/>
13
+ <xref target="Anote1"/>
14
+ <xref target="Anote2"/>
15
+ </p>
16
+ </foreword>
17
+ <sections>
18
+ <clause id="scope"><title>Scope</title>
19
+ <note id="N">
20
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
21
+ </note>
22
+ </clause>
23
+ <terms id="terms"/>
24
+ <clause id="widgets"><title>Widgets</title>
25
+ <subsection id="widgets1">
26
+ <note id="note1">
27
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
28
+ </note>
29
+ <note id="note2">
30
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
31
+ </note>
32
+ </subsection>
33
+ </clause>
34
+ </sections>
35
+ <annex id="annex1">
36
+ <subsection id="annex1a">
37
+ <note id="AN">
38
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
39
+ </note>
40
+ </subsection>
41
+ <subsection id="annex1b">
42
+ <note id="Anote1">
43
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
44
+ </note>
45
+ <note id="Anote2">
46
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
47
+ </note>
48
+ </subsection>
49
+ </annex>
50
+ </iso-standard>
51
+ INPUT
52
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
53
+ <head>
54
+ <title>test</title>
55
+ <body lang="EN-US" link="blue" vlink="#954F72">
56
+ <div class="WordSection1">
57
+ <p>&#160;</p>
58
+ </div>
59
+ <br clear="all" class="section"/>
60
+ <div class="WordSection2">
61
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
62
+ <div>
63
+ <h1 class="ForewordTitle">Foreword</h1>
64
+ <p>
65
+ <a href="#N">Clause 1, Note</a>
66
+ <a href="#note1">4.1, Note 1</a>
67
+ <a href="#note2">4.1, Note 2</a>
68
+ <a href="#AN">A.1, Note</a>
69
+ <a href="#Anote1">A.2, Note 1</a>
70
+ <a href="#Anote2">A.2, Note 2</a>
71
+ </p>
72
+ </div>
73
+ <p>&#160;</p>
74
+ </div>
75
+ <br clear="all" class="section"/>
76
+ <div class="WordSection3">
77
+ <p class="zzSTDTitle1"/>
78
+ <div id="scope">
79
+ <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
80
+ <div id="N" class="Note">
81
+ <p class="Note">NOTE<span style="mso-tab-count:1">&#160; </span>These results are based on a study carried out on three different types of kernel.</p>
82
+ </div>
83
+ </div>
84
+ <div id="terms"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>No terms and definitions are listed in this document.</p>
85
+ <p>ISO and IEC maintain terminological databases for use in
86
+ standardization at the following addresses:</p>
87
+
88
+ <ul>
89
+ <li> <p>ISO Online browsing platform: available at
90
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
91
+ <li> <p>IEC Electropedia: available at
92
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
93
+ </p> </li> </ul>
94
+ </div>
95
+ <div id="widgets">
96
+ <h1>4.<span style="mso-tab-count:1">&#160; </span>Widgets</h1>
97
+ <div id="widgets1">
98
+ <div id="note1" class="Note"><p class="Note">NOTE 1<span style="mso-tab-count:1">&#160; </span>These results are based on a study carried out on three different types of kernel.</p></div>
99
+ <div id="note2" class="Note"><p class="Note">NOTE 2<span style="mso-tab-count:1">&#160; </span>These results are based on a study carried out on three different types of kernel.</p></div>
100
+ </div>
101
+ </div>
102
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
103
+ <div id="annex1" class="Section3">
104
+ <div id="annex1a">
105
+ <div id="AN" class="Note"><p class="Note">NOTE<span style="mso-tab-count:1">&#160; </span>These results are based on a study carried out on three different types of kernel.</p></div>
106
+ </div>
107
+ <div id="annex1b">
108
+ <div id="Anote1" class="Note"><p class="Note">NOTE 1<span style="mso-tab-count:1">&#160; </span>These results are based on a study carried out on three different types of kernel.</p></div>
109
+ <div id="Anote2" class="Note"><p class="Note">NOTE 2<span style="mso-tab-count:1">&#160; </span>These results are based on a study carried out on three different types of kernel.</p></div>
110
+ </div>
111
+ </div>
112
+ </div>
113
+ </body>
114
+ </head>
115
+ </html>
116
+ OUTPUT
117
+ end
118
+
119
+ it "cross-references figures" do
120
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
121
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
122
+ <foreword id="fwd">
123
+ <p>
124
+ <xref target="N"/>
125
+ <xref target="note1"/>
126
+ <xref target="note2"/>
127
+ <xref target="AN"/>
128
+ <xref target="Anote1"/>
129
+ <xref target="Anote2"/>
130
+ </p>
131
+ </foreword>
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
+ </clause>
139
+ <terms id="terms"/>
140
+ <clause id="widgets"><title>Widgets</title>
141
+ <subsection id="widgets1">
142
+ <figure id="note1">
143
+ <name>Split-it-right sample divider</name>
144
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
145
+ </figure>
146
+ <figure id="note2">
147
+ <name>Split-it-right sample divider</name>
148
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
149
+ </figure>
150
+ </subsection>
151
+ </clause>
152
+ </sections>
153
+ <annex id="annex1">
154
+ <subsection id="annex1a">
155
+ <figure id="AN">
156
+ <name>Split-it-right sample divider</name>
157
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
158
+ </figure>
159
+ </subsection>
160
+ <subsection id="annex1b">
161
+ <figure id="Anote1">
162
+ <name>Split-it-right sample divider</name>
163
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
164
+ </figure>
165
+ <figure id="Anote2">
166
+ <name>Split-it-right sample divider</name>
167
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
168
+ </figure>
169
+ </subsection>
170
+ </annex>
171
+ </iso-standard>
172
+ INPUT
173
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
174
+ <head>
175
+ <title>test</title>
176
+ <body lang="EN-US" link="blue" vlink="#954F72">
177
+ <div class="WordSection1">
178
+ <p>&#160;</p>
179
+ </div>
180
+ <br clear="all" class="section"/>
181
+ <div class="WordSection2">
182
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
183
+ <div id="fwd">
184
+ <h1 class="ForewordTitle">Foreword</h1>
185
+ <p>
186
+ <a href="#N">Figure 1</a>
187
+ <a href="#note1">Figure 2</a>
188
+ <a href="#note2">Figure 3</a>
189
+ <a href="#AN">Figure A.1</a>
190
+ <a href="#Anote1">Figure A.2</a>
191
+ <a href="#Anote2">Figure A.3</a>
192
+ </p>
193
+ </div>
194
+ <p>&#160;</p>
195
+ </div>
196
+ <br clear="all" class="section"/>
197
+ <div class="WordSection3">
198
+ <p class="zzSTDTitle1"/>
199
+ <div id="scope">
200
+ <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
201
+ <div id="N" class="figure">
202
+
203
+ <img src="rice_images/rice_image1.png"/>
204
+ <p class="FigureTitle" align="center"><b>Figure 1&#160;&#8212; Split-it-right sample divider</b></p></div>
205
+ </div>
206
+ <div id="terms"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>No terms and definitions are listed in this document.</p>
207
+ <p>ISO and IEC maintain terminological databases for use in
208
+ standardization at the following addresses:</p>
209
+
210
+ <ul>
211
+ <li> <p>ISO Online browsing platform: available at
212
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
213
+ <li> <p>IEC Electropedia: available at
214
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
215
+ </p> </li> </ul>
216
+ </div>
217
+ <div id="widgets">
218
+ <h1>4.<span style="mso-tab-count:1">&#160; </span>Widgets</h1>
219
+ <div id="widgets1">
220
+ <div id="note1" class="figure">
221
+
222
+ <img src="rice_images/rice_image1.png"/>
223
+ <p class="FigureTitle" align="center"><b>Figure 2&#160;&#8212; Split-it-right sample divider</b></p></div>
224
+ <div id="note2" class="figure">
225
+
226
+ <img src="rice_images/rice_image1.png"/>
227
+ <p class="FigureTitle" align="center"><b>Figure 3&#160;&#8212; Split-it-right sample divider</b></p></div>
228
+ </div>
229
+ </div>
230
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
231
+ <div id="annex1" class="Section3">
232
+ <div id="annex1a">
233
+ <div id="AN" class="figure">
234
+
235
+ <img src="rice_images/rice_image1.png"/>
236
+ <p class="FigureTitle" align="center"><b>Figure A.1&#160;&#8212; Split-it-right sample divider</b></p></div>
237
+ </div>
238
+ <div id="annex1b">
239
+ <div id="Anote1" class="figure">
240
+
241
+ <img src="rice_images/rice_image1.png"/>
242
+ <p class="FigureTitle" align="center"><b>Figure A.2&#160;&#8212; Split-it-right sample divider</b></p></div>
243
+ <div id="Anote2" class="figure">
244
+
245
+ <img src="rice_images/rice_image1.png"/>
246
+ <p class="FigureTitle" align="center"><b>Figure A.3&#160;&#8212; Split-it-right sample divider</b></p></div>
247
+ </div>
248
+ </div>
249
+ </div>
250
+ </body>
251
+ </head>
252
+ </html>
253
+ OUTPUT
254
+ end
255
+
256
+ it "cross-references subfigures" do
257
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
258
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
259
+ <foreword id="fwd">
260
+ <p>
261
+ <xref target="N"/>
262
+ <xref target="note1"/>
263
+ <xref target="note2"/>
264
+ <xref target="AN"/>
265
+ <xref target="Anote1"/>
266
+ <xref target="Anote2"/>
267
+ </p>
268
+ </foreword>
269
+ <sections>
270
+ <clause id="scope"><title>Scope</title>
271
+ </clause>
272
+ <terms id="terms"/>
273
+ <clause id="widgets"><title>Widgets</title>
274
+ <subsection id="widgets1">
275
+ <figure id="N">
276
+ <figure id="note1">
277
+ <name>Split-it-right sample divider</name>
278
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
279
+ </figure>
280
+ <figure id="note2">
281
+ <name>Split-it-right sample divider</name>
282
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
283
+ </figure>
284
+ </figure>
285
+ </subsection>
286
+ </clause>
287
+ </sections>
288
+ <annex id="annex1">
289
+ <subsection id="annex1a">
290
+ </subsection>
291
+ <subsection id="annex1b">
292
+ <figure id="AN">
293
+ <figure id="Anote1">
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 id="Anote2">
298
+ <name>Split-it-right sample divider</name>
299
+ <image src="rice_images/rice_image1.png" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" imagetype="PNG"/>
300
+ </figure>
301
+ </figure>
302
+ </subsection>
303
+ </annex>
304
+ </iso-standard>
305
+ INPUT
306
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
307
+ <head>
308
+ <title>test</title>
309
+ <body lang="EN-US" link="blue" vlink="#954F72">
310
+ <div class="WordSection1">
311
+ <p>&#160;</p>
312
+ </div>
313
+ <br clear="all" class="section"/>
314
+ <div class="WordSection2">
315
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
316
+ <div id="fwd">
317
+ <h1 class="ForewordTitle">Foreword</h1>
318
+ <p>
319
+ <a href="#N">Figure 1</a>
320
+ <a href="#note1">Figure 1-1</a>
321
+ <a href="#note2">Figure 1-2</a>
322
+ <a href="#AN">Figure A.1</a>
323
+ <a href="#Anote1">Figure A.1-1</a>
324
+ <a href="#Anote2">Figure A.1-2</a>
325
+ </p>
326
+ </div>
327
+ <p>&#160;</p>
328
+ </div>
329
+ <br clear="all" class="section"/>
330
+ <div class="WordSection3">
331
+ <p class="zzSTDTitle1"/>
332
+ <div id="scope">
333
+ <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
334
+ </div>
335
+ <div id="terms"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>No terms and definitions are listed in this document.</p>
336
+ <p>ISO and IEC maintain terminological databases for use in
337
+ standardization at the following addresses:</p>
338
+
339
+ <ul>
340
+ <li> <p>ISO Online browsing platform: available at
341
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
342
+ <li> <p>IEC Electropedia: available at
343
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
344
+ </p> </li> </ul>
345
+ </div>
346
+ <div id="widgets">
347
+ <h1>4.<span style="mso-tab-count:1">&#160; </span>Widgets</h1>
348
+ <div id="widgets1">
349
+ <div id="N" class="figure">
350
+ <div id="note1" class="figure">
351
+
352
+ <img src="rice_images/rice_image1.png"/>
353
+ <p class="FigureTitle" align="center"><b>Figure 1-1&#160;&#8212; Split-it-right sample divider</b></p></div>
354
+ <div id="note2" class="figure">
355
+
356
+ <img src="rice_images/rice_image1.png"/>
357
+ <p class="FigureTitle" align="center"><b>Figure 1-2&#160;&#8212; Split-it-right sample divider</b></p></div>
358
+ </div>
359
+ </div>
360
+ </div>
361
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
362
+ <div id="annex1" class="Section3">
363
+ <div id="annex1a">
364
+ </div>
365
+ <div id="annex1b">
366
+ <div id="AN" class="figure">
367
+ <div id="Anote1" class="figure">
368
+
369
+ <img src="rice_images/rice_image1.png"/>
370
+ <p class="FigureTitle" align="center"><b>Figure A.1-1&#160;&#8212; Split-it-right sample divider</b></p></div>
371
+ <div id="Anote2" class="figure">
372
+
373
+ <img src="rice_images/rice_image1.png"/>
374
+ <p class="FigureTitle" align="center"><b>Figure A.1-2&#160;&#8212; Split-it-right sample divider</b></p></div>
375
+ </div>
376
+ </div>
377
+ </div>
378
+ </div>
379
+ </body>
380
+ </head>
381
+ </html>
382
+ OUTPUT
383
+ end
384
+
385
+ it "cross-references examples" do
386
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
387
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
388
+ <foreword>
389
+ <p>
390
+ <xref target="N"/>
391
+ <xref target="note1"/>
392
+ <xref target="note2"/>
393
+ <xref target="AN"/>
394
+ <xref target="Anote1"/>
395
+ <xref target="Anote2"/>
396
+ </p>
397
+ </foreword>
398
+ <sections>
399
+ <clause id="scope"><title>Scope</title>
400
+ <example id="N">
401
+ <p>Hello</p>
402
+ </example>
403
+ </clause>
404
+ <terms id="terms"/>
405
+ <clause id="widgets"><title>Widgets</title>
406
+ <subsection id="widgets1">
407
+ <example id="note1">
408
+ <p>Hello</p>
409
+ </example>
410
+ <example id="note2">
411
+ <p>Hello</p>
412
+ </example>
413
+ </subsection>
414
+ </clause>
415
+ </sections>
416
+ <annex id="annex1">
417
+ <subsection id="annex1a">
418
+ <example id="AN">
419
+ <p>Hello</p>
420
+ </example>
421
+ </subsection>
422
+ <subsection id="annex1b">
423
+ <example id="Anote1">
424
+ <p>Hello</p>
425
+ </example>
426
+ <example id="Anote2">
427
+ <p>Hello</p>
428
+ </example>
429
+ </subsection>
430
+ </annex>
431
+ </iso-standard>
432
+ INPUT
433
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
434
+ <head>
435
+ <title>test</title>
436
+ <body lang="EN-US" link="blue" vlink="#954F72">
437
+ <div class="WordSection1">
438
+ <p>&#160;</p>
439
+ </div>
440
+ <br clear="all" class="section"/>
441
+ <div class="WordSection2">
442
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
443
+ <div>
444
+ <h1 class="ForewordTitle">Foreword</h1>
445
+ <p>
446
+ <a href="#N">Clause 1, Example</a>
447
+ <a href="#note1">4.1, Example 1</a>
448
+ <a href="#note2">4.1, Example 2</a>
449
+ <a href="#AN">A.1, Example</a>
450
+ <a href="#Anote1">A.2, Example 1</a>
451
+ <a href="#Anote2">A.2, Example 2</a>
452
+ </p>
453
+ </div>
454
+ <p>&#160;</p>
455
+ </div>
456
+ <br clear="all" class="section"/>
457
+ <div class="WordSection3">
458
+ <p class="zzSTDTitle1"/>
459
+ <div id="scope">
460
+ <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
461
+ <table id="N" class="example">
462
+ <tr>
463
+ <td width="110pt" valign="top" style="width:82.8pt;padding:.75pt .75pt .75pt .75pt">EXAMPLE</td>
464
+ <td valign="top">
465
+ <p>Hello</p>
466
+ </td>
467
+ </tr>
468
+ </table>
469
+ </div>
470
+ <div id="terms"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>No terms and definitions are listed in this document.</p>
471
+ <p>ISO and IEC maintain terminological databases for use in
472
+ standardization at the following addresses:</p>
473
+
474
+ <ul>
475
+ <li> <p>ISO Online browsing platform: available at
476
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
477
+ <li> <p>IEC Electropedia: available at
478
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
479
+ </p> </li> </ul>
480
+ </div>
481
+ <div id="widgets">
482
+ <h1>4.<span style="mso-tab-count:1">&#160; </span>Widgets</h1>
483
+ <div id="widgets1">
484
+ <table id="note1" class="example"><tr><td width="110pt" valign="top" style="width:82.8pt;padding:.75pt .75pt .75pt .75pt">EXAMPLE 1</td><td valign="top">
485
+ <p>Hello</p>
486
+ </td></tr></table>
487
+ <table id="note2" class="example"><tr><td width="110pt" valign="top" style="width:82.8pt;padding:.75pt .75pt .75pt .75pt">EXAMPLE 2</td><td valign="top">
488
+ <p>Hello</p>
489
+ </td></tr></table>
490
+ </div>
491
+ </div>
492
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
493
+ <div id="annex1" class="Section3">
494
+ <div id="annex1a">
495
+ <table id="AN" class="example"><tr><td width="110pt" valign="top" style="width:82.8pt;padding:.75pt .75pt .75pt .75pt">EXAMPLE</td><td valign="top">
496
+ <p>Hello</p>
497
+ </td></tr></table>
498
+ </div>
499
+ <div id="annex1b">
500
+ <table id="Anote1" class="example"><tr><td width="110pt" valign="top" style="width:82.8pt;padding:.75pt .75pt .75pt .75pt">EXAMPLE 1</td><td valign="top">
501
+ <p>Hello</p>
502
+ </td></tr></table>
503
+ <table id="Anote2" class="example"><tr><td width="110pt" valign="top" style="width:82.8pt;padding:.75pt .75pt .75pt .75pt">EXAMPLE 2</td><td valign="top">
504
+ <p>Hello</p>
505
+ </td></tr></table>
506
+ </div>
507
+ </div>
508
+ </div>
509
+ </body>
510
+ </head>
511
+ </html>
512
+ OUTPUT
513
+ end
514
+
515
+ it "cross-references formulae" do
516
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
517
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
518
+ <foreword>
519
+ <p>
520
+ <xref target="N"/>
521
+ <xref target="note1"/>
522
+ <xref target="note2"/>
523
+ <xref target="AN"/>
524
+ <xref target="Anote1"/>
525
+ <xref target="Anote2"/>
526
+ </p>
527
+ </foreword>
528
+ <sections>
529
+ <clause id="scope"><title>Scope</title>
530
+ <formula id="N">
531
+ <stem type="AsciiMath">r = 1 %</stem>
532
+ </formula>
533
+ </clause>
534
+ <terms id="terms"/>
535
+ <clause id="widgets"><title>Widgets</title>
536
+ <subsection id="widgets1">
537
+ <formula id="note1">
538
+ <stem type="AsciiMath">r = 1 %</stem>
539
+ </formula>
540
+ <formula id="note2">
541
+ <stem type="AsciiMath">r = 1 %</stem>
542
+ </formula>
543
+ </subsection>
544
+ </clause>
545
+ </sections>
546
+ <annex id="annex1">
547
+ <subsection id="annex1a">
548
+ <formula id="AN">
549
+ <stem type="AsciiMath">r = 1 %</stem>
550
+ </formula>
551
+ </subsection>
552
+ <subsection id="annex1b">
553
+ <formula id="Anote1">
554
+ <stem type="AsciiMath">r = 1 %</stem>
555
+ </formula>
556
+ <formula id="Anote2">
557
+ <stem type="AsciiMath">r = 1 %</stem>
558
+ </formula>
559
+ </subsection>
560
+ </annex>
561
+ </iso-standard>
562
+
563
+ <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934">
564
+ <stem type="AsciiMath">r = 1 %</stem>
565
+ <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
566
+ <dt>
567
+ <stem type="AsciiMath">r</stem>
568
+ </dt>
569
+ <dd>
570
+ <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
571
+ </dd>
572
+ </dl></formula>
573
+ </foreword>
574
+ </iso-standard>
575
+ INPUT
576
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
577
+ <head>
578
+ <title>test</title>
579
+ <body lang="EN-US" link="blue" vlink="#954F72">
580
+ <div class="WordSection1">
581
+ <p>&#160;</p>
582
+ </div>
583
+ <br clear="all" class="section"/>
584
+ <div class="WordSection2">
585
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
586
+ <div>
587
+ <h1 class="ForewordTitle">Foreword</h1>
588
+ <p>
589
+ <a href="#N">Clause 1, Formula (1)</a>
590
+ <a href="#note1">4.1, Formula (2)</a>
591
+ <a href="#note2">4.1, Formula (3)</a>
592
+ <a href="#AN">A.1, Formula (A.1)</a>
593
+ <a href="#Anote1">A.2, Formula (A.2)</a>
594
+ <a href="#Anote2">A.2, Formula (A.3)</a>
595
+ </p>
596
+ </div>
597
+ <p>&#160;</p>
598
+ </div>
599
+ <br clear="all" class="section"/>
600
+ <div class="WordSection3">
601
+ <p class="zzSTDTitle1"/>
602
+ <div id="scope">
603
+ <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
604
+ <div id="N" class="formula"><span class="stem">(#(r = 1 %)#)</span><span style="mso-tab-count:1">&#160; </span>(1)</div>
605
+ </div>
606
+ <div id="terms"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>No terms and definitions are listed in this document.</p>
607
+ <p>ISO and IEC maintain terminological databases for use in
608
+ standardization at the following addresses:</p>
609
+
610
+ <ul>
611
+ <li> <p>ISO Online browsing platform: available at
612
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
613
+ <li> <p>IEC Electropedia: available at
614
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
615
+ </p> </li> </ul>
616
+ </div>
617
+ <div id="widgets">
618
+ <h1>4.<span style="mso-tab-count:1">&#160; </span>Widgets</h1>
619
+ <div id="widgets1">
620
+ <div id="note1" class="formula"><span class="stem">(#(r = 1 %)#)</span><span style="mso-tab-count:1">&#160; </span>(2)</div>
621
+ <div id="note2" class="formula"><span class="stem">(#(r = 1 %)#)</span><span style="mso-tab-count:1">&#160; </span>(3)</div>
622
+ </div>
623
+ </div>
624
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
625
+ <div id="annex1" class="Section3">
626
+ <div id="annex1a">
627
+ <div id="AN" class="formula"><span class="stem">(#(r = 1 %)#)</span><span style="mso-tab-count:1">&#160; </span>(A.1)</div>
628
+ </div>
629
+ <div id="annex1b">
630
+ <div id="Anote1" class="formula"><span class="stem">(#(r = 1 %)#)</span><span style="mso-tab-count:1">&#160; </span>(A.2)</div>
631
+ <div id="Anote2" class="formula"><span class="stem">(#(r = 1 %)#)</span><span style="mso-tab-count:1">&#160; </span>(A.3)</div>
632
+ </div>
633
+ </div>
634
+ </div>
635
+ </body>
636
+ </head>
637
+ </html>
638
+ OUTPUT
639
+ end
640
+
641
+ it "cross-references tables" do
642
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
643
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
644
+ <foreword>
645
+ <p>
646
+ <xref target="N"/>
647
+ <xref target="note1"/>
648
+ <xref target="note2"/>
649
+ <xref target="AN"/>
650
+ <xref target="Anote1"/>
651
+ <xref target="Anote2"/>
652
+ </p>
653
+ </foreword>
654
+ <sections>
655
+ <clause id="scope"><title>Scope</title>
656
+ <table id="N">
657
+ <name>Repeatability and reproducibility of husked rice yield</name>
658
+ <tbody>
659
+ <tr>
660
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
661
+ <td align="center">13</td>
662
+ <td align="center">11</td>
663
+ </tr>
664
+ </tbody>
665
+ </table>
666
+ </clause>
667
+ <terms id="terms"/>
668
+ <clause id="widgets"><title>Widgets</title>
669
+ <subsection id="widgets1">
670
+ <table id="note1">
671
+ <name>Repeatability and reproducibility of husked rice yield</name>
672
+ <tbody>
673
+ <tr>
674
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
675
+ <td align="center">13</td>
676
+ <td align="center">11</td>
677
+ </tr>
678
+ </tbody>
679
+ </table>
680
+ <table id="note2">
681
+ <name>Repeatability and reproducibility of husked rice yield</name>
682
+ <tbody>
683
+ <tr>
684
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
685
+ <td align="center">13</td>
686
+ <td align="center">11</td>
687
+ </tr>
688
+ </tbody>
689
+ </table>
690
+ </subsection>
691
+ </clause>
692
+ </sections>
693
+ <annex id="annex1">
694
+ <subsection id="annex1a">
695
+ <table id="AN">
696
+ <name>Repeatability and reproducibility of husked rice yield</name>
697
+ <tbody>
698
+ <tr>
699
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
700
+ <td align="center">13</td>
701
+ <td align="center">11</td>
702
+ </tr>
703
+ </tbody>
704
+ </table>
705
+ </subsection>
706
+ <subsection id="annex1b">
707
+ <table id="Anote1">
708
+ <name>Repeatability and reproducibility of husked rice yield</name>
709
+ <tbody>
710
+ <tr>
711
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
712
+ <td align="center">13</td>
713
+ <td align="center">11</td>
714
+ </tr>
715
+ </tbody>
716
+ </table>
717
+ <table id="Anote2">
718
+ <name>Repeatability and reproducibility of husked rice yield</name>
719
+ <tbody>
720
+ <tr>
721
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
722
+ <td align="center">13</td>
723
+ <td align="center">11</td>
724
+ </tr>
725
+ </tbody>
726
+ </table>
727
+ </subsection>
728
+ </annex>
729
+ </iso-standard>
730
+ INPUT
731
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
732
+ <head>
733
+ <title>test</title>
734
+ <body lang="EN-US" link="blue" vlink="#954F72">
735
+ <div class="WordSection1">
736
+ <p>&#160;</p>
737
+ </div>
738
+ <br clear="all" class="section"/>
739
+ <div class="WordSection2">
740
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
741
+ <div>
742
+ <h1 class="ForewordTitle">Foreword</h1>
743
+ <p>
744
+ <a href="#N">Table 1</a>
745
+ <a href="#note1">Table 2</a>
746
+ <a href="#note2">Table 3</a>
747
+ <a href="#AN">Table A.1</a>
748
+ <a href="#Anote1">Table A.2</a>
749
+ <a href="#Anote2">Table A.3</a>
750
+ </p>
751
+ </div>
752
+ <p>&#160;</p>
753
+ </div>
754
+ <br clear="all" class="section"/>
755
+ <div class="WordSection3">
756
+ <p class="zzSTDTitle1"/>
757
+ <div id="scope">
758
+ <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
759
+ <p class="TableTitle" align="center">
760
+ <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
761
+ </p>
762
+ <table id="N" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
763
+ <tbody>
764
+ <tr>
765
+ <td align="left" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Number of laboratories retained after eliminating outliers</td>
766
+ <td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">13</td>
767
+ <td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">11</td>
768
+ </tr>
769
+ </tbody>
770
+ </table>
771
+ </div>
772
+ <div id="terms"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>No terms and definitions are listed in this document.</p>
773
+ <p>ISO and IEC maintain terminological databases for use in
774
+ standardization at the following addresses:</p>
775
+
776
+ <ul>
777
+ <li> <p>ISO Online browsing platform: available at
778
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
779
+ <li> <p>IEC Electropedia: available at
780
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
781
+ </p> </li> </ul>
782
+ </div>
783
+ <div id="widgets">
784
+ <h1>4.<span style="mso-tab-count:1">&#160; </span>Widgets</h1>
785
+ <div id="widgets1">
786
+ <p class="TableTitle" align="center"><b>Table 2&#160;&#8212; Repeatability and reproducibility of husked rice yield</b></p><table id="note1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Number of laboratories retained after eliminating outliers</td><td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">13</td><td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">11</td></tr></tbody></table>
787
+ <p class="TableTitle" align="center"><b>Table 3&#160;&#8212; Repeatability and reproducibility of husked rice yield</b></p><table id="note2" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Number of laboratories retained after eliminating outliers</td><td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">13</td><td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">11</td></tr></tbody></table>
788
+ </div>
789
+ </div>
790
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
791
+ <div id="annex1" class="Section3">
792
+ <div id="annex1a">
793
+ <p class="TableTitle" align="center"><b>Table A.1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b></p><table id="AN" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Number of laboratories retained after eliminating outliers</td><td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">13</td><td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">11</td></tr></tbody></table>
794
+ </div>
795
+ <div id="annex1b">
796
+ <p class="TableTitle" align="center"><b>Table A.2&#160;&#8212; Repeatability and reproducibility of husked rice yield</b></p><table id="Anote1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Number of laboratories retained after eliminating outliers</td><td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">13</td><td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">11</td></tr></tbody></table>
797
+ <p class="TableTitle" align="center"><b>Table A.3&#160;&#8212; Repeatability and reproducibility of husked rice yield</b></p><table id="Anote2" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0"><tbody><tr><td align="left" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Number of laboratories retained after eliminating outliers</td><td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">13</td><td align="center" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">11</td></tr></tbody></table>
798
+ </div>
799
+ </div>
800
+ </div>
801
+ </body>
802
+ </head>
803
+ </html>
804
+ OUTPUT
805
+ end
806
+
807
+ it "cross-references term notes" do
808
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
809
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
810
+ <foreword>
811
+ <p>
812
+ <xref target="note1"/>
813
+ <xref target="note2"/>
814
+ <xref target="note3"/>
815
+ </p>
816
+ </foreword>
817
+ <sections>
818
+ <clause id="scope"><title>Scope</title>
819
+ </clause>
820
+ <terms id="terms">
821
+ <term id="_waxy_rice"><preferred>waxy rice</preferred>
822
+ <termnote id="note1">
823
+ <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>
824
+ </termnote></term>
825
+ <term id="_nonwaxy_rice"><preferred>nonwaxy rice</preferred>
826
+ <termnote id="note2">
827
+ <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>
828
+ </termnote>
829
+ <termnote id="note3">
830
+ <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>
831
+ </termnote></term>
832
+ </terms>
833
+
834
+ </iso-standard>
835
+ INPUT
836
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
837
+ <head>
838
+ <title>test</title>
839
+ <body lang="EN-US" link="blue" vlink="#954F72">
840
+ <div class="WordSection1">
841
+ <p>&#160;</p>
842
+ </div>
843
+ <br clear="all" class="section"/>
844
+ <div class="WordSection2">
845
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
846
+ <div>
847
+ <h1 class="ForewordTitle">Foreword</h1>
848
+ <p>
849
+ <a href="#note1">3.1, Note 1</a>
850
+ <a href="#note2">3.2, Note 1</a>
851
+ <a href="#note3">3.2, Note 2</a>
852
+ </p>
853
+ </div>
854
+ <p>&#160;</p>
855
+ </div>
856
+ <br clear="all" class="section"/>
857
+ <div class="WordSection3">
858
+ <p class="zzSTDTitle1"/>
859
+ <div id="scope">
860
+ <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
861
+ </div>
862
+ <div id="terms"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>For the purposes of this document,
863
+ the following terms and definitions apply.</p>
864
+ <p>ISO and IEC maintain terminological databases for use in
865
+ standardization at the following addresses:</p>
866
+
867
+ <ul>
868
+ <li> <p>ISO Online browsing platform: available at
869
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
870
+ <li> <p>IEC Electropedia: available at
871
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
872
+ </p> </li> </ul>
873
+ <p class="TermNum" id="_waxy_rice">3.1</p><p class="Terms">waxy rice</p>
874
+ <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><p class="TermNum" id="_nonwaxy_rice">3.2</p><p class="Terms">nonwaxy rice</p>
875
+ <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>
876
+ <div class="Note"><p class="Note">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>
877
+ </div>
878
+ </body>
879
+ </head>
880
+ </html>
881
+ OUTPUT
882
+ end
883
+
884
+ it "cross-references sections" do
885
+ expect(IsoDoc::Convert.new({}).convert_file(<<~"INPUT", "test", true)).to be_equivalent_to <<~"OUTPUT"
886
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
887
+ <foreword obligation="informative">
888
+ <title>Foreword</title>
889
+ <p id="A">This is a preamble
890
+ <xref target="C"/>
891
+ <xref target="D"/>
892
+ <xref target="H"/>
893
+ <xref target="I"/>
894
+ <xref target="J"/>
895
+ <xref target="K"/>
896
+ <xref target="L"/>
897
+ <xref target="M"/>
898
+ <xref target="N"/>
899
+ <xref target="O"/>
900
+ <xref target="P"/>
901
+ <xref target="Q"/>
902
+ <xref target="Q1"/>
903
+ <xref target="R"/>
904
+ </p>
905
+ </foreword>
906
+ <introduction id="B" obligation="informative"><title>Introduction</title><subsection id="C" inline-header="false" obligation="informative">
907
+ <title>Introduction Subsection</title>
908
+ </subsection>
909
+ <patent-notice>
910
+ <p>This is patent boilerplate</p>
911
+ </patent-notice>
912
+ </introduction><sections>
913
+ <clause id="D" obligation="normative">
914
+ <title>Scope</title>
915
+ <p id="E">Text</p>
916
+ </clause>
917
+
918
+ <terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title><terms id="I" obligation="normative">
919
+ <title>Normal Terms</title>
920
+ <term id="J">
921
+ <preferred>Term2</preferred>
922
+ </term>
923
+ </terms>
924
+ <symbols-abbrevs id="K">
925
+ <dl>
926
+ <dt>Symbol</dt>
927
+ <dd>Definition</dd>
928
+ </dl>
929
+ </symbols-abbrevs>
930
+ </terms>
931
+ <symbols-abbrevs id="L">
932
+ <dl>
933
+ <dt>Symbol</dt>
934
+ <dd>Definition</dd>
935
+ </dl>
936
+ </symbols-abbrevs>
937
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><subsection id="N" inline-header="false" obligation="normative">
938
+ <title>Introduction</title>
939
+ </subsection>
940
+ <subsection id="O" inline-header="false" obligation="normative">
941
+ <title>Clause 4.2</title>
942
+ </subsection></clause>
943
+
944
+ </sections><annex id="P" inline-header="false" obligation="normative">
945
+ <title>Annex</title>
946
+ <subsection id="Q" inline-header="false" obligation="normative">
947
+ <title>Annex A.1</title>
948
+ <subsection id="Q1" inline-header="false" obligation="normative">
949
+ <title>Annex A.1a</title>
950
+ </subsection>
951
+ </subsection>
952
+ </annex><references id="R" obligation="informative">
953
+ <title>Normative References</title>
954
+ </references><references id="S" obligation="informative">
955
+ <title>Bibliography</title>
956
+ <references id="T" obligation="informative">
957
+ <title>Bibliography Subsection</title>
958
+ </references>
959
+ </references>
960
+ </iso-standard>
961
+ INPUT
962
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
963
+ <head>
964
+ <title>test</title>
965
+ <body lang="EN-US" link="blue" vlink="#954F72">
966
+ <div class="WordSection1">
967
+ <p>&#160;</p>
968
+ </div>
969
+ <br clear="all" class="section"/>
970
+ <div class="WordSection2">
971
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
972
+ <div>
973
+ <h1 class="ForewordTitle">Foreword</h1>
974
+ <p id="A">This is a preamble
975
+ <a href="#C">0.1</a>
976
+ <a href="#D">Clause 1</a>
977
+ <a href="#H">Clause 3</a>
978
+ <a href="#I">3.1</a>
979
+ <a href="#J">3.1.1</a>
980
+ <a href="#K">3.2</a>
981
+ <a href="#L">Clause 4</a>
982
+ <a href="#M">Clause 5</a>
983
+ <a href="#N">5.1</a>
984
+ <a href="#O">5.2</a>
985
+ <a href="#P">Annex A</a>
986
+ <a href="#Q">A.1</a>
987
+ <a href="#Q1">A.1.1</a>
988
+ <a href="#R">Clause 2</a>
989
+ </p>
990
+ </div>
991
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
992
+ <div class="Section3" id="B">
993
+ <h1 class="IntroTitle">0.<span style="mso-tab-count:1">&#160; </span>Introduction</h1>
994
+ <div id="C">
995
+ <h2>0.1. Introduction Subsection</h2>
996
+ </div>
997
+ <p>This is patent boilerplate</p>
998
+ </div>
999
+ <p>&#160;</p>
1000
+ </div>
1001
+ <br clear="all" class="section"/>
1002
+ <div class="WordSection3">
1003
+ <p class="zzSTDTitle1"/>
1004
+ <div id="D">
1005
+ <h1>1.<span style="mso-tab-count:1">&#160; </span>Scope</h1>
1006
+ <p id="E">Text</p>
1007
+ </div>
1008
+ <div>
1009
+ <h1>2.<span style="mso-tab-count:1">&#160; </span>Normative References</h1>
1010
+ <p>There are no normative references in this document.</p>
1011
+ </div>
1012
+ <div id="H"><h1>3.<span style="mso-tab-count:1">&#160; </span>Terms and Definitions</h1><p>For the purposes of this document,
1013
+ the following terms and definitions apply.</p>
1014
+ <p>ISO and IEC maintain terminological databases for use in
1015
+ standardization at the following addresses:</p>
1016
+
1017
+ <ul>
1018
+ <li> <p>ISO Online browsing platform: available at
1019
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
1020
+ <li> <p>IEC Electropedia: available at
1021
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
1022
+ </p> </li> </ul>
1023
+ <div id="I">
1024
+ <h2>3.1. Normal Terms</h2>
1025
+ <p class="TermNum" id="J">3.1.1</p>
1026
+ <p class="Terms">Term2</p>
1027
+
1028
+ </div><div id="K"><h2>3.2. Symbols and Abbreviated Terms</h2>
1029
+ <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
1030
+ </div></div>
1031
+ <div id="L" class="Symbols">
1032
+ <h1>4.<span style="mso-tab-count:1">&#160; </span>Symbols and Abbreviated Terms</h1>
1033
+ <dl>
1034
+ <dt>
1035
+ <p>Symbol</p>
1036
+ </dt>
1037
+ <dd>Definition</dd>
1038
+ </dl>
1039
+ </div>
1040
+ <div id="M">
1041
+ <h1>5.<span style="mso-tab-count:1">&#160; </span>Clause 4</h1>
1042
+ <div id="N">
1043
+ <h2>5.1. Introduction</h2>
1044
+ </div>
1045
+ <div id="O">
1046
+ <h2>5.2. Clause 4.2</h2>
1047
+ </div>
1048
+ </div>
1049
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
1050
+ <div id="P" class="Section3">
1051
+ <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
1052
+ <div id="Q">
1053
+ <h2>A.1. Annex A.1</h2>
1054
+ <div id="Q1">
1055
+ <h3>A.1.1. Annex A.1a</h3>
1056
+ </div>
1057
+ </div>
1058
+ </div>
1059
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
1060
+ <div>
1061
+ <h1 class="Section3">Bibliography</h1>
1062
+ <div>
1063
+ <h2 class="Section3">Bibliography Subsection</h2>
1064
+ </div>
1065
+ </div>
1066
+ </div>
1067
+ </body>
1068
+ </head>
1069
+ </html>
1070
+ OUTPUT
1071
+ end
1072
+
1073
+ end