metanorma-iso 2.1.6 → 2.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +3 -1
  3. data/.github/workflows/release.yml +24 -0
  4. data/lib/isodoc/iso/html/html_iso_titlepage.html +2 -2
  5. data/lib/isodoc/iso/html/style-human.css +34 -2
  6. data/lib/isodoc/iso/html/style-human.scss +35 -1
  7. data/lib/isodoc/iso/html/style-iso.css +34 -2
  8. data/lib/isodoc/iso/html/style-iso.scss +36 -1
  9. data/lib/isodoc/iso/i18n-en.yaml +4 -0
  10. data/lib/isodoc/iso/i18n-fr.yaml +5 -0
  11. data/lib/isodoc/iso/i18n-ru.yaml +4 -0
  12. data/lib/isodoc/iso/i18n-zh-Hans.yaml +5 -0
  13. data/lib/isodoc/iso/init.rb +4 -0
  14. data/lib/isodoc/iso/iso.amendment.xsl +195 -197
  15. data/lib/isodoc/iso/iso.international-standard.xsl +195 -197
  16. data/lib/isodoc/iso/presentation_xml_convert.rb +22 -6
  17. data/lib/isodoc/iso/xref.rb +35 -4
  18. data/lib/metanorma/iso/base.rb +4 -0
  19. data/lib/metanorma/iso/biblio.rng +8 -5
  20. data/lib/metanorma/iso/cleanup.rb +5 -1
  21. data/lib/metanorma/iso/front_id.rb +63 -38
  22. data/lib/metanorma/iso/section.rb +5 -0
  23. data/lib/metanorma/iso/validate.rb +3 -2
  24. data/lib/metanorma/iso/version.rb +1 -1
  25. data/lib/metanorma/requirements/modspec.rb +60 -0
  26. data/lib/metanorma/requirements/requirements.rb +16 -0
  27. data/lib/metanorma-iso.rb +2 -1
  28. data/metanorma-iso.gemspec +1 -1
  29. data/spec/assets/iso.adoc +10 -0
  30. data/spec/examples/rice_img/1000-1_ed2amd3fig1a.png +0 -0
  31. data/spec/examples/rice_img/1000-1_ed2amd3fig1b.png +0 -0
  32. data/spec/examples/rice_img/1000-1_ed2amd3fig2.png +0 -0
  33. data/spec/examples/rice_img/1000-1_ed2amd3fig3.png +0 -0
  34. data/spec/examples/rice_img/1000-1_ed2amd3fig4.png +0 -0
  35. data/spec/examples/rice_img/1000-1_ed2amd3fig5_f.png +0 -0
  36. data/spec/examples/rice_img/1000-1_ed2amd3figA.png +0 -0
  37. data/spec/examples/rice_img/1000-1_ed2amd3figA1.png +0 -0
  38. data/spec/examples/rice_img/1000-1_ed2amd3figA2.png +0 -0
  39. data/spec/examples/rice_img/1000-1_ed2amd3figTab1.png +0 -0
  40. data/spec/examples/rice_img/1000-1_ed2amd3figTab2.png +0 -0
  41. data/spec/examples/rice_img/1001_ed2amd3fig1.png +0 -0
  42. data/spec/examples/rice_img/ISO_1213_1.png +0 -0
  43. data/spec/examples/rice_img/SL1000-1_ed2amd3fig1.png +0 -0
  44. data/spec/isodoc/ref_spec.rb +129 -82
  45. data/spec/metanorma/amd_spec.rb +0 -10
  46. data/spec/metanorma/base_spec.rb +15 -12
  47. data/spec/metanorma/cleanup_spec.rb +136 -0
  48. data/spec/metanorma/macros_spec.rb +99 -0
  49. data/spec/metanorma/processor_spec.rb +86 -86
  50. data/spec/metanorma/section_spec.rb +2 -2
  51. data/spec/metanorma/validate_spec.rb +41 -40
  52. data/spec/requirements/requirements_spec.rb +1299 -0
  53. data/spec/requirements/xref_spec.rb +1205 -0
  54. data/spec/vcr_cassettes/docrels.yml +385 -0
  55. data/spec/vcr_cassettes/withdrawn_iso.yml +21 -21
  56. metadata +40 -18
