asciidoctor-iso 0.9.9 → 0.10.0

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 +4 -4
  2. data/.travis.yml +7 -0
  3. data/README.adoc +49 -9
  4. data/asciidoctor-iso.gemspec +3 -3
  5. data/lib/asciidoctor-iso.rb +2 -0
  6. data/lib/asciidoctor/iso/base.rb +14 -0
  7. data/lib/asciidoctor/iso/blocks.rb +1 -1
  8. data/lib/asciidoctor/iso/cleanup.rb +2 -2
  9. data/lib/asciidoctor/iso/cleanup_ref.rb +1 -1
  10. data/lib/asciidoctor/iso/inline.rb +1 -1
  11. data/lib/asciidoctor/iso/macros.rb +54 -0
  12. data/lib/asciidoctor/iso/ref.rb +7 -2
  13. data/lib/asciidoctor/iso/validate.rb +8 -8
  14. data/lib/asciidoctor/iso/validate_requirements.rb +5 -5
  15. data/lib/asciidoctor/iso/version.rb +1 -1
  16. data/lib/isodoc/iso/html/header.html +206 -0
  17. data/lib/isodoc/iso/html/html_iso_intro.html +34 -0
  18. data/lib/isodoc/iso/html/html_iso_titlepage.html +34 -0
  19. data/lib/isodoc/iso/html/htmlstyle.scss +46 -0
  20. data/lib/isodoc/iso/html/isodoc.scss +696 -0
  21. data/lib/isodoc/iso/html/scripts.html +174 -0
  22. data/lib/isodoc/iso/html/style-human.scss +1277 -0
  23. data/lib/isodoc/iso/html/style-iso.scss +1257 -0
  24. data/lib/isodoc/iso/html/word_iso_intro.html +72 -0
  25. data/lib/isodoc/iso/html/word_iso_titlepage.html +62 -0
  26. data/lib/isodoc/iso/html/wordstyle.scss +1175 -0
  27. data/lib/isodoc/iso/html_convert.rb +136 -0
  28. data/lib/isodoc/iso/metadata.rb +107 -0
  29. data/lib/isodoc/iso/word_convert.rb +139 -0
  30. data/spec/asciidoctor-iso/isobib_cache_spec.rb +18 -4
  31. data/spec/asciidoctor-iso/macros_spec.rb +92 -1
  32. data/spec/asciidoctor-iso/validate_spec.rb +173 -144
  33. data/spec/assets/header.html +7 -0
  34. data/spec/assets/html.css +2 -0
  35. data/spec/assets/htmlcover.html +4 -0
  36. data/spec/assets/htmlintro.html +5 -0
  37. data/spec/assets/i18n.yaml +2 -0
  38. data/spec/assets/iso.doc +2312 -0
  39. data/spec/assets/iso.headless.html +33 -0
  40. data/spec/assets/iso.html +1388 -0
  41. data/spec/assets/iso.xml +8 -0
  42. data/spec/assets/rice_image1.png +0 -0
  43. data/spec/assets/scripts.html +3 -0
  44. data/spec/assets/std.css +2 -0
  45. data/spec/assets/word.css +2 -0
  46. data/spec/assets/wordcover.html +3 -0
  47. data/spec/assets/wordintro.html +4 -0
  48. data/spec/examples/103_01_02.html +247 -0
  49. data/spec/isodoc/i18n_spec.rb +642 -0
  50. data/spec/isodoc/iso_spec.rb +168 -0
  51. data/spec/isodoc/metadata_spec.rb +152 -0
  52. data/spec/isodoc/postproc_spec.rb +409 -0
  53. data/spec/isodoc/section_spec.rb +522 -0
  54. data/spec/isodoc/xref_spec.rb +1337 -0
  55. data/spec/spec_helper.rb +45 -0
  56. metadata +45 -9