@@ -0,0 +1,1205 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe Metanorma::Requirements::Iso::Modspec do
4
+ it "cross-references requirements" do
5
+ input = <<~INPUT
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <preface>
8
+ <foreword>
9
+ <p>
10
+ <xref target="N1"/>
11
+ <xref target="N2"/>
12
+ <xref target="N"/>
13
+ <xref target="note1"/>
14
+ <xref target="note2"/>
15
+ <xref target="AN"/>
16
+ <xref target="Anote1"/>
17
+ <xref target="Anote2"/>
18
+ </p>
19
+ </foreword>
20
+ <introduction id="intro">
21
+ <requirement model="ogc" id="N1">
22
+ <stem type="AsciiMath">r = 1 %</stem>
23
+ </requirement>
24
+ <clause id="xyz"><title>Preparatory</title>
25
+ <requirement model="ogc" id="N2" unnumbered="true">
26
+ <stem type="AsciiMath">r = 1 %</stem>
27
+ </requirement>
28
+ </clause>
29
+ </introduction>
30
+ </preface>
31
+ <sections>
32
+ <clause id="scope" type="scope"><title>Scope</title>
33
+ <requirement model="ogc" id="N">
34
+ <stem type="AsciiMath">r = 1 %</stem>
35
+ </requirement>
36
+ <p><xref target="N"/></p>
37
+ </clause>
38
+ <terms id="terms"/>
39
+ <clause id="widgets"><title>Widgets</title>
40
+ <clause id="widgets1">
41
+ <requirement model="ogc" id="note1">
42
+ <stem type="AsciiMath">r = 1 %</stem>
43
+ </requirement>
44
+ <requirement model="ogc" id="note2">
45
+ <stem type="AsciiMath">r = 1 %</stem>
46
+ </requirement>
47
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
48
+ </clause>
49
+ </clause>
50
+ </sections>
51
+ <annex id="annex1">
52
+ <clause id="annex1a">
53
+ <requirement model="ogc" id="AN">
54
+ <stem type="AsciiMath">r = 1 %</stem>
55
+ </requirement>
56
+ </clause>
57
+ <clause id="annex1b">
58
+ <requirement model="ogc" id="Anote1" unnumbered="true">
59
+ <stem type="AsciiMath">r = 1 %</stem>
60
+ </requirement>
61
+ <requirement model="ogc" id="Anote2">
62
+ <stem type="AsciiMath">r = 1 %</stem>
63
+ </requirement>
64
+ </clause>
65
+ </annex>
66
+ </iso-standard>
67
+ INPUT
68
+ output = <<~OUTPUT
69
+ <foreword displayorder='1'>
70
+ <p>
71
+ <xref target='N1'>
72
+ <span class='citetbl'>Table 1, Requirement 1</span>
73
+ </xref>
74
+ <xref target='N2'>
75
+ <span class='citetbl'>Table (??), Requirement (??)</span>
76
+ </xref>
77
+ <xref target='N'>
78
+ <span class='citetbl'>Table 2, Requirement 2</span>
79
+ </xref>
80
+ <xref target='note1'>
81
+ <span class='citetbl'>Table 3, Requirement 3</span>
82
+ </xref>
83
+ <xref target='note2'>
84
+ <span class='citetbl'>Table 4, Requirement 4</span>
85
+ </xref>
86
+ <xref target='AN'>
87
+ <span class='citetbl'>Table A.1, Requirement A.1</span>
88
+ </xref>
89
+ <xref target='Anote1'>
90
+ <span class='citetbl'>Table (??), Requirement (??)</span>
91
+ </xref>
92
+ <xref target='Anote2'>
93
+ <span class='citetbl'>Table A.2, Requirement A.2</span>
94
+ </xref>
95
+ </p>
96
+ </foreword>
97
+ OUTPUT
98
+ expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::PresentationXMLConvert.new({})
99
+ .convert("test", input, true))
100
+ .at("//xmlns:foreword").to_xml))
101
+ .to be_equivalent_to xmlpp(output)
102
+ end
103
+
104
+ it "cross-references requirements with labels" do
105
+ input = <<~INPUT
106
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
107
+ <preface>
108
+ <foreword>
109
+ <p>
110
+ <xref target="N1"/>
111
+ <xref target="N2"/>
112
+ <xref target="N"/>
113
+ <xref target="note1"/>
114
+ <xref target="note2"/>
115
+ <xref target="AN"/>
116
+ <xref target="Anote1"/>
117
+ <xref target="Anote2"/>
118
+ </p>
119
+ </foreword>
120
+ <introduction id="intro">
121
+ <requirement model="ogc" id="N1">
122
+ <identifier>/ogc/req1</identifier>
123
+ <stem type="AsciiMath">r = 1 %</stem>
124
+ </requirement>
125
+ <clause id="xyz"><title>Preparatory</title>
126
+ <requirement model="ogc" id="N2" unnumbered="true">
127
+ <identifier>/ogc/req2</identifier>
128
+ <stem type="AsciiMath">r = 1 %</stem>
129
+ </requirement>
130
+ </clause>
131
+ </introduction>
132
+ </preface>
133
+ <sections>
134
+ <clause id="scope" type="scope"><title>Scope</title>
135
+ <requirement model="ogc" id="N">
136
+ <identifier>/ogc/req3</identifier>
137
+ <stem type="AsciiMath">r = 1 %</stem>
138
+ </requirement>
139
+ <p><xref target="N"/></p>
140
+ </clause>
141
+ <terms id="terms"/>
142
+ <clause id="widgets"><title>Widgets</title>
143
+ <clause id="widgets1">
144
+ <requirement model="ogc" id="note1">
145
+ <identifier>/ogc/req4</identifier>
146
+ <stem type="AsciiMath">r = 1 %</stem>
147
+ </requirement>
148
+ <requirement model="ogc" id="note2">
149
+ <identifier>/ogc/req5</identifier>
150
+ <stem type="AsciiMath">r = 1 %</stem>
151
+ </requirement>
152
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
153
+ </clause>
154
+ </clause>
155
+ </sections>
156
+ <annex id="annex1">
157
+ <clause id="annex1a">
158
+ <requirement model="ogc" id="AN">
159
+ <identifier>/ogc/req6</identifier>
160
+ <stem type="AsciiMath">r = 1 %</stem>
161
+ </requirement>
162
+ </clause>
163
+ <clause id="annex1b">
164
+ <requirement model="ogc" id="Anote1" unnumbered="true">
165
+ <identifier>/ogc/req7</identifier>
166
+ <stem type="AsciiMath">r = 1 %</stem>
167
+ </requirement>
168
+ <requirement model="ogc" id="Anote2">
169
+ <identifier>/ogc/req8</identifier>
170
+ <stem type="AsciiMath">r = 1 %</stem>
171
+ </requirement>
172
+ </clause>
173
+ </annex>
174
+ </iso-standard>
175
+ INPUT
176
+ output = <<~OUTPUT
177
+ <foreword displayorder='1'>
178
+ <p>
179
+ <xref target='N1'>
180
+ <span class='citetbl'>Table 1, Requirement 1</span>
181
+ </xref>
182
+ <xref target='N2'>
183
+ <span class='citetbl'>Table (??), Requirement (??)</span>
184
+ </xref>
185
+ <xref target='N'>
186
+ <span class='citetbl'>Table 2, Requirement 2</span>
187
+ </xref>
188
+ <xref target='note1'>
189
+ <span class='citetbl'>Table 3, Requirement 3</span>
190
+ </xref>
191
+ <xref target='note2'>
192
+ <span class='citetbl'>Table 4, Requirement 4</span>
193
+ </xref>
194
+ <xref target='AN'>
195
+ <span class='citetbl'>Table A.1, Requirement A.1</span>
196
+ </xref>
197
+ <xref target='Anote1'>
198
+ <span class='citetbl'>Table (??), Requirement (??)</span>
199
+ </xref>
200
+ <xref target='Anote2'>
201
+ <span class='citetbl'>Table A.2, Requirement A.2</span>
202
+ </xref>
203
+ </p>
204
+ </foreword>
205
+ OUTPUT
206
+ expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::PresentationXMLConvert.new({})
207
+ .convert("test", input, true))
208
+ .at("//xmlns:foreword").to_xml))
209
+ .to be_equivalent_to xmlpp(output)
210
+ end
211
+
212
+ it "cross-references requirement parts" do
213
+ input = <<~INPUT
214
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
215
+ <preface>
216
+ <foreword>
217
+ <p>
218
+ <xref target="N1a"/>
219
+ <xref target="N1b"/>
220
+ <xref target="N2a"/>
221
+ <xref target="N2b"/>
222
+ <xref target="Na"/>
223
+ <xref target="Nb"/>
224
+ <xref target="note1a"/>
225
+ <xref target="note1b"/>
226
+ <xref target="note2a"/>
227
+ <xref target="note2b"/>
228
+ <xref target="ANa"/>
229
+ <xref target="ANb"/>
230
+ <xref target="Anote1a"/>
231
+ <xref target="Anote1b"/>
232
+ <xref target="Anote2a"/>
233
+ <xref target="Anote2b"/>
234
+ </p>
235
+ </foreword>
236
+ <introduction id="intro">
237
+ <requirement model="ogc" id="N1">
238
+ <stem type="AsciiMath">r = 1 %</stem>
239
+ <component class="part" id="N1a"/>
240
+ <component class="part" id="N1b"/>
241
+ </requirement>
242
+ <clause id="xyz"><title>Preparatory</title>
243
+ <requirement model="ogc" id="N2" unnumbered="true">
244
+ <stem type="AsciiMath">r = 1 %</stem>
245
+ <component class="part" id="N2a"/>
246
+ <component class="part" id="N2b"/>
247
+ </requirement>
248
+ </clause>
249
+ </introduction>
250
+ </preface>
251
+ <sections>
252
+ <clause id="scope" type="scope"><title>Scope</title>
253
+ <requirement model="ogc" id="N">
254
+ <stem type="AsciiMath">r = 1 %</stem>
255
+ <component class="part" id="Na"/>
256
+ <component class="part" id="Nb"/>
257
+ </requirement>
258
+ <p><xref target="N"/></p>
259
+ </clause>
260
+ <terms id="terms"/>
261
+ <clause id="widgets"><title>Widgets</title>
262
+ <clause id="widgets1">
263
+ <requirement model="ogc" id="note1">
264
+ <stem type="AsciiMath">r = 1 %</stem>
265
+ <component class="part" id="note1a"/>
266
+ <component class="part" id="note1b"/>
267
+ </requirement>
268
+ <requirement model="ogc" id="note2">
269
+ <stem type="AsciiMath">r = 1 %</stem>
270
+ <component class="part" id="note2a"/>
271
+ <component class="part" id="note2b"/>
272
+ </requirement>
273
+ <p> <xref target="note1a"/> <xref target="note2b"/> </p>
274
+ </clause>
275
+ </clause>
276
+ </sections>
277
+ <annex id="annex1">
278
+ <clause id="annex1a">
279
+ <requirement model="ogc" id="AN">
280
+ <stem type="AsciiMath">r = 1 %</stem>
281
+ <component class="part" id="ANa"/>
282
+ <component class="part" id="ANb"/>
283
+ </requirement>
284
+ </clause>
285
+ <clause id="annex1b">
286
+ <requirement model="ogc" id="Anote1" unnumbered="true">
287
+ <stem type="AsciiMath">r = 1 %</stem>
288
+ <component class="part" id="Anote1a"/>
289
+ <component class="part" id="Anote1b"/>
290
+ </requirement>
291
+ <requirement model="ogc" id="Anote2">
292
+ <stem type="AsciiMath">r = 1 %</stem>
293
+ <component class="part" id="Anote2a"/>
294
+ <component class="part" id="Anote2b"/>
295
+ </requirement>
296
+ </clause>
297
+ </annex>
298
+ </iso-standard>
299
+ INPUT
300
+ output = <<~OUTPUT
301
+ <foreword displayorder='1'>
302
+ <p>
303
+ <xref target='N1a'>Table 1, Requirement 1 A</xref>
304
+ <xref target='N1b'>Table 1, Requirement 1 B</xref>
305
+ <xref target='N2a'>Table (??), Requirement A</xref>
306
+ <xref target='N2b'>Table (??), Requirement B</xref>
307
+ <xref target='Na'>Table 2, Requirement 2 A</xref>
308
+ <xref target='Nb'>Table 2, Requirement 2 B</xref>
309
+ <xref target='note1a'>Table 3, Requirement 3 A</xref>
310
+ <xref target='note1b'>Table 3, Requirement 3 B</xref>
311
+ <xref target='note2a'>Table 4, Requirement 4 A</xref>
312
+ <xref target='note2b'>Table 4, Requirement 4 B</xref>
313
+ <xref target='ANa'>Table A.1, Requirement A.1 A</xref>
314
+ <xref target='ANb'>Table A.1, Requirement A.1 B</xref>
315
+ <xref target='Anote1a'>Table (??), Requirement A. A</xref>
316
+ <xref target='Anote1b'>Table (??), Requirement A. B</xref>
317
+ <xref target='Anote2a'>Table A.2, Requirement A.2 A</xref>
318
+ <xref target='Anote2b'>Table A.2, Requirement A.2 B</xref>
319
+ </p>
320
+ </foreword>
321
+ OUTPUT
322
+ expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::PresentationXMLConvert.new({})
323
+ .convert("test", input, true))
324
+ .at("//xmlns:foreword").to_xml))
325
+ .to be_equivalent_to xmlpp(output)
326
+ end
327
+
328
+ it "cross-references requirement tests" do
329
+ input = <<~INPUT
330
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
331
+ <preface>
332
+ <foreword>
333
+ <p>
334
+ <xref target="N1"/>
335
+ <xref target="N2"/>
336
+ <xref target="N"/>
337
+ <xref target="note1"/>
338
+ <xref target="note2"/>
339
+ <xref target="AN"/>
340
+ <xref target="Anote1"/>
341
+ <xref target="Anote2"/>
342
+ </p>
343
+ </foreword>
344
+ <introduction id="intro">
345
+ <requirement model="ogc" id="N1" type="verification">
346
+ <stem type="AsciiMath">r = 1 %</stem>
347
+ </requirement>
348
+ <clause id="xyz"><title>Preparatory</title>
349
+ <requirement model="ogc" id="N2" unnumbered="true" type="verification">
350
+ <stem type="AsciiMath">r = 1 %</stem>
351
+ </requirement>
352
+ </clause>
353
+ </introduction>
354
+ </preface>
355
+ <sections>
356
+ <clause id="scope" type="scope"><title>Scope</title>
357
+ <requirement model="ogc" id="N" type="verification">
358
+ <stem type="AsciiMath">r = 1 %</stem>
359
+ </requirement>
360
+ <p><xref target="N"/></p>
361
+ </clause>
362
+ <terms id="terms"/>
363
+ <clause id="widgets"><title>Widgets</title>
364
+ <clause id="widgets1">
365
+ <requirement model="ogc" id="note1" type="verification">
366
+ <stem type="AsciiMath">r = 1 %</stem>
367
+ </requirement>
368
+ <requirement model="ogc" id="note2" type="verification">
369
+ <stem type="AsciiMath">r = 1 %</stem>
370
+ </requirement>
371
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
372
+ </clause>
373
+ </clause>
374
+ </sections>
375
+ <annex id="annex1">
376
+ <clause id="annex1a">
377
+ <requirement model="ogc" id="AN" type="verification">
378
+ <stem type="AsciiMath">r = 1 %</stem>
379
+ </requirement>
380
+ </clause>
381
+ <clause id="annex1b">
382
+ <requirement model="ogc" id="Anote1" unnumbered="true" type="verification">
383
+ <stem type="AsciiMath">r = 1 %</stem>
384
+ </requirement>
385
+ <requirement model="ogc" id="Anote2" type="verification">
386
+ <stem type="AsciiMath">r = 1 %</stem>
387
+ </requirement>
388
+ </clause>
389
+ </annex>
390
+ </iso-standard>
391
+ INPUT
392
+ output = <<~OUTPUT
393
+ <foreword displayorder='1'>
394
+ <p>
395
+ <xref target='N1'>
396
+ <span class='citetbl'>Table 1, Requirement test 1</span>
397
+ </xref>
398
+ <xref target='N2'>
399
+ <span class='citetbl'>Table (??), Requirement test (??)</span>
400
+ </xref>
401
+ <xref target='N'>
402
+ <span class='citetbl'>Table 2, Requirement test 2</span>
403
+ </xref>
404
+ <xref target='note1'>
405
+ <span class='citetbl'>Table 3, Requirement test 3</span>
406
+ </xref>
407
+ <xref target='note2'>
408
+ <span class='citetbl'>Table 4, Requirement test 4</span>
409
+ </xref>
410
+ <xref target='AN'>
411
+ <span class='citetbl'>Table A.1, Requirement test A.1</span>
412
+ </xref>
413
+ <xref target='Anote1'>
414
+ <span class='citetbl'>Table (??), Requirement test (??)</span>
415
+ </xref>
416
+ <xref target='Anote2'>
417
+ <span class='citetbl'>Table A.2, Requirement test A.2</span>
418
+ </xref>
419
+ </p>
420
+ </foreword>
421
+ OUTPUT
422
+ expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::PresentationXMLConvert.new({})
423
+ .convert("test", input, true))
424
+ .at("//xmlns:foreword").to_xml))
425
+ .to be_equivalent_to xmlpp(output)
426
+ end
427
+
428
+ it "cross-references requirement tests in French" do
429
+ input = <<~INPUT
430
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
431
+ <bibdata><language>fr</language></bibdata>
432
+ <preface>
433
+ <foreword>
434
+ <p>
435
+ <xref target="N1"/>
436
+ <xref target="N2"/>
437
+ <xref target="N"/>
438
+ <xref target="note1"/>
439
+ <xref target="note2"/>
440
+ <xref target="AN"/>
441
+ <xref target="Anote1"/>
442
+ <xref target="Anote2"/>
443
+ </p>
444
+ </foreword>
445
+ <introduction id="intro">
446
+ <requirement model="ogc" id="N1" type="verification">
447
+ <stem type="AsciiMath">r = 1 %</stem>
448
+ </requirement>
449
+ <clause id="xyz"><title>Preparatory</title>
450
+ <requirement model="ogc" id="N2" unnumbered="true" type="verification">
451
+ <stem type="AsciiMath">r = 1 %</stem>
452
+ </requirement>
453
+ </clause>
454
+ </introduction>
455
+ </preface>
456
+ <sections>
457
+ <clause id="scope" type="scope"><title>Scope</title>
458
+ <requirement model="ogc" id="N" type="verification">
459
+ <stem type="AsciiMath">r = 1 %</stem>
460
+ </requirement>
461
+ <p><xref target="N"/></p>
462
+ </clause>
463
+ <terms id="terms"/>
464
+ <clause id="widgets"><title>Widgets</title>
465
+ <clause id="widgets1">
466
+ <requirement model="ogc" id="note1" type="verification">
467
+ <stem type="AsciiMath">r = 1 %</stem>
468
+ </requirement>
469
+ <requirement model="ogc" id="note2" type="verification">
470
+ <stem type="AsciiMath">r = 1 %</stem>
471
+ </requirement>
472
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
473
+ </clause>
474
+ </clause>
475
+ </sections>
476
+ <annex id="annex1">
477
+ <clause id="annex1a">
478
+ <requirement model="ogc" id="AN" type="verification">
479
+ <stem type="AsciiMath">r = 1 %</stem>
480
+ </requirement>
481
+ </clause>
482
+ <clause id="annex1b">
483
+ <requirement model="ogc" id="Anote1" unnumbered="true" type="verification">
484
+ <stem type="AsciiMath">r = 1 %</stem>
485
+ </requirement>
486
+ <requirement model="ogc" id="Anote2" type="verification">
487
+ <stem type="AsciiMath">r = 1 %</stem>
488
+ </requirement>
489
+ </clause>
490
+ </annex>
491
+ </iso-standard>
492
+ INPUT
493
+ output = <<~OUTPUT
494
+ <foreword displayorder='1'>
495
+ <p>
496
+ <xref target='N1'>
497
+ <span class='citetbl'>Tableau 1, Test d’exigence 1</span>
498
+ </xref>
499
+ <xref target='N2'>
500
+ <span class='citetbl'>Tableau (??), Test d’exigence (??)</span>
501
+ </xref>
502
+ <xref target='N'>
503
+ <span class='citetbl'>Tableau 2, Test d’exigence 2</span>
504
+ </xref>
505
+ <xref target='note1'>
506
+ <span class='citetbl'>Tableau 3, Test d’exigence 3</span>
507
+ </xref>
508
+ <xref target='note2'>
509
+ <span class='citetbl'>Tableau 4, Test d’exigence 4</span>
510
+ </xref>
511
+ <xref target='AN'>
512
+ <span class='citetbl'>Tableau A.1, Test d’exigence A.1</span>
513
+ </xref>
514
+ <xref target='Anote1'>
515
+ <span class='citetbl'>Tableau (??), Test d’exigence (??)</span>
516
+ </xref>
517
+ <xref target='Anote2'>
518
+ <span class='citetbl'>Tableau A.2, Test d’exigence A.2</span>
519
+ </xref>
520
+ </p>
521
+ </foreword>
522
+ OUTPUT
523
+ expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::PresentationXMLConvert.new({})
524
+ .convert("test", input, true))
525
+ .at("//xmlns:foreword").to_xml))
526
+ .to be_equivalent_to xmlpp(output)
527
+ end
528
+
529
+ it "cross-references recommendations" do
530
+ input = <<~INPUT
531
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
532
+ <preface>
533
+ <foreword>
534
+ <p>
535
+ <xref target="N1"/>
536
+ <xref target="N2"/>
537
+ <xref target="N"/>
538
+ <xref target="note1"/>
539
+ <xref target="note2"/>
540
+ <xref target="AN"/>
541
+ <xref target="Anote1"/>
542
+ <xref target="Anote2"/>
543
+ </p>
544
+ </foreword>
545
+ <introduction id="intro">
546
+ <recommendation model="ogc" id="N1">
547
+ <stem type="AsciiMath">r = 1 %</stem>
548
+ </recommendation>
549
+ <clause id="xyz"><title>Preparatory</title>
550
+ <recommendation model="ogc" id="N2" unnumbered="true">
551
+ <stem type="AsciiMath">r = 1 %</stem>
552
+ </recommendation>
553
+ </clause>
554
+ </introduction>
555
+ </preface>
556
+ <sections>
557
+ <clause id="scope" type="scope"><title>Scope</title>
558
+ <recommendation model="ogc" id="N">
559
+ <stem type="AsciiMath">r = 1 %</stem>
560
+ </recommendation>
561
+ <p><xref target="N"/></p>
562
+ </clause>
563
+ <terms id="terms"/>
564
+ <clause id="widgets"><title>Widgets</title>
565
+ <clause id="widgets1">
566
+ <recommendation model="ogc" id="note1">
567
+ <stem type="AsciiMath">r = 1 %</stem>
568
+ </recommendation>
569
+ <recommendation model="ogc" id="note2">
570
+ <stem type="AsciiMath">r = 1 %</stem>
571
+ </recommendation>
572
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
573
+ </clause>
574
+ </clause>
575
+ </sections>
576
+ <annex id="annex1">
577
+ <clause id="annex1a">
578
+ <recommendation model="ogc" id="AN">
579
+ <stem type="AsciiMath">r = 1 %</stem>
580
+ </recommendation>
581
+ </clause>
582
+ <clause id="annex1b">
583
+ <recommendation model="ogc" id="Anote1" unnumbered="true">
584
+ <stem type="AsciiMath">r = 1 %</stem>
585
+ </recommendation>
586
+ <recommendation model="ogc" id="Anote2">
587
+ <stem type="AsciiMath">r = 1 %</stem>
588
+ </recommendation>
589
+ </clause>
590
+ </annex>
591
+ </iso-standard>
592
+ INPUT
593
+ output = <<~OUTPUT
594
+ <foreword displayorder='1'>
595
+ <p>
596
+ <xref target='N1'>
597
+ <span class='citetbl'>Table 1, Recommendation 1</span>
598
+ </xref>
599
+ <xref target='N2'>
600
+ <span class='citetbl'>Table (??), Recommendation (??)</span>
601
+ </xref>
602
+ <xref target='N'>
603
+ <span class='citetbl'>Table 2, Recommendation 2</span>
604
+ </xref>
605
+ <xref target='note1'>
606
+ <span class='citetbl'>Table 3, Recommendation 3</span>
607
+ </xref>
608
+ <xref target='note2'>
609
+ <span class='citetbl'>Table 4, Recommendation 4</span>
610
+ </xref>
611
+ <xref target='AN'>
612
+ <span class='citetbl'>Table A.1, Recommendation A.1</span>
613
+ </xref>
614
+ <xref target='Anote1'>
615
+ <span class='citetbl'>Table (??), Recommendation (??)</span>
616
+ </xref>
617
+ <xref target='Anote2'>
618
+ <span class='citetbl'>Table A.2, Recommendation A.2</span>
619
+ </xref>
620
+ </p>
621
+ </foreword>
622
+ OUTPUT
623
+ expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::PresentationXMLConvert.new({})
624
+ .convert("test", input, true))
625
+ .at("//xmlns:foreword").to_xml))
626
+ .to be_equivalent_to xmlpp(output)
627
+ end
628
+
629
+ it "cross-references recommendation tests" do
630
+ input = <<~INPUT
631
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
632
+ <preface>
633
+ <foreword>
634
+ <p>
635
+ <xref target="N1"/>
636
+ <xref target="N2"/>
637
+ <xref target="N"/>
638
+ <xref target="note1"/>
639
+ <xref target="note2"/>
640
+ <xref target="AN"/>
641
+ <xref target="Anote1"/>
642
+ <xref target="Anote2"/>
643
+ </p>
644
+ </foreword>
645
+ <introduction id="intro">
646
+ <recommendation model="ogc" id="N1" type="verification">
647
+ <stem type="AsciiMath">r = 1 %</stem>
648
+ </recommendation>
649
+ <clause id="xyz"><title>Preparatory</title>
650
+ <recommendation model="ogc" id="N2" unnumbered="true" type="verification">
651
+ <stem type="AsciiMath">r = 1 %</stem>
652
+ </recommendation>
653
+ </clause>
654
+ </introduction>
655
+ </preface>
656
+ <sections>
657
+ <clause id="scope" type="scope"><title>Scope</title>
658
+ <recommendation model="ogc" id="N" type="verification">
659
+ <stem type="AsciiMath">r = 1 %</stem>
660
+ </recommendation>
661
+ <p><xref target="N"/></p>
662
+ </clause>
663
+ <terms id="terms"/>
664
+ <clause id="widgets"><title>Widgets</title>
665
+ <clause id="widgets1">
666
+ <recommendation model="ogc" id="note1" type="verification">
667
+ <stem type="AsciiMath">r = 1 %</stem>
668
+ </recommendation>
669
+ <recommendation model="ogc" id="note2" type="verification">
670
+ <stem type="AsciiMath">r = 1 %</stem>
671
+ </recommendation>
672
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
673
+ </clause>
674
+ </clause>
675
+ </sections>
676
+ <annex id="annex1">
677
+ <clause id="annex1a">
678
+ <recommendation model="ogc" id="AN" type="verification">
679
+ <stem type="AsciiMath">r = 1 %</stem>
680
+ </recommendation>
681
+ </clause>
682
+ <clause id="annex1b">
683
+ <recommendation model="ogc" id="Anote1" unnumbered="true" type="verification">
684
+ <stem type="AsciiMath">r = 1 %</stem>
685
+ </recommendation>
686
+ <recommendation model="ogc" id="Anote2" type="verification">
687
+ <stem type="AsciiMath">r = 1 %</stem>
688
+ </recommendation>
689
+ </clause>
690
+ </annex>
691
+ </iso-standard>
692
+ INPUT
693
+ output = <<~OUTPUT
694
+ <foreword displayorder='1'>
695
+ <p>
696
+ <xref target='N1'>
697
+ <span class='citetbl'>Table 1, Recommendation test 1</span>
698
+ </xref>
699
+ <xref target='N2'>
700
+ <span class='citetbl'>Table (??), Recommendation test (??)</span>
701
+ </xref>
702
+ <xref target='N'>
703
+ <span class='citetbl'>Table 2, Recommendation test 2</span>
704
+ </xref>
705
+ <xref target='note1'>
706
+ <span class='citetbl'>Table 3, Recommendation test 3</span>
707
+ </xref>
708
+ <xref target='note2'>
709
+ <span class='citetbl'>Table 4, Recommendation test 4</span>
710
+ </xref>
711
+ <xref target='AN'>
712
+ <span class='citetbl'>Table A.1, Recommendation test A.1</span>
713
+ </xref>
714
+ <xref target='Anote1'>
715
+ <span class='citetbl'>Table (??), Recommendation test (??)</span>
716
+ </xref>
717
+ <xref target='Anote2'>
718
+ <span class='citetbl'>Table A.2, Recommendation test A.2</span>
719
+ </xref>
720
+ </p>
721
+ </foreword>
722
+ OUTPUT
723
+ expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::PresentationXMLConvert.new({})
724
+ .convert("test", input, true))
725
+ .at("//xmlns:foreword").to_xml))
726
+ .to be_equivalent_to xmlpp(output)
727
+ end
728
+
729
+ it "cross-references permissions" do
730
+ input = <<~INPUT
731
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
732
+ <preface>
733
+ <foreword>
734
+ <p>
735
+ <xref target="N1"/>
736
+ <xref target="N2"/>
737
+ <xref target="N"/>
738
+ <xref target="note1"/>
739
+ <xref target="note2"/>
740
+ <xref target="AN"/>
741
+ <xref target="Anote1"/>
742
+ <xref target="Anote2"/>
743
+ </p>
744
+ </foreword>
745
+ <introduction id="intro">
746
+ <permission model="ogc" id="N1">
747
+ <stem type="AsciiMath">r = 1 %</stem>
748
+ </permission>
749
+ <clause id="xyz"><title>Preparatory</title>
750
+ <permission model="ogc" id="N2" unnumbered="true">
751
+ <stem type="AsciiMath">r = 1 %</stem>
752
+ </permission>
753
+ </clause>
754
+ </introduction>
755
+ </preface>
756
+ <sections>
757
+ <clause id="scope" type="scope"><title>Scope</title>
758
+ <permission model="ogc" id="N">
759
+ <stem type="AsciiMath">r = 1 %</stem>
760
+ </permission>
761
+ <p><xref target="N"/></p>
762
+ </clause>
763
+ <terms id="terms"/>
764
+ <clause id="widgets"><title>Widgets</title>
765
+ <clause id="widgets1">
766
+ <permission model="ogc" id="note1">
767
+ <stem type="AsciiMath">r = 1 %</stem>
768
+ </permission>
769
+ <permission model="ogc" id="note2">
770
+ <stem type="AsciiMath">r = 1 %</stem>
771
+ </permission>
772
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
773
+ </clause>
774
+ </clause>
775
+ </sections>
776
+ <annex id="annex1">
777
+ <clause id="annex1a">
778
+ <permission model="ogc" id="AN">
779
+ <stem type="AsciiMath">r = 1 %</stem>
780
+ </permission>
781
+ </clause>
782
+ <clause id="annex1b">
783
+ <permission model="ogc" id="Anote1" unnumbered="true">
784
+ <stem type="AsciiMath">r = 1 %</stem>
785
+ </permission>
786
+ <permission model="ogc" id="Anote2">
787
+ <stem type="AsciiMath">r = 1 %</stem>
788
+ </permission>
789
+ </clause>
790
+ </annex>
791
+ </iso-standard>
792
+ INPUT
793
+ output = <<~OUTPUT
794
+ <foreword displayorder='1'>
795
+ <p>
796
+ <xref target='N1'>
797
+ <span class='citetbl'>Table 1, Permission 1</span>
798
+ </xref>
799
+ <xref target='N2'>
800
+ <span class='citetbl'>Table (??), Permission (??)</span>
801
+ </xref>
802
+ <xref target='N'>
803
+ <span class='citetbl'>Table 2, Permission 2</span>
804
+ </xref>
805
+ <xref target='note1'>
806
+ <span class='citetbl'>Table 3, Permission 3</span>
807
+ </xref>
808
+ <xref target='note2'>
809
+ <span class='citetbl'>Table 4, Permission 4</span>
810
+ </xref>
811
+ <xref target='AN'>
812
+ <span class='citetbl'>Table A.1, Permission A.1</span>
813
+ </xref>
814
+ <xref target='Anote1'>
815
+ <span class='citetbl'>Table (??), Permission (??)</span>
816
+ </xref>
817
+ <xref target='Anote2'>
818
+ <span class='citetbl'>Table A.2, Permission A.2</span>
819
+ </xref>
820
+ </p>
821
+ </foreword>
822
+ OUTPUT
823
+ expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::PresentationXMLConvert.new({})
824
+ .convert("test", input, true))
825
+ .at("//xmlns:foreword").to_xml))
826
+ .to be_equivalent_to xmlpp(output)
827
+ end
828
+
829
+ it "cross-references permission tests" do
830
+ input = <<~INPUT
831
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
832
+ <preface>
833
+ <foreword>
834
+ <p>
835
+ <xref target="N1"/>
836
+ <xref target="N2"/>
837
+ <xref target="N"/>
838
+ <xref target="note1"/>
839
+ <xref target="note2"/>
840
+ <xref target="AN"/>
841
+ <xref target="Anote1"/>
842
+ <xref target="Anote2"/>
843
+ </p>
844
+ </foreword>
845
+ <introduction id="intro">
846
+ <permission model="ogc" id="N1" type="verification">
847
+ <stem type="AsciiMath">r = 1 %</stem>
848
+ </permission>
849
+ <clause id="xyz"><title>Preparatory</title>
850
+ <permission model="ogc" id="N2" unnumbered="true" type="verification">
851
+ <stem type="AsciiMath">r = 1 %</stem>
852
+ </permission>
853
+ </clause>
854
+ </introduction>
855
+ </preface>
856
+ <sections>
857
+ <clause id="scope" type="scope"><title>Scope</title>
858
+ <permission model="ogc" id="N" type="verification">
859
+ <stem type="AsciiMath">r = 1 %</stem>
860
+ </permission>
861
+ <p><xref target="N"/></p>
862
+ </clause>
863
+ <terms id="terms"/>
864
+ <clause id="widgets"><title>Widgets</title>
865
+ <clause id="widgets1">
866
+ <permission model="ogc" id="note1" type="verification">
867
+ <stem type="AsciiMath">r = 1 %</stem>
868
+ </permission>
869
+ <permission model="ogc" id="note2" type="verification">
870
+ <stem type="AsciiMath">r = 1 %</stem>
871
+ </permission>
872
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
873
+ </clause>
874
+ </clause>
875
+ </sections>
876
+ <annex id="annex1">
877
+ <clause id="annex1a">
878
+ <permission model="ogc" id="AN" type="verification">
879
+ <stem type="AsciiMath">r = 1 %</stem>
880
+ </permission>
881
+ </clause>
882
+ <clause id="annex1b">
883
+ <permission model="ogc" id="Anote1" unnumbered="true" type="verification">
884
+ <stem type="AsciiMath">r = 1 %</stem>
885
+ </permission>
886
+ <permission model="ogc" id="Anote2" type="verification">
887
+ <stem type="AsciiMath">r = 1 %</stem>
888
+ </permission>
889
+ </clause>
890
+ </annex>
891
+ </iso-standard>
892
+ INPUT
893
+ output = <<~OUTPUT
894
+ <foreword displayorder='1'>
895
+ <p>
896
+ <xref target='N1'>
897
+ <span class='citetbl'>Table 1, Permission test 1</span>
898
+ </xref>
899
+ <xref target='N2'>
900
+ <span class='citetbl'>Table (??), Permission test (??)</span>
901
+ </xref>
902
+ <xref target='N'>
903
+ <span class='citetbl'>Table 2, Permission test 2</span>
904
+ </xref>
905
+ <xref target='note1'>
906
+ <span class='citetbl'>Table 3, Permission test 3</span>
907
+ </xref>
908
+ <xref target='note2'>
909
+ <span class='citetbl'>Table 4, Permission test 4</span>
910
+ </xref>
911
+ <xref target='AN'>
912
+ <span class='citetbl'>Table A.1, Permission test A.1</span>
913
+ </xref>
914
+ <xref target='Anote1'>
915
+ <span class='citetbl'>Table (??), Permission test (??)</span>
916
+ </xref>
917
+ <xref target='Anote2'>
918
+ <span class='citetbl'>Table A.2, Permission test A.2</span>
919
+ </xref>
920
+ </p>
921
+ </foreword>
922
+ OUTPUT
923
+ expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::PresentationXMLConvert.new({})
924
+ .convert("test", input, true))
925
+ .at("//xmlns:foreword").to_xml))
926
+ .to be_equivalent_to xmlpp(output)
927
+ end
928
+
929
+ it "labels and cross-references nested requirements" do
930
+ input = <<~INPUT
931
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
932
+ <preface>
933
+ <foreword>
934
+ <p>
935
+ <xref target="N1"/>
936
+ <xref target="N2"/>
937
+ <xref target="N"/>
938
+ <xref target="Q1"/>
939
+ <xref target="R1"/>
940
+ <xref target="AN1"/>
941
+ <xref target="AN2"/>
942
+ <xref target="AN"/>
943
+ <xref target="AQ1"/>
944
+ <xref target="AR1"/>
945
+ </p>
946
+ </foreword>
947
+ </preface>
948
+ <sections>
949
+ <clause id="xyz"><title>Preparatory</title>
950
+ <permission model="ogc" id="N1">
951
+ <permission model="ogc" id="N2" type="verification">
952
+ <permission model="ogc" id="N">
953
+ </permission>
954
+ </permission>
955
+ <requirement model="ogc" id="Q1">
956
+ </requirement>
957
+ <recommendation model="ogc" id="R1">
958
+ </recommendation>
959
+ <permission model="ogc" id="N3" type="verification"/>
960
+ <permission model="ogc" id="N4"/>
961
+ </permission>
962
+ </clause>
963
+ </sections>
964
+ <annex id="Axyz"><title>Preparatory</title>
965
+ <permission model="ogc" id="AN1" type="verification">
966
+ <permission model="ogc" id="AN2">
967
+ <permission model="ogc" id="AN" type="verification">
968
+ </permission>
969
+ </permission>
970
+ <requirement model="ogc" id="AQ1">
971
+ </requirement>
972
+ <recommendation model="ogc" id="AR1">
973
+ </recommendation>
974
+ <permission model="ogc" id="AN3" type="verification"/>
975
+ <permission model="ogc" id="AN4"/>
976
+ </permission>
977
+ </annex>
978
+ </iso-standard>
979
+ INPUT
980
+ output = <<~OUTPUT
981
+ <foreword displayorder='1'>
982
+ <p>
983
+ <xref target='N1'>
984
+ <span class='citetbl'>Table 1, Permission 1</span>
985
+ </xref>
986
+ <xref target='N2'>Table 1, Permission test 1-1</xref>
987
+ <xref target='N'>Table 1, Permission 1-1-1</xref>
988
+ <xref target='Q1'>Table 1, Requirement 1-1</xref>
989
+ <xref target='R1'>Table 1, Recommendation 1-1</xref>
990
+ <xref target='AN1'>
991
+ <span class='citetbl'>Table A.1, Permission test A.1</span>
992
+ </xref>
993
+ <xref target='AN2'>Table A.1, Permission A.1-1</xref>
994
+ <xref target='AN'>Table A.1, Permission test A.1-1-1</xref>
995
+ <xref target='AQ1'>Table A.1, Requirement A.1-1</xref>
996
+ <xref target='AR1'>Table A.1, Recommendation A.1-1</xref>
997
+ </p>
998
+ </foreword>
999
+ OUTPUT
1000
+ expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::PresentationXMLConvert.new({})
1001
+ .convert("test", input, true))
1002
+ .at("//xmlns:foreword").to_xml))
1003
+ .to be_equivalent_to xmlpp(output)
1004
+ end
1005
+
1006
+ it "cross-references abstract tests" do
1007
+ input = <<~INPUT
1008
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1009
+ <preface>
1010
+ <foreword>
1011
+ <p>
1012
+ <xref target="N1"/>
1013
+ <xref target="N2"/>
1014
+ <xref target="N"/>
1015
+ <xref target="note1"/>
1016
+ <xref target="note2"/>
1017
+ <xref target="AN"/>
1018
+ <xref target="Anote1"/>
1019
+ <xref target="Anote2"/>
1020
+ </p>
1021
+ </foreword>
1022
+ <introduction id="intro">
1023
+ <permission model="ogc" id="N1" type="abstracttest">
1024
+ <stem type="AsciiMath">r = 1 %</stem>
1025
+ </permission>
1026
+ <clause id="xyz"><title>Preparatory</title>
1027
+ <permission model="ogc" id="N2" unnumbered="true" type="abstracttest">
1028
+ <stem type="AsciiMath">r = 1 %</stem>
1029
+ </permission>
1030
+ </clause>
1031
+ </introduction>
1032
+ </preface>
1033
+ <sections>
1034
+ <clause id="scope" type="scope"><title>Scope</title>
1035
+ <permission model="ogc" id="N" type="abstracttest">
1036
+ <stem type="AsciiMath">r = 1 %</stem>
1037
+ </permission>
1038
+ <p><xref target="N"/></p>
1039
+ </clause>
1040
+ <terms id="terms"/>
1041
+ <clause id="widgets"><title>Widgets</title>
1042
+ <clause id="widgets1">
1043
+ <permission model="ogc" id="note1" type="abstracttest">
1044
+ <stem type="AsciiMath">r = 1 %</stem>
1045
+ </permission>
1046
+ <permission model="ogc" id="note2" type="abstracttest">
1047
+ <stem type="AsciiMath">r = 1 %</stem>
1048
+ </permission>
1049
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
1050
+ </clause>
1051
+ </clause>
1052
+ </sections>
1053
+ <annex id="annex1">
1054
+ <clause id="annex1a">
1055
+ <permission model="ogc" id="AN" type="abstracttest">
1056
+ <stem type="AsciiMath">r = 1 %</stem>
1057
+ </permission>
1058
+ </clause>
1059
+ <clause id="annex1b">
1060
+ <permission model="ogc" id="Anote1" unnumbered="true" type="abstracttest">
1061
+ <stem type="AsciiMath">r = 1 %</stem>
1062
+ </permission>
1063
+ <permission model="ogc" id="Anote2" type="abstracttest">
1064
+ <stem type="AsciiMath">r = 1 %</stem>
1065
+ </permission>
1066
+ </clause>
1067
+ </annex>
1068
+ </iso-standard>
1069
+ INPUT
1070
+ output = <<~OUTPUT
1071
+ <foreword displayorder='1'>
1072
+ <p>
1073
+ <xref target='N1'>
1074
+ <span class='citetbl'>Table 1, Abstract test 1</span>
1075
+ </xref>
1076
+ <xref target='N2'>
1077
+ <span class='citetbl'>Table (??), Abstract test (??)</span>
1078
+ </xref>
1079
+ <xref target='N'>
1080
+ <span class='citetbl'>Table 2, Abstract test 2</span>
1081
+ </xref>
1082
+ <xref target='note1'>
1083
+ <span class='citetbl'>Table 3, Abstract test 3</span>
1084
+ </xref>
1085
+ <xref target='note2'>
1086
+ <span class='citetbl'>Table 4, Abstract test 4</span>
1087
+ </xref>
1088
+ <xref target='AN'>
1089
+ <span class='citetbl'>Table A.1, Abstract test A.1</span>
1090
+ </xref>
1091
+ <xref target='Anote1'>
1092
+ <span class='citetbl'>Table (??), Abstract test (??)</span>
1093
+ </xref>
1094
+ <xref target='Anote2'>
1095
+ <span class='citetbl'>Table A.2, Abstract test A.2</span>
1096
+ </xref>
1097
+ </p>
1098
+ </foreword>
1099
+ OUTPUT
1100
+ expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::PresentationXMLConvert.new({})
1101
+ .convert("test", input, true))
1102
+ .at("//xmlns:foreword").to_xml))
1103
+ .to be_equivalent_to xmlpp(output)
1104
+ end
1105
+
1106
+ it "cross-references conformance classes" do
1107
+ input = <<~INPUT
1108
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1109
+ <preface>
1110
+ <foreword>
1111
+ <p>
1112
+ <xref target="N1"/>
1113
+ <xref target="N2"/>
1114
+ <xref target="N"/>
1115
+ <xref target="note1"/>
1116
+ <xref target="note2"/>
1117
+ <xref target="AN"/>
1118
+ <xref target="Anote1"/>
1119
+ <xref target="Anote2"/>
1120
+ </p>
1121
+ </foreword>
1122
+ <introduction id="intro">
1123
+ <permission model="ogc" id="N1" type="conformanceclass">
1124
+ <stem type="AsciiMath">r = 1 %</stem>
1125
+ </permission>
1126
+ <clause id="xyz"><title>Preparatory</title>
1127
+ <permission model="ogc" id="N2" unnumbered="true" type="conformanceclass">
1128
+ <stem type="AsciiMath">r = 1 %</stem>
1129
+ </permission>
1130
+ </clause>
1131
+ </introduction>
1132
+ </preface>
1133
+ <sections>
1134
+ <clause id="scope" type="scope"><title>Scope</title>
1135
+ <permission model="ogc" id="N" type="conformanceclass">
1136
+ <stem type="AsciiMath">r = 1 %</stem>
1137
+ </permission>
1138
+ <p><xref target="N"/></p>
1139
+ </clause>
1140
+ <terms id="terms"/>
1141
+ <clause id="widgets"><title>Widgets</title>
1142
+ <clause id="widgets1">
1143
+ <permission model="ogc" id="note1" type="conformanceclass">
1144
+ <stem type="AsciiMath">r = 1 %</stem>
1145
+ </permission>
1146
+ <permission model="ogc" id="note2" type="conformanceclass">
1147
+ <stem type="AsciiMath">r = 1 %</stem>
1148
+ </permission>
1149
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
1150
+ </clause>
1151
+ </clause>
1152
+ </sections>
1153
+ <annex id="annex1">
1154
+ <clause id="annex1a">
1155
+ <permission model="ogc" id="AN" type="conformanceclass">
1156
+ <stem type="AsciiMath">r = 1 %</stem>
1157
+ </permission>
1158
+ </clause>
1159
+ <clause id="annex1b">
1160
+ <permission model="ogc" id="Anote1" unnumbered="true" type="conformanceclass">
1161
+ <stem type="AsciiMath">r = 1 %</stem>
1162
+ </permission>
1163
+ <permission model="ogc" id="Anote2" type="conformanceclass">
1164
+ <stem type="AsciiMath">r = 1 %</stem>
1165
+ </permission>
1166
+ </clause>
1167
+ </annex>
1168
+ </iso-standard>
1169
+ INPUT
1170
+ output = <<~OUTPUT
1171
+ <foreword displayorder='1'>
1172
+ <p>
1173
+ <xref target='N1'>
1174
+ <span class='citetbl'>Table 1, Conformance class 1</span>
1175
+ </xref>
1176
+ <xref target='N2'>
1177
+ <span class='citetbl'>Table (??), Conformance class (??)</span>
1178
+ </xref>
1179
+ <xref target='N'>
1180
+ <span class='citetbl'>Table 2, Conformance class 2</span>
1181
+ </xref>
1182
+ <xref target='note1'>
1183
+ <span class='citetbl'>Table 3, Conformance class 3</span>
1184
+ </xref>
1185
+ <xref target='note2'>
1186
+ <span class='citetbl'>Table 4, Conformance class 4</span>
1187
+ </xref>
1188
+ <xref target='AN'>
1189
+ <span class='citetbl'>Table A.1, Conformance class A.1</span>
1190
+ </xref>
1191
+ <xref target='Anote1'>
1192
+ <span class='citetbl'>Table (??), Conformance class (??)</span>
1193
+ </xref>
1194
+ <xref target='Anote2'>
1195
+ <span class='citetbl'>Table A.2, Conformance class A.2</span>
1196
+ </xref>
1197
+ </p>
1198
+ </foreword>
1199
+ OUTPUT
1200
+ expect(xmlpp(Nokogiri::XML(IsoDoc::Iso::PresentationXMLConvert.new({})
1201
+ .convert("test", input, true))
1202
+ .at("//xmlns:foreword").to_xml))
1203
+ .to be_equivalent_to xmlpp(output)
1204
+ end
1205
+ end