@@ -0,0 +1,1337 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "cross-references notes" do
5
+ expect(IsoDoc::Iso::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
+ <br/>
60
+ <div>
61
+ <h1 class="ForewordTitle">Foreword</h1>
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
+ <p class="zzSTDTitle1"/>
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::Iso::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
+ <br/>
177
+ <div id="fwd">
178
+ <h1 class="ForewordTitle">Foreword</h1>
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
+ <p class="zzSTDTitle1"/>
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::Iso::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
+ <br/>
304
+ <div id="fwd">
305
+ <h1 class="ForewordTitle">Foreword</h1>
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
+ <p class="zzSTDTitle1"/>
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::Iso::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
+ <br/>
423
+ <div>
424
+ <h1 class="ForewordTitle">Foreword</h1>
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
+ <p class="zzSTDTitle1"/>
435
+ <div id="scope">
436
+ <h1>1.&#160; Scope</h1>
437
+ <table id="N" class="example">
438
+ <tr>
439
+ <td valign="top" class="example_label" style="width:82.8pt;">EXAMPLE</td>
440
+ <td valign="top" class="example">
441
+ <p>Hello</p>
442
+ </td>
443
+ </tr>
444
+ </table>
445
+ <p>
446
+ <a href="#N">Example</a>
447
+ </p>
448
+ </div>
449
+ <div id="terms"><h1>2.&#160; Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
450
+ <p>ISO and IEC maintain terminological databases for use in
451
+ standardization at the following addresses:</p>
452
+
453
+ <ul>
454
+ <li> <p>ISO Online browsing platform: available at
455
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
456
+ <li> <p>IEC Electropedia: available at
457
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
458
+ </p> </li> </ul>
459
+ </div>
460
+ <div id="widgets">
461
+ <h1>3.&#160; Widgets</h1>
462
+ <div id="widgets1"><h2>3.1. </h2>
463
+ <table id="note1" class="example"><tr><td valign="top" class="example_label" style="width:82.8pt;">EXAMPLE 1</td><td valign="top" class="example">
464
+ <p>Hello</p>
465
+ </td></tr></table>
466
+ <table id="note2" class="example"><tr><td valign="top" class="example_label" style="width:82.8pt;">EXAMPLE 2</td><td valign="top" class="example">
467
+ <p>Hello</p>
468
+ </td></tr></table>
469
+ <p> <a href="#note1">Example 1</a> <a href="#note2">Example 2</a> </p>
470
+ </div>
471
+ </div>
472
+ <br/>
473
+ <div id="annex1" class="Section3">
474
+ <div id="annex1a"><h2>A.1. </h2>
475
+ <table id="AN" class="example"><tr><td valign="top" class="example_label" style="width:82.8pt;">EXAMPLE</td><td valign="top" class="example">
476
+ <p>Hello</p>
477
+ </td></tr></table>
478
+ </div>
479
+ <div id="annex1b"><h2>A.2. </h2>
480
+ <table id="Anote1" class="example"><tr><td valign="top" class="example_label" style="width:82.8pt;">EXAMPLE 1</td><td valign="top" class="example">
481
+ <p>Hello</p>
482
+ </td></tr></table>
483
+ <table id="Anote2" class="example"><tr><td valign="top" class="example_label" style="width:82.8pt;">EXAMPLE 2</td><td valign="top" class="example">
484
+ <p>Hello</p>
485
+ </td></tr></table>
486
+ </div>
487
+ </div>
488
+ </div>
489
+ </body>
490
+ </html>
491
+ OUTPUT
492
+ end
493
+
494
+ it "cross-references formulae" do
495
+ expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
496
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
497
+ <preface>
498
+ <foreword>
499
+ <p>
500
+ <xref target="N"/>
501
+ <xref target="note1"/>
502
+ <xref target="note2"/>
503
+ <xref target="AN"/>
504
+ <xref target="Anote1"/>
505
+ <xref target="Anote2"/>
506
+ </p>
507
+ </foreword>
508
+ </preface>
509
+ <sections>
510
+ <clause id="scope"><title>Scope</title>
511
+ <formula id="N">
512
+ <stem type="AsciiMath">r = 1 %</stem>
513
+ </formula>
514
+ <p><xref target="N"/></p>
515
+ </clause>
516
+ <terms id="terms"/>
517
+ <clause id="widgets"><title>Widgets</title>
518
+ <clause id="widgets1">
519
+ <formula id="note1">
520
+ <stem type="AsciiMath">r = 1 %</stem>
521
+ </formula>
522
+ <formula id="note2">
523
+ <stem type="AsciiMath">r = 1 %</stem>
524
+ </formula>
525
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
526
+ </clause>
527
+ </clause>
528
+ </sections>
529
+ <annex id="annex1">
530
+ <clause id="annex1a">
531
+ <formula id="AN">
532
+ <stem type="AsciiMath">r = 1 %</stem>
533
+ </formula>
534
+ </clause>
535
+ <clause id="annex1b">
536
+ <formula id="Anote1">
537
+ <stem type="AsciiMath">r = 1 %</stem>
538
+ </formula>
539
+ <formula id="Anote2">
540
+ <stem type="AsciiMath">r = 1 %</stem>
541
+ </formula>
542
+ </clause>
543
+ </annex>
544
+ </iso-standard>
545
+
546
+ <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934">
547
+ <stem type="AsciiMath">r = 1 %</stem>
548
+ <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
549
+ <dt>
550
+ <stem type="AsciiMath">r</stem>
551
+ </dt>
552
+ <dd>
553
+ <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
554
+ </dd>
555
+ </dl></formula>
556
+ </foreword>
557
+ </preface>
558
+ </iso-standard>
559
+ INPUT
560
+ #{HTML_HDR}
561
+ <br/>
562
+ <div>
563
+ <h1 class="ForewordTitle">Foreword</h1>
564
+ <p>
565
+ <a href="#N">Clause 1, Formula (1)</a>
566
+ <a href="#note1">3.1, Formula (2)</a>
567
+ <a href="#note2">3.1, Formula (3)</a>
568
+ <a href="#AN">A.1, Formula (A.1)</a>
569
+ <a href="#Anote1">A.2, Formula (A.2)</a>
570
+ <a href="#Anote2">A.2, Formula (A.3)</a>
571
+ </p>
572
+ </div>
573
+ <p class="zzSTDTitle1"/>
574
+ <div id="scope">
575
+ <h1>1.&#160; Scope</h1>
576
+ <div id="N" class="formula"><span class="stem">(#(r = 1 %)#)</span>&#160; (1)</div>
577
+ <p>
578
+ <a href="#N">Formula (1)</a>
579
+ </p>
580
+ </div>
581
+ <div id="terms"><h1>2.&#160; Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
582
+ <p>ISO and IEC maintain terminological databases for use in
583
+ standardization at the following addresses:</p>
584
+
585
+ <ul>
586
+ <li> <p>ISO Online browsing platform: available at
587
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
588
+ <li> <p>IEC Electropedia: available at
589
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
590
+ </p> </li> </ul>
591
+ </div>
592
+ <div id="widgets">
593
+ <h1>3.&#160; Widgets</h1>
594
+ <div id="widgets1"><h2>3.1. </h2>
595
+ <div id="note1" class="formula"><span class="stem">(#(r = 1 %)#)</span>&#160; (2)</div>
596
+ <div id="note2" class="formula"><span class="stem">(#(r = 1 %)#)</span>&#160; (3)</div>
597
+ <p> <a href="#note1">Formula (2)</a> <a href="#note2">Formula (3)</a> </p>
598
+ </div>
599
+ </div>
600
+ <br/>
601
+ <div id="annex1" class="Section3">
602
+ <div id="annex1a"><h2>A.1. </h2>
603
+ <div id="AN" class="formula"><span class="stem">(#(r = 1 %)#)</span>&#160; (A.1)</div>
604
+ </div>
605
+ <div id="annex1b"><h2>A.2. </h2>
606
+ <div id="Anote1" class="formula"><span class="stem">(#(r = 1 %)#)</span>&#160; (A.2)</div>
607
+ <div id="Anote2" class="formula"><span class="stem">(#(r = 1 %)#)</span>&#160; (A.3)</div>
608
+ </div>
609
+ </div>
610
+ </div>
611
+ </body>
612
+ </html>
613
+ OUTPUT
614
+ end
615
+
616
+ it "cross-references tables" do
617
+ expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
618
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
619
+ <preface>
620
+ <foreword>
621
+ <p>
622
+ <xref target="N"/>
623
+ <xref target="note1"/>
624
+ <xref target="note2"/>
625
+ <xref target="AN"/>
626
+ <xref target="Anote1"/>
627
+ <xref target="Anote2"/>
628
+ </p>
629
+ </foreword>
630
+ </preface>
631
+ <sections>
632
+ <clause id="scope"><title>Scope</title>
633
+ <table id="N">
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
+ <p><xref target="N"/></p>
644
+ </clause>
645
+ <terms id="terms"/>
646
+ <clause id="widgets"><title>Widgets</title>
647
+ <clause id="widgets1">
648
+ <table id="note1">
649
+ <name>Repeatability and reproducibility of husked rice yield</name>
650
+ <tbody>
651
+ <tr>
652
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
653
+ <td align="center">13</td>
654
+ <td align="center">11</td>
655
+ </tr>
656
+ </tbody>
657
+ </table>
658
+ <table id="note2">
659
+ <name>Repeatability and reproducibility of husked rice yield</name>
660
+ <tbody>
661
+ <tr>
662
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
663
+ <td align="center">13</td>
664
+ <td align="center">11</td>
665
+ </tr>
666
+ </tbody>
667
+ </table>
668
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
669
+ </clause>
670
+ </clause>
671
+ </sections>
672
+ <annex id="annex1">
673
+ <clause id="annex1a">
674
+ <table id="AN">
675
+ <name>Repeatability and reproducibility of husked rice yield</name>
676
+ <tbody>
677
+ <tr>
678
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
679
+ <td align="center">13</td>
680
+ <td align="center">11</td>
681
+ </tr>
682
+ </tbody>
683
+ </table>
684
+ </clause>
685
+ <clause id="annex1b">
686
+ <table id="Anote1">
687
+ <name>Repeatability and reproducibility of husked rice yield</name>
688
+ <tbody>
689
+ <tr>
690
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
691
+ <td align="center">13</td>
692
+ <td align="center">11</td>
693
+ </tr>
694
+ </tbody>
695
+ </table>
696
+ <table id="Anote2">
697
+ <name>Repeatability and reproducibility of husked rice yield</name>
698
+ <tbody>
699
+ <tr>
700
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
701
+ <td align="center">13</td>
702
+ <td align="center">11</td>
703
+ </tr>
704
+ </tbody>
705
+ </table>
706
+ </clause>
707
+ </annex>
708
+ </iso-standard>
709
+ INPUT
710
+ #{HTML_HDR}
711
+ <br/>
712
+ <div>
713
+ <h1 class="ForewordTitle">Foreword</h1>
714
+ <p>
715
+ <a href="#N">Table 1</a>
716
+ <a href="#note1">Table 2</a>
717
+ <a href="#note2">Table 3</a>
718
+ <a href="#AN">Table A.1</a>
719
+ <a href="#Anote1">Table A.2</a>
720
+ <a href="#Anote2">Table A.3</a>
721
+ </p>
722
+ </div>
723
+ <p class="zzSTDTitle1"/>
724
+ <div id="scope">
725
+ <h1>1.&#160; Scope</h1>
726
+ <p class="TableTitle" align="center">
727
+ Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield
728
+ </p>
729
+ <table id="N" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
730
+ <tbody>
731
+ <tr>
732
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Number of laboratories retained after eliminating outliers</td>
733
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">13</td>
734
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">11</td>
735
+ </tr>
736
+ </tbody>
737
+ </table>
738
+ <p>
739
+ <a href="#N">Table 1</a>
740
+ </p>
741
+ </div>
742
+ <div id="terms"><h1>2.&#160; Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
743
+ <p>ISO and IEC maintain terminological databases for use in
744
+ standardization at the following addresses:</p>
745
+
746
+ <ul>
747
+ <li> <p>ISO Online browsing platform: available at
748
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
749
+ <li> <p>IEC Electropedia: available at
750
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
751
+ </p> </li> </ul>
752
+ </div>
753
+ <div id="widgets">
754
+ <h1>3.&#160; Widgets</h1>
755
+ <div id="widgets1"><h2>3.1. </h2>
756
+ <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>
757
+ <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>
758
+ <p> <a href="#note1">Table 2</a> <a href="#note2">Table 3</a> </p>
759
+ </div>
760
+ </div>
761
+ <br/>
762
+ <div id="annex1" class="Section3">
763
+ <div id="annex1a"><h2>A.1. </h2>
764
+ <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>
765
+ </div>
766
+ <div id="annex1b"><h2>A.2. </h2>
767
+ <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>
768
+ <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>
769
+ </div>
770
+ </div>
771
+ </div>
772
+ </body>
773
+ </html>
774
+ OUTPUT
775
+ end
776
+
777
+ it "cross-references term notes" do
778
+ expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
779
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
780
+ <preface>
781
+ <foreword>
782
+ <p>
783
+ <xref target="note1"/>
784
+ <xref target="note2"/>
785
+ <xref target="note3"/>
786
+ </p>
787
+ </foreword>
788
+ </preface>
789
+ <sections>
790
+ <clause id="scope"><title>Scope</title>
791
+ </clause>
792
+ <terms id="terms">
793
+ <term id="_waxy_rice"><preferred>waxy rice</preferred>
794
+ <termnote id="note1">
795
+ <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>
796
+ </termnote></term>
797
+ <term id="_nonwaxy_rice"><preferred>nonwaxy rice</preferred>
798
+ <termnote id="note2">
799
+ <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>
800
+ </termnote>
801
+ <termnote id="note3">
802
+ <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>
803
+ </termnote></term>
804
+ </terms>
805
+
806
+ </iso-standard>
807
+ INPUT
808
+ #{HTML_HDR}
809
+ <br/>
810
+ <div>
811
+ <h1 class="ForewordTitle">Foreword</h1>
812
+ <p>
813
+ <a href="#note1">2.1, Note 1</a>
814
+ <a href="#note2">2.2, Note 1</a>
815
+ <a href="#note3">2.2, Note 2</a>
816
+ </p>
817
+ </div>
818
+ <p class="zzSTDTitle1"/>
819
+ <div id="scope">
820
+ <h1>1.&#160; Scope</h1>
821
+ </div>
822
+ <div id="terms"><h1>2.&#160; Terms and definitions</h1><p>For the purposes of this document,
823
+ the following terms and definitions apply.</p>
824
+ <p>ISO and IEC maintain terminological databases for use in
825
+ standardization at the following addresses:</p>
826
+
827
+ <ul>
828
+ <li> <p>ISO Online browsing platform: available at
829
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
830
+ <li> <p>IEC Electropedia: available at
831
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
832
+ </p> </li> </ul>
833
+ <p class="TermNum" id="_waxy_rice">2.1</p><p class="Terms" style="text-align:left;">waxy rice</p>
834
+ <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>
835
+ <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>
836
+ <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>
837
+ </div>
838
+ </body>
839
+ </html>
840
+ OUTPUT
841
+ end
842
+
843
+ it "cross-references sections" do
844
+ expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
845
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
846
+ <preface>
847
+ <foreword obligation="informative">
848
+ <title>Foreword</title>
849
+ <p id="A">This is a preamble
850
+ <xref target="C"/>
851
+ <xref target="C1"/>
852
+ <xref target="D"/>
853
+ <xref target="H"/>
854
+ <xref target="I"/>
855
+ <xref target="J"/>
856
+ <xref target="K"/>
857
+ <xref target="L"/>
858
+ <xref target="M"/>
859
+ <xref target="N"/>
860
+ <xref target="O"/>
861
+ <xref target="P"/>
862
+ <xref target="Q"/>
863
+ <xref target="Q1"/>
864
+ <xref target="Q2"/>
865
+ <xref target="R"/>
866
+ </p>
867
+ </foreword>
868
+ <introduction id="B" obligation="informative"><title>Introduction</title><clause id="C" inline-header="false" obligation="informative">
869
+ <title>Introduction Subsection</title>
870
+ </clause>
871
+ <clause id="C1" inline-header="false" obligation="informative">Text</clause>
872
+ </introduction></preface><sections>
873
+ <clause id="D" obligation="normative">
874
+ <title>Scope</title>
875
+ <p id="E">Text</p>
876
+ </clause>
877
+
878
+ <terms id="H" obligation="normative"><title>Terms, definitions, symbols and abbreviated terms</title><terms id="I" obligation="normative">
879
+ <title>Normal Terms</title>
880
+ <term id="J">
881
+ <preferred>Term2</preferred>
882
+ </term>
883
+ </terms>
884
+ <definitions id="K">
885
+ <dl>
886
+ <dt>Symbol</dt>
887
+ <dd>Definition</dd>
888
+ </dl>
889
+ </definitions>
890
+ </terms>
891
+ <definitions id="L">
892
+ <dl>
893
+ <dt>Symbol</dt>
894
+ <dd>Definition</dd>
895
+ </dl>
896
+ </definitions>
897
+ <clause id="M" inline-header="false" obligation="normative"><title>Clause 4</title><clause id="N" inline-header="false" obligation="normative">
898
+ <title>Introduction</title>
899
+ </clause>
900
+ <clause id="O" inline-header="false" obligation="normative">
901
+ <title>Clause 4.2</title>
902
+ </clause></clause>
903
+
904
+ </sections><annex id="P" inline-header="false" obligation="normative">
905
+ <title>Annex</title>
906
+ <clause id="Q" inline-header="false" obligation="normative">
907
+ <title>Annex A.1</title>
908
+ <clause id="Q1" inline-header="false" obligation="normative">
909
+ <title>Annex A.1a</title>
910
+ </clause>
911
+ </clause>
912
+ <appendix id="Q2" inline-header="false" obligation="normative">
913
+ <title>An Appendix</title>
914
+ </appendix>
915
+ </annex><bibliography><references id="R" obligation="informative">
916
+ <title>Normative References</title>
917
+ </references><clause id="S" obligation="informative">
918
+ <title>Bibliography</title>
919
+ <references id="T" obligation="informative">
920
+ <title>Bibliography Subsection</title>
921
+ </references>
922
+ </clause>
923
+ </bibliography>
924
+ </iso-standard>
925
+ INPUT
926
+ #{HTML_HDR}
927
+ <br/>
928
+ <div>
929
+ <h1 class="ForewordTitle">Foreword</h1>
930
+ <p id="A">This is a preamble
931
+ <a href="#C">0.1</a>
932
+ <a href="#C1">0.2</a>
933
+ <a href="#D">Clause 1</a>
934
+ <a href="#H">Clause 3</a>
935
+ <a href="#I">3.1</a>
936
+ <a href="#J">3.1.1</a>
937
+ <a href="#K">3.2</a>
938
+ <a href="#L">Clause 4</a>
939
+ <a href="#M">Clause 5</a>
940
+ <a href="#N">5.1</a>
941
+ <a href="#O">5.2</a>
942
+ <a href="#P">Annex A</a>
943
+ <a href="#Q">A.1</a>
944
+ <a href="#Q1">A.1.1</a>
945
+ <a href="#Q2">Annex A, Appendix 1</a>
946
+ <a href="#R">Clause 2</a>
947
+ </p>
948
+ </div>
949
+ <br/>
950
+ <div class="Section3" id="B">
951
+ <h1 class="IntroTitle">0.&#160; Introduction</h1>
952
+ <div id="C">
953
+ <h2>0.1. Introduction Subsection</h2>
954
+ </div>
955
+ <div id="C1"><h2>0.2. </h2>Text</div>
956
+ </div>
957
+ <p class="zzSTDTitle1"/>
958
+ <div id="D">
959
+ <h1>1.&#160; Scope</h1>
960
+ <p id="E">Text</p>
961
+ </div>
962
+ <div>
963
+ <h1>2.&#160; Normative references</h1>
964
+ <p>There are no normative references in this document.</p>
965
+ </div>
966
+ <div id="H"><h1>3.&#160; Terms, definitions, symbols and abbreviated terms</h1><p>For the purposes of this document,
967
+ the following terms and definitions apply.</p>
968
+ <p>ISO and IEC maintain terminological databases for use in
969
+ standardization at the following addresses:</p>
970
+
971
+ <ul>
972
+ <li> <p>ISO Online browsing platform: available at
973
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
974
+ <li> <p>IEC Electropedia: available at
975
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
976
+ </p> </li> </ul>
977
+ <div id="I">
978
+ <h2>3.1. Normal Terms</h2>
979
+ <p class="TermNum" id="J">3.1.1</p>
980
+ <p class="Terms" style="text-align:left;">Term2</p>
981
+
982
+ </div><div id="K"><h2>3.2. Symbols and abbreviated terms</h2>
983
+ <dl><dt><p>Symbol</p></dt><dd>Definition</dd></dl>
984
+ </div></div>
985
+ <div id="L" class="Symbols">
986
+ <h1>4.&#160; Symbols and abbreviated terms</h1>
987
+ <dl>
988
+ <dt>
989
+ <p>Symbol</p>
990
+ </dt>
991
+ <dd>Definition</dd>
992
+ </dl>
993
+ </div>
994
+ <div id="M">
995
+ <h1>5.&#160; Clause 4</h1>
996
+ <div id="N">
997
+ <h2>5.1. Introduction</h2>
998
+ </div>
999
+ <div id="O">
1000
+ <h2>5.2. Clause 4.2</h2>
1001
+ </div>
1002
+ </div>
1003
+ <br/>
1004
+ <div id="P" class="Section3">
1005
+ <h1 class="Annex"><b>Annex A</b><br/>(normative)<br/><br/><b>Annex</b></h1>
1006
+ <div id="Q">
1007
+ <h2>A.1. Annex A.1</h2>
1008
+ <div id="Q1">
1009
+ <h3>A.1.1. Annex A.1a</h3>
1010
+ </div>
1011
+ </div>
1012
+ <div id="Q2">
1013
+ <h2>Appendix 1. An Appendix</h2>
1014
+ </div>
1015
+ </div>
1016
+ <br/>
1017
+ <div>
1018
+ <h1 class="Section3">Bibliography</h1>
1019
+ <div>
1020
+ <h2 class="Section3">Bibliography Subsection</h2>
1021
+ </div>
1022
+ </div>
1023
+ </div>
1024
+ </body>
1025
+ </html>
1026
+ OUTPUT
1027
+ end
1028
+
1029
+ it "cross-references lists" do
1030
+ expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
1031
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1032
+ <preface>
1033
+ <foreword>
1034
+ <p>
1035
+ <xref target="N"/>
1036
+ <xref target="note1"/>
1037
+ <xref target="note2"/>
1038
+ <xref target="AN"/>
1039
+ <xref target="Anote1"/>
1040
+ <xref target="Anote2"/>
1041
+ </p>
1042
+ </foreword>
1043
+ </preface>
1044
+ <sections>
1045
+ <clause id="scope"><title>Scope</title>
1046
+ <ol id="N">
1047
+ <li><p>A</p></li>
1048
+ </ol>
1049
+ </clause>
1050
+ <terms id="terms"/>
1051
+ <clause id="widgets"><title>Widgets</title>
1052
+ <clause id="widgets1">
1053
+ <ol id="note1">
1054
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1055
+ </ol>
1056
+ <ol id="note2">
1057
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
1058
+ </ol>
1059
+ </clause>
1060
+ </clause>
1061
+ </sections>
1062
+ <annex id="annex1">
1063
+ <clause id="annex1a">
1064
+ <ol id="AN">
1065
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1066
+ </ol>
1067
+ </clause>
1068
+ <clause id="annex1b">
1069
+ <ol id="Anote1">
1070
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1071
+ </ol>
1072
+ <ol id="Anote2">
1073
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
1074
+ </ol>
1075
+ </clause>
1076
+ </annex>
1077
+ </iso-standard>
1078
+ INPUT
1079
+ #{HTML_HDR}
1080
+ <br/>
1081
+ <div>
1082
+ <h1 class="ForewordTitle">Foreword</h1>
1083
+ <p>
1084
+ <a href="#N">Clause 1, List</a>
1085
+ <a href="#note1">3.1, List 1</a>
1086
+ <a href="#note2">3.1, List 2</a>
1087
+ <a href="#AN">A.1, List</a>
1088
+ <a href="#Anote1">A.2, List 1</a>
1089
+ <a href="#Anote2">A.2, List 2</a>
1090
+ </p>
1091
+ </div>
1092
+ <p class="zzSTDTitle1"/>
1093
+ <div id="scope">
1094
+ <h1>1.&#160; Scope</h1>
1095
+ <ol type="a">
1096
+ <li><p>A</p></li>
1097
+ </ol>
1098
+ </div>
1099
+ <div id="terms"><h1>2.&#160; Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
1100
+ <p>ISO and IEC maintain terminological databases for use in
1101
+ standardization at the following addresses:</p>
1102
+
1103
+ <ul>
1104
+ <li> <p>ISO Online browsing platform: available at
1105
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
1106
+ <li> <p>IEC Electropedia: available at
1107
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
1108
+ </p> </li> </ul>
1109
+ </div>
1110
+ <div id="widgets">
1111
+ <h1>3.&#160; Widgets</h1>
1112
+ <div id="widgets1"><h2>3.1. </h2>
1113
+ <ol type="a">
1114
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1115
+ </ol>
1116
+ <ol type="a">
1117
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
1118
+ </ol>
1119
+ </div>
1120
+ </div>
1121
+ <br/>
1122
+ <div id="annex1" class="Section3">
1123
+ <div id="annex1a"><h2>A.1. </h2>
1124
+ <ol type="a">
1125
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1126
+ </ol>
1127
+ </div>
1128
+ <div id="annex1b"><h2>A.2. </h2>
1129
+ <ol type="a">
1130
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1131
+ </ol>
1132
+ <ol type="a">
1133
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
1134
+ </ol>
1135
+ </div>
1136
+ </div>
1137
+ </div>
1138
+ </body>
1139
+ </html>
1140
+ OUTPUT
1141
+ end
1142
+
1143
+ it "cross-references list items" do
1144
+ expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
1145
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1146
+ <preface>
1147
+ <foreword>
1148
+ <p>
1149
+ <xref target="N"/>
1150
+ <xref target="note1"/>
1151
+ <xref target="note2"/>
1152
+ <xref target="AN"/>
1153
+ <xref target="Anote1"/>
1154
+ <xref target="Anote2"/>
1155
+ </p>
1156
+ </foreword>
1157
+ </preface>
1158
+ <sections>
1159
+ <clause id="scope"><title>Scope</title>
1160
+ <ol id="N1">
1161
+ <li id="N"><p>A</p></li>
1162
+ </ol>
1163
+ </clause>
1164
+ <terms id="terms"/>
1165
+ <clause id="widgets"><title>Widgets</title>
1166
+ <clause id="widgets1">
1167
+ <ol id="note1l">
1168
+ <li id="note1"><p>A</p></li>
1169
+ </ol>
1170
+ <ol id="note2l">
1171
+ <li id="note2"><p>A</p></li>
1172
+ </ol>
1173
+ </clause>
1174
+ </clause>
1175
+ </sections>
1176
+ <annex id="annex1">
1177
+ <clause id="annex1a">
1178
+ <ol id="ANl">
1179
+ <li id="AN"><p>A</p></li>
1180
+ </ol>
1181
+ </clause>
1182
+ <clause id="annex1b">
1183
+ <ol id="Anote1l">
1184
+ <li id="Anote1"><p>A</p></li>
1185
+ </ol>
1186
+ <ol id="Anote2l">
1187
+ <li id="Anote2"><p>A</p></li>
1188
+ </ol>
1189
+ </clause>
1190
+ </annex>
1191
+ </iso-standard>
1192
+ INPUT
1193
+ #{HTML_HDR}
1194
+ <br/>
1195
+ <div>
1196
+ <h1 class="ForewordTitle">Foreword</h1>
1197
+ <p>
1198
+ <a href="#N">Clause 1, a)</a>
1199
+ <a href="#note1">3.1, List 1 a)</a>
1200
+ <a href="#note2">3.1, List 2 a)</a>
1201
+ <a href="#AN">A.1, a)</a>
1202
+ <a href="#Anote1">A.2, List 1 a)</a>
1203
+ <a href="#Anote2">A.2, List 2 a)</a>
1204
+ </p>
1205
+ </div>
1206
+ <p class="zzSTDTitle1"/>
1207
+ <div id="scope">
1208
+ <h1>1.&#160; Scope</h1>
1209
+ <ol type="a">
1210
+ <li><p>A</p></li>
1211
+ </ol>
1212
+ </div>
1213
+ <div id="terms"><h1>2.&#160; Terms and definitions</h1><p>No terms and definitions are listed in this document.</p>
1214
+ <p>ISO and IEC maintain terminological databases for use in
1215
+ standardization at the following addresses:</p>
1216
+
1217
+ <ul>
1218
+ <li> <p>ISO Online browsing platform: available at
1219
+ <a href="http://www.iso.org/obp">http://www.iso.org/obp</a></p> </li>
1220
+ <li> <p>IEC Electropedia: available at
1221
+ <a href="http://www.electropedia.org">http://www.electropedia.org</a>
1222
+ </p> </li> </ul>
1223
+ </div>
1224
+ <div id="widgets">
1225
+ <h1>3.&#160; Widgets</h1>
1226
+ <div id="widgets1"><h2>3.1. </h2>
1227
+ <ol type="a">
1228
+ <li><p>A</p></li>
1229
+ </ol>
1230
+ <ol type="a">
1231
+ <li><p>A</p></li>
1232
+ </ol>
1233
+ </div>
1234
+ </div>
1235
+ <br/>
1236
+ <div id="annex1" class="Section3">
1237
+ <div id="annex1a"><h2>A.1. </h2>
1238
+ <ol type="a">
1239
+ <li><p>A</p></li>
1240
+ </ol>
1241
+ </div>
1242
+ <div id="annex1b"><h2>A.2. </h2>
1243
+ <ol type="a">
1244
+ <li><p>A</p></li>
1245
+ </ol>
1246
+ <ol type="a">
1247
+ <li><p>A</p></li>
1248
+ </ol>
1249
+ </div>
1250
+ </div>
1251
+ </div>
1252
+ </body>
1253
+ </html>
1254
+ OUTPUT
1255
+ end
1256
+
1257
+ it "cross-references nested list items" do
1258
+ expect(IsoDoc::Iso::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
1259
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1260
+ <preface>
1261
+ <foreword>
1262
+ <p>
1263
+ <xref target="N"/>
1264
+ <xref target="note1"/>
1265
+ <xref target="note2"/>
1266
+ <xref target="AN"/>
1267
+ <xref target="Anote1"/>
1268
+ <xref target="Anote2"/>
1269
+ </p>
1270
+ </foreword>
1271
+ </preface>
1272
+ <sections>
1273
+ <clause id="scope"><title>Scope</title>
1274
+ <ol id="N1">
1275
+ <li id="N"><p>A</p>
1276
+ <ol>
1277
+ <li id="note1"><p>A</p>
1278
+ <ol>
1279
+ <li id="note2"><p>A</p>
1280
+ <ol>
1281
+ <li id="AN"><p>A</p>
1282
+ <ol>
1283
+ <li id="Anote1"><p>A</p>
1284
+ <ol>
1285
+ <li id="Anote2"><p>A</p></li>
1286
+ </ol></li>
1287
+ </ol></li>
1288
+ </ol></li>
1289
+ </ol></li>
1290
+ </ol></li>
1291
+ </ol>
1292
+ </clause>
1293
+ </sections>
1294
+ </iso-standard>
1295
+ INPUT
1296
+ #{HTML_HDR}
1297
+ <br/>
1298
+ <div>
1299
+ <h1 class="ForewordTitle">Foreword</h1>
1300
+ <p>
1301
+ <a href="#N">Clause 1, a)</a>
1302
+ <a href="#note1">Clause 1, a.1)</a>
1303
+ <a href="#note2">Clause 1, a.1.i)</a>
1304
+ <a href="#AN">Clause 1, a.1.i.A)</a>
1305
+ <a href="#Anote1">Clause 1, a.1.i.A.I)</a>
1306
+ <a href="#Anote2">Clause 1, a.1.i.A.I.a)</a>
1307
+ </p>
1308
+ </div>
1309
+ <p class="zzSTDTitle1"/>
1310
+ <div id="scope">
1311
+ <h1>1.&#160; Scope</h1>
1312
+ <ol type="a">
1313
+ <li><p>A</p>
1314
+ <ol type="1">
1315
+ <li><p>A</p>
1316
+ <ol type="i">
1317
+ <li><p>A</p>
1318
+ <ol type="A">
1319
+ <li><p>A</p>
1320
+ <ol type="I">
1321
+ <li><p>A</p>
1322
+ <ol type="a">
1323
+ <li><p>A</p></li>
1324
+ </ol></li>
1325
+ </ol></li>
1326
+ </ol></li>
1327
+ </ol></li>
1328
+ </ol></li>
1329
+ </ol>
1330
+ </div>
1331
+ </div>
1332
+ </body>
1333
+ </html>
1334
+ OUTPUT
1335
+ end
1336
+
1337
+ end