isodoc 1.6.0 → 1.6.5

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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +2 -12
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +4 -8
  5. data/Rakefile +2 -2
  6. data/bin/rspec +1 -2
  7. data/isodoc.gemspec +4 -3
  8. data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
  9. data/lib/isodoc-yaml/i18n-de.yaml +149 -0
  10. data/lib/isodoc-yaml/i18n-en.yaml +1 -0
  11. data/lib/isodoc-yaml/i18n-es.yaml +151 -0
  12. data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
  13. data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
  14. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
  15. data/lib/isodoc.rb +0 -2
  16. data/lib/isodoc/common.rb +2 -0
  17. data/lib/isodoc/convert.rb +10 -4
  18. data/lib/isodoc/css.rb +30 -26
  19. data/lib/isodoc/function/blocks.rb +26 -8
  20. data/lib/isodoc/function/blocks_example_note.rb +2 -2
  21. data/lib/isodoc/function/cleanup.rb +53 -45
  22. data/lib/isodoc/function/form.rb +51 -0
  23. data/lib/isodoc/function/inline.rb +8 -7
  24. data/lib/isodoc/function/references.rb +71 -77
  25. data/lib/isodoc/function/section.rb +28 -16
  26. data/lib/isodoc/function/table.rb +22 -22
  27. data/lib/isodoc/function/terms.rb +6 -7
  28. data/lib/isodoc/function/to_word_html.rb +19 -25
  29. data/lib/isodoc/function/utils.rb +180 -160
  30. data/lib/isodoc/gem_tasks.rb +36 -38
  31. data/lib/isodoc/headlesshtml_convert.rb +8 -7
  32. data/lib/isodoc/html_convert.rb +10 -4
  33. data/lib/isodoc/html_function/comments.rb +14 -12
  34. data/lib/isodoc/html_function/footnotes.rb +14 -7
  35. data/lib/isodoc/html_function/form.rb +62 -0
  36. data/lib/isodoc/html_function/html.rb +30 -26
  37. data/lib/isodoc/html_function/postprocess.rb +191 -226
  38. data/lib/isodoc/html_function/postprocess_footnotes.rb +59 -0
  39. data/lib/isodoc/html_function/sectionsplit.rb +230 -0
  40. data/lib/isodoc/i18n.rb +33 -31
  41. data/lib/isodoc/metadata.rb +22 -20
  42. data/lib/isodoc/metadata_contributor.rb +31 -28
  43. data/lib/isodoc/pdf_convert.rb +11 -13
  44. data/lib/isodoc/presentation_function/bibdata.rb +54 -30
  45. data/lib/isodoc/presentation_function/block.rb +17 -8
  46. data/lib/isodoc/presentation_function/inline.rb +72 -120
  47. data/lib/isodoc/presentation_function/math.rb +84 -0
  48. data/lib/isodoc/presentation_function/section.rb +55 -19
  49. data/lib/isodoc/presentation_xml_convert.rb +2 -0
  50. data/lib/isodoc/sassc_importer.rb +1 -1
  51. data/lib/isodoc/version.rb +1 -1
  52. data/lib/isodoc/word_function/body.rb +28 -24
  53. data/lib/isodoc/word_function/footnotes.rb +22 -15
  54. data/lib/isodoc/word_function/postprocess.rb +50 -36
  55. data/lib/isodoc/xref.rb +11 -10
  56. data/lib/isodoc/xref/xref_counter.rb +32 -17
  57. data/lib/isodoc/xref/xref_gen.rb +33 -21
  58. data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
  59. data/lib/isodoc/xref/xref_sect_gen.rb +37 -35
  60. data/spec/assets/scripts_override.html +3 -0
  61. data/spec/isodoc/blocks_spec.rb +2258 -2622
  62. data/spec/isodoc/cleanup_spec.rb +1103 -1107
  63. data/spec/isodoc/form_spec.rb +156 -0
  64. data/spec/isodoc/i18n_spec.rb +802 -917
  65. data/spec/isodoc/inline_spec.rb +1105 -921
  66. data/spec/isodoc/lists_spec.rb +316 -315
  67. data/spec/isodoc/metadata_spec.rb +384 -379
  68. data/spec/isodoc/postproc_spec.rb +1783 -1549
  69. data/spec/isodoc/presentation_xml_spec.rb +355 -278
  70. data/spec/isodoc/ref_spec.rb +718 -723
  71. data/spec/isodoc/section_spec.rb +216 -199
  72. data/spec/isodoc/sectionsplit_spec.rb +190 -0
  73. data/spec/isodoc/table_spec.rb +41 -42
  74. data/spec/isodoc/terms_spec.rb +84 -84
  75. data/spec/isodoc/xref_spec.rb +1024 -930
  76. metadata +33 -7
@@ -1,8 +1,8 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
- it "cross-references external documents in Presentation XML" do
5
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
4
+ it "cross-references external documents" do
5
+ input = <<~INPUT
6
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
7
7
  <preface>
8
8
  <foreword>
@@ -13,10 +13,11 @@ RSpec.describe IsoDoc do
13
13
  </preface>
14
14
  </iso-standard
15
15
  INPUT
16
+ presxml = <<~OUTPUT
16
17
  <?xml version='1.0'?>
17
18
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
18
19
  <preface>
19
- <foreword>
20
+ <foreword displayorder='1'>
20
21
  <p>
21
22
  <xref target='a#b'>a#b</xref>
22
23
  </p>
@@ -24,20 +25,7 @@ RSpec.describe IsoDoc do
24
25
  </preface>
25
26
  </iso-standard>
26
27
  OUTPUT
27
- end
28
-
29
- it "cross-references external documents in HTML" do
30
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
31
- <iso-standard xmlns="http://riboseinc.com/isoxml">
32
- <preface>
33
- <foreword>
34
- <p>
35
- <xref target='a#b'>a#b</xref>
36
- </p>
37
- </foreword>
38
- </preface>
39
- </iso-standard
40
- INPUT
28
+ html = <<~OUTPUT
41
29
  #{HTML_HDR}
42
30
  <br/>
43
31
  <div>
@@ -51,20 +39,7 @@ RSpec.describe IsoDoc do
51
39
  </body>
52
40
  </html>
53
41
  OUTPUT
54
- end
55
-
56
- it "cross-references external documents in DOC" do
57
- expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').sub(%r{</div>.*$}m, "</div></div>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
58
- <iso-standard xmlns="http://riboseinc.com/isoxml">
59
- <preface>
60
- <foreword>
61
- <p>
62
- <xref target='a#b'>a#b</xref>
63
- </p>
64
- </foreword>
65
- </preface>
66
- </iso-standard>
67
- INPUT
42
+ doc = <<~OUTPUT
68
43
  <div class="WordSection2">
69
44
  <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
70
45
  <div>
@@ -74,10 +49,18 @@ RSpec.describe IsoDoc do
74
49
  </p>
75
50
  </div></div>
76
51
  OUTPUT
52
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
53
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
54
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
55
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
56
+ expect(xmlpp(IsoDoc::WordConvert.new({})
57
+ .convert("test", presxml, true)
58
+ .sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">')
59
+ .sub(%r{</div>.*$}m, "</div></div>"))).to be_equivalent_to xmlpp(doc)
77
60
  end
78
61
 
79
62
  it "warns of missing crossreference" do
80
- expect { IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true) }.to output(/No label has been processed for ID N1/).to_stderr
63
+ i = <<~INPUT
81
64
  <iso-standard xmlns="http://riboseinc.com/isoxml">
82
65
  <preface>
83
66
  <foreword>
@@ -86,10 +69,12 @@ RSpec.describe IsoDoc do
86
69
  </preface>
87
70
  </iso-standard>
88
71
  INPUT
72
+ expect { IsoDoc::PresentationXMLConvert.new({}).convert("test", i, true) }
73
+ .to output(/No label has been processed for ID N1/).to_stderr
89
74
  end
90
75
 
91
76
  it "does not warn of missing crossreference if text is supplied" do
92
- expect { IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true) }.not_to output(/No label has been processed for ID N1/).to_stderr
77
+ i = <<~INPUT
93
78
  <iso-standard xmlns="http://riboseinc.com/isoxml">
94
79
  <preface>
95
80
  <foreword>
@@ -98,78 +83,79 @@ RSpec.describe IsoDoc do
98
83
  </preface>
99
84
  </iso-standard>
100
85
  INPUT
86
+ expect { IsoDoc::HtmlConvert.new({}).convert("test", i, true) }
87
+ .not_to output(/No label has been processed for ID N1/).to_stderr
101
88
  end
102
89
 
103
90
  it "cross-references notes" do
104
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
105
- <iso-standard xmlns="http://riboseinc.com/isoxml">
106
- <preface>
107
- <foreword>
108
- <p>
109
- <xref target="N1"/>
110
- <xref target="N2"/>
111
- <xref target="N"/>
112
- <xref target="note1"/>
113
- <xref target="note2"/>
114
- <xref target="AN"/>
115
- <xref target="Anote1"/>
116
- <xref target="Anote2"/>
117
- </p>
118
- </foreword>
119
- <introduction id="intro">
120
- <note id="N1">
121
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83e">These results are based on a study carried out on three different types of kernel.</p>
122
- </note>
123
- <clause id="xyz"><title>Preparatory</title>
124
- <note id="N2">
125
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83d">These results are based on a study carried out on three different types of kernel.</p>
126
- </note>
127
- </clause>
128
- </introduction>
129
- </preface>
130
- <sections>
131
- <clause id="scope" type="scope"><title>Scope</title>
132
- <note id="N">
133
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
134
- </note>
135
- <p><xref target="N"/></p>
136
- #{' '}
137
- </clause>
138
- <terms id="terms"/>
139
- <clause id="widgets"><title>Widgets</title>
140
- <clause id="widgets1">
141
- <note id="note1">
142
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
143
- </note>
144
- <note id="note2">
145
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
146
- </note>
147
- <p> <xref target="note1"/> <xref target="note2"/> </p>
148
- #{' '}
149
- </clause>
150
- </clause>
151
- </sections>
152
- <annex id="annex1">
153
- <clause id="annex1a">
154
- <note id="AN">
155
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
156
- </note>
157
- </clause>
158
- <clause id="annex1b">
159
- <note id="Anote1">
160
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
161
- </note>
162
- <note id="Anote2">
163
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
164
- </note>
165
- </clause>
166
- </annex>
167
- </iso-standard>
91
+ input = <<~INPUT
92
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
93
+ <preface>
94
+ <foreword>
95
+ <p>
96
+ <xref target="N1"/>
97
+ <xref target="N2"/>
98
+ <xref target="N"/>
99
+ <xref target="note1"/>
100
+ <xref target="note2"/>
101
+ <xref target="AN"/>
102
+ <xref target="Anote1"/>
103
+ <xref target="Anote2"/>
104
+ </p>
105
+ </foreword>
106
+ <introduction id="intro">
107
+ <note id="N1">
108
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83e">These results are based on a study carried out on three different types of kernel.</p>
109
+ </note>
110
+ <clause id="xyz"><title>Preparatory</title>
111
+ <note id="N2">
112
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83d">These results are based on a study carried out on three different types of kernel.</p>
113
+ </note>
114
+ </clause>
115
+ </introduction>
116
+ </preface>
117
+ <sections>
118
+ <clause id="scope" type="scope"><title>Scope</title>
119
+ <note id="N">
120
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
121
+ </note>
122
+ <p><xref target="N"/></p>
123
+ </clause>
124
+ <terms id="terms"/>
125
+ <clause id="widgets"><title>Widgets</title>
126
+ <clause id="widgets1">
127
+ <note id="note1">
128
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
129
+ </note>
130
+ <note id="note2">
131
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
132
+ </note>
133
+ <p> <xref target="note1"/> <xref target="note2"/> </p>
134
+ </clause>
135
+ </clause>
136
+ </sections>
137
+ <annex id="annex1">
138
+ <clause id="annex1a">
139
+ <note id="AN">
140
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
141
+ </note>
142
+ </clause>
143
+ <clause id="annex1b">
144
+ <note id="Anote1">
145
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
146
+ </note>
147
+ <note id="Anote2">
148
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
149
+ </note>
150
+ </clause>
151
+ </annex>
152
+ </iso-standard>
168
153
  INPUT
154
+ output = <<~OUTPUT
169
155
  <?xml version='1.0'?>
170
156
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
171
157
  <preface>
172
- <foreword>
158
+ <foreword displayorder='1'>
173
159
  <p>
174
160
  <xref target='N1'>Introduction, Note</xref>
175
161
  <xref target='N2'>Preparatory, Note</xref>
@@ -181,7 +167,7 @@ RSpec.describe IsoDoc do
181
167
  <xref target='Anote2'>Annex A.2, Note 2</xref>
182
168
  </p>
183
169
  </foreword>
184
- <introduction id='intro'>
170
+ <introduction id='intro' displayorder="2">
185
171
  <note id='N1'>
186
172
  <name>NOTE</name>
187
173
  <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83e'>
@@ -202,7 +188,7 @@ RSpec.describe IsoDoc do
202
188
  </introduction>
203
189
  </preface>
204
190
  <sections>
205
- <clause id='scope' type="scope">
191
+ <clause id='scope' type="scope" displayorder="3">
206
192
  <title depth='1'>
207
193
  1.
208
194
  <tab/>
@@ -219,10 +205,10 @@ RSpec.describe IsoDoc do
219
205
  <xref target='N'>Note</xref>
220
206
  </p>
221
207
  </clause>
222
- <terms id='terms'>
208
+ <terms id='terms' displayorder="4">
223
209
  <title>2.</title>
224
210
  </terms>
225
- <clause id='widgets'>
211
+ <clause id='widgets' displayorder="5">
226
212
  <title depth='1'>
227
213
  3.
228
214
  <tab/>
@@ -250,7 +236,7 @@ RSpec.describe IsoDoc do
250
236
  </clause>
251
237
  </clause>
252
238
  </sections>
253
- <annex id='annex1'>
239
+ <annex id='annex1' displayorder="6">
254
240
  <title>
255
241
  <strong>Annex A</strong>
256
242
  <br/>
@@ -284,10 +270,12 @@ RSpec.describe IsoDoc do
284
270
  </annex>
285
271
  </iso-standard>
286
272
  OUTPUT
273
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
274
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
287
275
  end
288
276
 
289
277
  it "cross-references figures" do
290
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
278
+ input = <<~INPUT
291
279
  <iso-standard xmlns="http://riboseinc.com/isoxml">
292
280
  <preface>
293
281
  <foreword id="fwd">
@@ -376,10 +364,11 @@ RSpec.describe IsoDoc do
376
364
  </annex>
377
365
  </iso-standard>
378
366
  INPUT
367
+ output = <<~OUTPUT
379
368
  <?xml version='1.0'?>
380
369
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
381
370
  <preface>
382
- <foreword id='fwd'>
371
+ <foreword id='fwd' displayorder="1">
383
372
  <p>
384
373
  <xref target='N1'>Figure 1</xref>
385
374
  <xref target='N2'>Figure (??)</xref>
@@ -395,7 +384,7 @@ RSpec.describe IsoDoc do
395
384
  <xref target='Anote3'>Figure A.3</xref>
396
385
  </p>
397
386
  </foreword>
398
- <introduction id='intro'>
387
+ <introduction id='intro' displayorder="2">
399
388
  <figure id='N1'>
400
389
  <name>Figure 1&#xA0;&#x2014; Split-it-right sample divider</name>
401
390
  <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
@@ -410,7 +399,7 @@ RSpec.describe IsoDoc do
410
399
  </introduction>
411
400
  </preface>
412
401
  <sections>
413
- <clause id='scope' type="scope">
402
+ <clause id='scope' type="scope" displayorder="3">
414
403
  <title depth='1'>
415
404
  1.
416
405
  <tab/>
@@ -424,10 +413,10 @@ RSpec.describe IsoDoc do
424
413
  <xref target='N'>Figure 2</xref>
425
414
  </p>
426
415
  </clause>
427
- <terms id='terms'>
416
+ <terms id='terms' displayorder="4">
428
417
  <title>2.</title>
429
418
  </terms>
430
- <clause id='widgets'>
419
+ <clause id='widgets' displayorder="5">
431
420
  <title depth='1'>
432
421
  3.
433
422
  <tab/>
@@ -461,7 +450,7 @@ RSpec.describe IsoDoc do
461
450
  </clause>
462
451
  </clause>
463
452
  </sections>
464
- <annex id='annex1'>
453
+ <annex id='annex1' displayorder="6">
465
454
  <title>
466
455
  <strong>Annex A</strong>
467
456
  <br/>
@@ -490,10 +479,12 @@ RSpec.describe IsoDoc do
490
479
  </annex>
491
480
  </iso-standard>
492
481
  OUTPUT
482
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
483
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
493
484
  end
494
485
 
495
486
  it "cross-references subfigures" do
496
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
487
+ input = <<~INPUT
497
488
  <iso-standard xmlns="http://riboseinc.com/isoxml">
498
489
  <preface>
499
490
  <foreword id="fwd">
@@ -545,10 +536,11 @@ RSpec.describe IsoDoc do
545
536
  </annex>
546
537
  </iso-standard>
547
538
  INPUT
539
+ output = <<~OUTPUT
548
540
  <?xml version='1.0'?>
549
541
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
550
542
  <preface>
551
- <foreword id='fwd'>
543
+ <foreword id='fwd' displayorder="1">
552
544
  <p>
553
545
  <xref target='N'>Figure 1</xref>
554
546
  <xref target='note1'>Figure 1-1</xref>
@@ -560,17 +552,17 @@ RSpec.describe IsoDoc do
560
552
  </foreword>
561
553
  </preface>
562
554
  <sections>
563
- <clause id='scope' type="scope">
555
+ <clause id='scope' type="scope" displayorder="2">
564
556
  <title depth='1'>
565
557
  1.
566
558
  <tab/>
567
559
  Scope
568
560
  </title>
569
561
  </clause>
570
- <terms id='terms'>
562
+ <terms id='terms' displayorder="3">
571
563
  <title>2.</title>
572
564
  </terms>
573
- <clause id='widgets'>
565
+ <clause id='widgets' displayorder="4">
574
566
  <title depth='1'>
575
567
  3.
576
568
  <tab/>
@@ -594,7 +586,7 @@ RSpec.describe IsoDoc do
594
586
  </clause>
595
587
  </clause>
596
588
  </sections>
597
- <annex id='annex1'>
589
+ <annex id='annex1' displayorder="5">
598
590
  <title>
599
591
  <strong>Annex A</strong>
600
592
  <br/>
@@ -617,10 +609,12 @@ RSpec.describe IsoDoc do
617
609
  </annex>
618
610
  </iso-standard>
619
611
  OUTPUT
612
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
613
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
620
614
  end
621
615
 
622
616
  it "cross-references examples" do
623
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
617
+ input = <<~INPUT
624
618
  <iso-standard xmlns="http://riboseinc.com/isoxml">
625
619
  <preface>
626
620
  <foreword>
@@ -683,10 +677,11 @@ RSpec.describe IsoDoc do
683
677
  </annex>
684
678
  </iso-standard>
685
679
  INPUT
680
+ output = <<~OUTPUT
686
681
  <?xml version='1.0'?>
687
682
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
688
683
  <preface>
689
- <foreword>
684
+ <foreword displayorder='1'>
690
685
  <p>
691
686
  <xref target='N1'>Introduction, Example</xref>
692
687
  <xref target='N2'>Preparatory, Example (??)</xref>
@@ -698,7 +693,7 @@ RSpec.describe IsoDoc do
698
693
  <xref target='Anote2'>Annex A.2, Example 1</xref>
699
694
  </p>
700
695
  </foreword>
701
- <introduction id='intro'>
696
+ <introduction id='intro' displayorder="2">
702
697
  <example id='N1'>
703
698
  <name>EXAMPLE</name>
704
699
  <p>Hello</p>
@@ -713,7 +708,7 @@ RSpec.describe IsoDoc do
713
708
  </introduction>
714
709
  </preface>
715
710
  <sections>
716
- <clause id='scope' type="scope">
711
+ <clause id='scope' type="scope" displayorder="3">
717
712
  <title depth='1'>
718
713
  1.
719
714
  <tab/>
@@ -727,10 +722,10 @@ RSpec.describe IsoDoc do
727
722
  <xref target='N'>Example</xref>
728
723
  </p>
729
724
  </clause>
730
- <terms id='terms'>
725
+ <terms id='terms' displayorder="4">
731
726
  <title>2.</title>
732
727
  </terms>
733
- <clause id='widgets'>
728
+ <clause id='widgets' displayorder="5">
734
729
  <title depth='1'>
735
730
  3.
736
731
  <tab/>
@@ -752,7 +747,7 @@ RSpec.describe IsoDoc do
752
747
  </clause>
753
748
  </clause>
754
749
  </sections>
755
- <annex id='annex1'>
750
+ <annex id='annex1' displayorder="6">
756
751
  <title>
757
752
  <strong>Annex A</strong>
758
753
  <br/>
@@ -777,10 +772,12 @@ RSpec.describe IsoDoc do
777
772
  </annex>
778
773
  </iso-standard>
779
774
  OUTPUT
775
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
776
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
780
777
  end
781
778
 
782
779
  it "cross-references formulae" do
783
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
780
+ input = <<~INPUT
784
781
  <iso-standard xmlns="http://riboseinc.com/isoxml">
785
782
  <preface>
786
783
  <foreword>
@@ -843,10 +840,11 @@ RSpec.describe IsoDoc do
843
840
  </annex>
844
841
  </iso-standard>
845
842
  INPUT
843
+ output = <<~OUTPUT
846
844
  <?xml version='1.0'?>
847
845
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
848
846
  <preface>
849
- <foreword>
847
+ <foreword displayorder='1'>
850
848
  <p>
851
849
  <xref target='N1'>Introduction, Formula (1)</xref>
852
850
  <xref target='N2'>Preparatory, Formula ((??))</xref>
@@ -858,7 +856,7 @@ RSpec.describe IsoDoc do
858
856
  <xref target='Anote2'>Formula (A.2)</xref>
859
857
  </p>
860
858
  </foreword>
861
- <introduction id='intro'>
859
+ <introduction id='intro' displayorder="2">
862
860
  <formula id='N1'>
863
861
  <name>1</name>
864
862
  <stem type='AsciiMath'>r = 1 %</stem>
@@ -872,7 +870,7 @@ RSpec.describe IsoDoc do
872
870
  </introduction>
873
871
  </preface>
874
872
  <sections>
875
- <clause id='scope' type="scope">
873
+ <clause id='scope' type="scope" displayorder="3">
876
874
  <title depth='1'>
877
875
  1.
878
876
  <tab/>
@@ -886,10 +884,10 @@ RSpec.describe IsoDoc do
886
884
  <xref target='N'>Formula (2)</xref>
887
885
  </p>
888
886
  </clause>
889
- <terms id='terms'>
887
+ <terms id='terms' displayorder="4">
890
888
  <title>2.</title>
891
889
  </terms>
892
- <clause id='widgets'>
890
+ <clause id='widgets' displayorder="5">
893
891
  <title depth='1'>
894
892
  3.
895
893
  <tab/>
@@ -911,7 +909,7 @@ RSpec.describe IsoDoc do
911
909
  </clause>
912
910
  </clause>
913
911
  </sections>
914
- <annex id='annex1'>
912
+ <annex id='annex1' displayorder="6">
915
913
  <title>
916
914
  <strong>Annex A</strong>
917
915
  <br/>
@@ -935,10 +933,12 @@ RSpec.describe IsoDoc do
935
933
  </annex>
936
934
  </iso-standard>
937
935
  OUTPUT
936
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
937
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
938
938
  end
939
939
 
940
940
  it "cross-references requirements" do
941
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
941
+ input = <<~INPUT
942
942
  <iso-standard xmlns="http://riboseinc.com/isoxml">
943
943
  <preface>
944
944
  <foreword>
@@ -1001,10 +1001,11 @@ RSpec.describe IsoDoc do
1001
1001
  </annex>
1002
1002
  </iso-standard>
1003
1003
  INPUT
1004
+ output = <<~OUTPUT
1004
1005
  <?xml version='1.0'?>
1005
1006
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1006
1007
  <preface>
1007
- <foreword>
1008
+ <foreword displayorder='1'>
1008
1009
  <p>
1009
1010
  <xref target='N1'>Introduction, Requirement 1</xref>
1010
1011
  <xref target='N2'>Preparatory, Requirement (??)</xref>
@@ -1016,7 +1017,7 @@ RSpec.describe IsoDoc do
1016
1017
  <xref target='Anote2'>Requirement A.2</xref>
1017
1018
  </p>
1018
1019
  </foreword>
1019
- <introduction id='intro'>
1020
+ <introduction id='intro' displayorder="2">
1020
1021
  <requirement id='N1'>
1021
1022
  <name>Requirement 1</name>
1022
1023
  <stem type='AsciiMath'>r = 1 %</stem>
@@ -1031,7 +1032,7 @@ RSpec.describe IsoDoc do
1031
1032
  </introduction>
1032
1033
  </preface>
1033
1034
  <sections>
1034
- <clause id='scope' type="scope">
1035
+ <clause id='scope' type="scope" displayorder="3">
1035
1036
  <title depth='1'>
1036
1037
  1.
1037
1038
  <tab/>
@@ -1045,10 +1046,10 @@ RSpec.describe IsoDoc do
1045
1046
  <xref target='N'>Requirement 2</xref>
1046
1047
  </p>
1047
1048
  </clause>
1048
- <terms id='terms'>
1049
+ <terms id='terms' displayorder="4">
1049
1050
  <title>2.</title>
1050
1051
  </terms>
1051
- <clause id='widgets'>
1052
+ <clause id='widgets' displayorder="5">
1052
1053
  <title depth='1'>
1053
1054
  3.
1054
1055
  <tab/>
@@ -1070,7 +1071,7 @@ RSpec.describe IsoDoc do
1070
1071
  </clause>
1071
1072
  </clause>
1072
1073
  </sections>
1073
- <annex id='annex1'>
1074
+ <annex id='annex1' displayorder="6">
1074
1075
  <title>
1075
1076
  <strong>Annex A</strong>
1076
1077
  <br/>
@@ -1095,10 +1096,12 @@ RSpec.describe IsoDoc do
1095
1096
  </annex>
1096
1097
  </iso-standard>
1097
1098
  OUTPUT
1099
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1100
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1098
1101
  end
1099
1102
 
1100
1103
  it "cross-references recommendations" do
1101
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1104
+ input = <<~INPUT
1102
1105
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1103
1106
  <preface>
1104
1107
  <foreword>
@@ -1161,10 +1164,11 @@ RSpec.describe IsoDoc do
1161
1164
  </annex>
1162
1165
  </iso-standard>
1163
1166
  INPUT
1167
+ output = <<~OUTPUT
1164
1168
  <?xml version='1.0'?>
1165
1169
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1166
1170
  <preface>
1167
- <foreword>
1171
+ <foreword displayorder='1'>
1168
1172
  <p>
1169
1173
  <xref target='N1'>Introduction, Recommendation 1</xref>
1170
1174
  <xref target='N2'>Preparatory, Recommendation (??)</xref>
@@ -1176,7 +1180,7 @@ RSpec.describe IsoDoc do
1176
1180
  <xref target='Anote2'>Recommendation A.2</xref>
1177
1181
  </p>
1178
1182
  </foreword>
1179
- <introduction id='intro'>
1183
+ <introduction id='intro' displayorder="2">
1180
1184
  <recommendation id='N1'>
1181
1185
  <name>Recommendation 1</name>
1182
1186
  <stem type='AsciiMath'>r = 1 %</stem>
@@ -1191,7 +1195,7 @@ RSpec.describe IsoDoc do
1191
1195
  </introduction>
1192
1196
  </preface>
1193
1197
  <sections>
1194
- <clause id='scope' type="scope">
1198
+ <clause id='scope' type="scope" displayorder="3">
1195
1199
  <title depth='1'>
1196
1200
  1.
1197
1201
  <tab/>
@@ -1205,10 +1209,10 @@ RSpec.describe IsoDoc do
1205
1209
  <xref target='N'>Recommendation 2</xref>
1206
1210
  </p>
1207
1211
  </clause>
1208
- <terms id='terms'>
1212
+ <terms id='terms' displayorder="4">
1209
1213
  <title>2.</title>
1210
1214
  </terms>
1211
- <clause id='widgets'>
1215
+ <clause id='widgets' displayorder="5">
1212
1216
  <title depth='1'>
1213
1217
  3.
1214
1218
  <tab/>
@@ -1230,7 +1234,7 @@ RSpec.describe IsoDoc do
1230
1234
  </clause>
1231
1235
  </clause>
1232
1236
  </sections>
1233
- <annex id='annex1'>
1237
+ <annex id='annex1' displayorder="6">
1234
1238
  <title>
1235
1239
  <strong>Annex A</strong>
1236
1240
  <br/>
@@ -1255,10 +1259,12 @@ RSpec.describe IsoDoc do
1255
1259
  </annex>
1256
1260
  </iso-standard>
1257
1261
  OUTPUT
1262
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1263
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1258
1264
  end
1259
1265
 
1260
1266
  it "cross-references permissions" do
1261
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1267
+ input = <<~INPUT
1262
1268
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1263
1269
  <preface>
1264
1270
  <foreword>
@@ -1321,10 +1327,11 @@ RSpec.describe IsoDoc do
1321
1327
  </annex>
1322
1328
  </iso-standard>
1323
1329
  INPUT
1330
+ output = <<~OUTPUT
1324
1331
  <?xml version='1.0'?>
1325
1332
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1326
1333
  <preface>
1327
- <foreword>
1334
+ <foreword displayorder='1'>
1328
1335
  <p>
1329
1336
  <xref target='N1'>Introduction, Permission 1</xref>
1330
1337
  <xref target='N2'>Preparatory, Permission (??)</xref>
@@ -1336,7 +1343,7 @@ RSpec.describe IsoDoc do
1336
1343
  <xref target='Anote2'>Permission A.2</xref>
1337
1344
  </p>
1338
1345
  </foreword>
1339
- <introduction id='intro'>
1346
+ <introduction id='intro' displayorder="2">
1340
1347
  <permission id='N1'>
1341
1348
  <name>Permission 1</name>
1342
1349
  <stem type='AsciiMath'>r = 1 %</stem>
@@ -1351,7 +1358,7 @@ RSpec.describe IsoDoc do
1351
1358
  </introduction>
1352
1359
  </preface>
1353
1360
  <sections>
1354
- <clause id='scope' type="scope">
1361
+ <clause id='scope' type="scope" displayorder="3">
1355
1362
  <title depth='1'>
1356
1363
  1.
1357
1364
  <tab/>
@@ -1365,10 +1372,10 @@ RSpec.describe IsoDoc do
1365
1372
  <xref target='N'>Permission 2</xref>
1366
1373
  </p>
1367
1374
  </clause>
1368
- <terms id='terms'>
1375
+ <terms id='terms' displayorder="4">
1369
1376
  <title>2.</title>
1370
1377
  </terms>
1371
- <clause id='widgets'>
1378
+ <clause id='widgets' displayorder="5">
1372
1379
  <title depth='1'>
1373
1380
  3.
1374
1381
  <tab/>
@@ -1390,7 +1397,7 @@ RSpec.describe IsoDoc do
1390
1397
  </clause>
1391
1398
  </clause>
1392
1399
  </sections>
1393
- <annex id='annex1'>
1400
+ <annex id='annex1' displayorder="6">
1394
1401
  <title>
1395
1402
  <strong>Annex A</strong>
1396
1403
  <br/>
@@ -1415,10 +1422,12 @@ RSpec.describe IsoDoc do
1415
1422
  </annex>
1416
1423
  </iso-standard>
1417
1424
  OUTPUT
1425
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1426
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1418
1427
  end
1419
1428
 
1420
1429
  it "labels and cross-references nested requirements" do
1421
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1430
+ input = <<~INPUT
1422
1431
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1423
1432
  <preface>
1424
1433
  <foreword>
@@ -1464,10 +1473,11 @@ RSpec.describe IsoDoc do
1464
1473
  </annex>
1465
1474
  </iso-standard>
1466
1475
  INPUT
1476
+ output = <<~OUTPUT
1467
1477
  <?xml version='1.0'?>
1468
1478
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1469
1479
  <preface>
1470
- <foreword>
1480
+ <foreword displayorder='1'>
1471
1481
  <p>
1472
1482
  <xref target='N1'>Clause 1, Permission 1</xref>
1473
1483
  <xref target='N2'>Clause 1, Permission 1-1</xref>
@@ -1483,7 +1493,7 @@ RSpec.describe IsoDoc do
1483
1493
  </foreword>
1484
1494
  </preface>
1485
1495
  <sections>
1486
- <clause id='xyz'>
1496
+ <clause id='xyz' displayorder="2">
1487
1497
  <title depth='1'>
1488
1498
  1.
1489
1499
  <tab/>
@@ -1506,7 +1516,7 @@ RSpec.describe IsoDoc do
1506
1516
  </permission>
1507
1517
  </clause>
1508
1518
  </sections>
1509
- <annex id='Axyz'>
1519
+ <annex id='Axyz' displayorder="3">
1510
1520
  <title>
1511
1521
  <strong>Annex A</strong>
1512
1522
  <br/>
@@ -1532,10 +1542,12 @@ RSpec.describe IsoDoc do
1532
1542
  </annex>
1533
1543
  </iso-standard>
1534
1544
  OUTPUT
1545
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1546
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1535
1547
  end
1536
1548
 
1537
1549
  it "cross-references tables" do
1538
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1550
+ input = <<~INPUT
1539
1551
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1540
1552
  <preface>
1541
1553
  <foreword>
@@ -1654,22 +1666,22 @@ RSpec.describe IsoDoc do
1654
1666
  </annex>
1655
1667
  </iso-standard>
1656
1668
  INPUT
1657
- <?xml version='1.0'?>
1658
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1669
+ output = <<~OUTPUT
1670
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1659
1671
  <preface>
1660
- <foreword>
1672
+ <foreword displayorder='1'>
1661
1673
  <p>
1662
- <xref target='N1'>Table 1</xref>
1663
- <xref target='N2'>Table (??)</xref>
1664
- <xref target='N'>Table 2</xref>
1665
- <xref target='note1'>Table 3</xref>
1666
- <xref target='note2'>Table 4</xref>
1667
- <xref target='AN'>Table A.1</xref>
1668
- <xref target='Anote1'>Table (??)</xref>
1669
- <xref target='Anote2'>Table A.2</xref>
1674
+ <xref target='N1'>Table 1</xref>
1675
+ <xref target='N2'>Table (??)</xref>
1676
+ <xref target='N'>Table 2</xref>
1677
+ <xref target='note1'>Table 3</xref>
1678
+ <xref target='note2'>Table 4</xref>
1679
+ <xref target='AN'>Table A.1</xref>
1680
+ <xref target='Anote1'>Table (??)</xref>
1681
+ <xref target='Anote2'>Table A.2</xref>
1670
1682
  </p>
1671
1683
  </foreword>
1672
- <introduction id='intro'>
1684
+ <introduction id='intro' displayorder='2'>
1673
1685
  <table id='N1'>
1674
1686
  <name>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</name>
1675
1687
  <tbody>
@@ -1696,12 +1708,12 @@ RSpec.describe IsoDoc do
1696
1708
  </introduction>
1697
1709
  </preface>
1698
1710
  <sections>
1699
- <clause id='scope' type="scope">
1711
+ <clause id='scope' type='scope' displayorder='3'>
1700
1712
  <title depth='1'>
1701
- 1.
1702
- <tab/>
1703
- Scope
1704
- </title>
1713
+ 1.
1714
+ <tab/>
1715
+ Scope
1716
+ </title>
1705
1717
  <table id='N'>
1706
1718
  <name>Table 2&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</name>
1707
1719
  <tbody>
@@ -1716,16 +1728,17 @@ RSpec.describe IsoDoc do
1716
1728
  <xref target='N'>Table 2</xref>
1717
1729
  </p>
1718
1730
  </clause>
1719
- <terms id='terms'>
1720
- <title>2.</title>
1721
- </terms>
1722
- <clause id='widgets'>
1723
- <title depth='1'>
1724
- 3.
1725
- <tab/>
1726
- Widgets
1727
- </title>
1728
- <clause id='widgets1'><title>3.1.</title>
1731
+ <terms id='terms' displayorder='4'>
1732
+ <title>2.</title>
1733
+ </terms>
1734
+ <clause id='widgets' displayorder='5'>
1735
+ <title depth='1'>
1736
+ 3.
1737
+ <tab/>
1738
+ Widgets
1739
+ </title>
1740
+ <clause id='widgets1'>
1741
+ <title>3.1.</title>
1729
1742
  <table id='note1'>
1730
1743
  <name>Table 3&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</name>
1731
1744
  <tbody>
@@ -1748,18 +1761,19 @@ RSpec.describe IsoDoc do
1748
1761
  </table>
1749
1762
  <p>
1750
1763
  <xref target='note1'>Table 3</xref>
1751
- <xref target='note2'>Table 4</xref>
1764
+ <xref target='note2'>Table 4</xref>
1752
1765
  </p>
1753
1766
  </clause>
1754
1767
  </clause>
1755
1768
  </sections>
1756
- <annex id='annex1'>
1757
- <title>
1758
- <strong>Annex A</strong>
1759
- <br/>
1760
- (informative)
1761
- </title>
1762
- <clause id='annex1a'><title>A.1.</title>
1769
+ <annex id='annex1' displayorder='6'>
1770
+ <title>
1771
+ <strong>Annex A</strong>
1772
+ <br/>
1773
+ (informative)
1774
+ </title>
1775
+ <clause id='annex1a'>
1776
+ <title>A.1.</title>
1763
1777
  <table id='AN'>
1764
1778
  <name>Table A.1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</name>
1765
1779
  <tbody>
@@ -1771,7 +1785,8 @@ RSpec.describe IsoDoc do
1771
1785
  </tbody>
1772
1786
  </table>
1773
1787
  </clause>
1774
- <clause id='annex1b'><title>A.2.</title>
1788
+ <clause id='annex1b'>
1789
+ <title>A.2.</title>
1775
1790
  <table id='Anote1' unnumbered='true'>
1776
1791
  <name>Table &#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</name>
1777
1792
  <tbody>
@@ -1796,43 +1811,45 @@ RSpec.describe IsoDoc do
1796
1811
  </annex>
1797
1812
  </iso-standard>
1798
1813
  OUTPUT
1814
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1815
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1799
1816
  end
1800
1817
 
1801
1818
  it "cross-references term notes" do
1802
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1803
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1804
- <preface>
1805
- <foreword>
1806
- <p>
1807
- <xref target="note1"/>
1808
- <xref target="note2"/>
1809
- <xref target="note3"/>
1810
- </p>
1811
- </foreword>
1812
- </preface>
1813
- <sections>
1814
- <clause id="scope" type="scope"><title>Scope</title>
1815
- </clause>
1816
- <terms id="terms">
1817
- <term id="_waxy_rice"><preferred>waxy rice</preferred>
1818
- <termnote id="note1">
1819
- <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>
1820
- </termnote></term>
1821
- <term id="_nonwaxy_rice"><preferred>nonwaxy rice</preferred>
1822
- <termnote id="note2">
1823
- <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>
1824
- </termnote>
1825
- <termnote id="note3">
1826
- <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>
1827
- </termnote></term>
1828
- </terms>
1829
- #{' '}
1830
- </iso-standard>
1819
+ input = <<~INPUT
1820
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1821
+ <preface>
1822
+ <foreword>
1823
+ <p>
1824
+ <xref target="note1"/>
1825
+ <xref target="note2"/>
1826
+ <xref target="note3"/>
1827
+ </p>
1828
+ </foreword>
1829
+ </preface>
1830
+ <sections>
1831
+ <clause id="scope" type="scope"><title>Scope</title>
1832
+ </clause>
1833
+ <terms id="terms">
1834
+ <term id="_waxy_rice"><preferred>waxy rice</preferred>
1835
+ <termnote id="note1">
1836
+ <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>
1837
+ </termnote></term>
1838
+ <term id="_nonwaxy_rice"><preferred>nonwaxy rice</preferred>
1839
+ <termnote id="note2">
1840
+ <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>
1841
+ </termnote>
1842
+ <termnote id="note3">
1843
+ <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>
1844
+ </termnote></term>
1845
+ </terms>
1846
+ </iso-standard>
1831
1847
  INPUT
1848
+ output = <<~OUTPUT
1832
1849
  <?xml version='1.0'?>
1833
1850
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1834
1851
  <preface>
1835
- <foreword>
1852
+ <foreword displayorder="1">
1836
1853
  <p>
1837
1854
  <xref target='note1'>Clause 2.1, Note 1</xref>
1838
1855
  <xref target='note2'>Clause 2.2, Note 1</xref>
@@ -1841,14 +1858,14 @@ RSpec.describe IsoDoc do
1841
1858
  </foreword>
1842
1859
  </preface>
1843
1860
  <sections>
1844
- <clause id='scope' type="scope">
1861
+ <clause id='scope' type="scope" displayorder="2">
1845
1862
  <title depth='1'>
1846
1863
  1.
1847
1864
  <tab/>
1848
1865
  Scope
1849
1866
  </title>
1850
1867
  </clause>
1851
- <terms id='terms'>
1868
+ <terms id='terms'displayorder="3">
1852
1869
  <title>2.</title>
1853
1870
  <term id='_waxy_rice'>
1854
1871
  <name>2.1.</name>
@@ -1883,10 +1900,12 @@ RSpec.describe IsoDoc do
1883
1900
  </sections>
1884
1901
  </iso-standard>
1885
1902
  OUTPUT
1903
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1904
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1886
1905
  end
1887
1906
 
1888
1907
  it "cross-references sections" do
1889
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1908
+ input = <<~INPUT
1890
1909
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1891
1910
  <preface>
1892
1911
  <foreword obligation="informative">
@@ -1974,161 +1993,165 @@ RSpec.describe IsoDoc do
1974
1993
  </bibliography>
1975
1994
  </iso-standard>
1976
1995
  INPUT
1977
- <?xml version='1.0'?>
1978
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1979
- <preface>
1980
- <foreword obligation='informative'>
1981
- <title>Foreword</title>
1982
- <p id='A'>
1983
- This is a preamble
1984
- <xref target='C'>Introduction Subsection</xref>
1985
- <xref target='C1'>Introduction, 2</xref>
1986
- <xref target='D'>Clause 1</xref>
1987
- <xref target='H'>Clause 3</xref>
1988
- <xref target='I'>Clause 3.1</xref>
1989
- <xref target='J'>Clause 3.1.1</xref>
1990
- <xref target='K'>Clause 3.2</xref>
1991
- <xref target='L'>Clause 4</xref>
1992
- <xref target='M'>Clause 5</xref>
1993
- <xref target='N'>Clause 5.1</xref>
1994
- <xref target='O'>Clause 5.2</xref>
1995
- <xref target='P'>Annex A</xref>
1996
- <xref target='Q'>Annex A.1</xref>
1997
- <xref target='Q1'>Annex A.1.1</xref>
1998
- <xref target='QQ'>Annex B</xref>
1999
- <xref target='QQ1'>Annex B</xref>
2000
- <xref target='QQ2'>Annex B.1</xref>
2001
- <xref target='R'>Clause 2</xref>
2002
- <xref target='S'>Bibliography</xref>
2003
- </p>
2004
- </foreword>
2005
- <introduction id='B' obligation='informative'>
2006
- <title>Introduction</title>
2007
- <clause id='C' inline-header='false' obligation='informative'>
2008
- <title depth="2">Introduction Subsection</title>
2009
- </clause>
2010
- <clause id='C1' inline-header='false' obligation='informative'>Text</clause>
2011
- </introduction>
2012
- </preface>
2013
- <sections>
2014
- <clause id='D' obligation='normative' type="scope">
2015
- <title depth='1'>
2016
- 1.
2017
- <tab/>
2018
- Scope
2019
- </title>
2020
- <p id='E'>Text</p>
2021
- </clause>
2022
- <terms id='H' obligation='normative'>
2023
- <title depth='1'>
2024
- 3.
2025
- <tab/>
2026
- Terms, definitions, symbols and abbreviated terms
2027
- </title>
2028
- <terms id='I' obligation='normative'>
2029
- <title depth='2'>
2030
- 3.1.
2031
- <tab/>
2032
- Normal Terms
2033
- </title>
2034
- <term id='J'><name>3.1.1.</name>
2035
- <preferred>Term2</preferred>
2036
- </term>
2037
- </terms>
2038
- <definitions id='K'>
2039
- <title>3.2.</title>
2040
- <dl>
2041
- <dt>Symbol</dt>
2042
- <dd>Definition</dd>
2043
- </dl>
2044
- </definitions>
2045
- </terms>
2046
- <definitions id='L'>
2047
- <title>4.</title>
2048
- <dl>
2049
- <dt>Symbol</dt>
2050
- <dd>Definition</dd>
2051
- </dl>
2052
- </definitions>
2053
- <clause id='M' inline-header='false' obligation='normative'>
2054
- <title depth='1'>
2055
- 5.
2056
- <tab/>
2057
- Clause 4
2058
- </title>
2059
- <clause id='N' inline-header='false' obligation='normative'>
2060
- <title depth='2'>
2061
- 5.1.
2062
- <tab/>
2063
- Introduction
2064
- </title>
2065
- </clause>
2066
- <clause id='O' inline-header='false' obligation='normative'>
2067
- <title depth='2'>
2068
- 5.2.
2069
- <tab/>
2070
- Clause 4.2
2071
- </title>
2072
- </clause>
2073
- </clause>
2074
- </sections>
2075
- <annex id='P' inline-header='false' obligation='normative'>
2076
- <title>
2077
- <strong>Annex A</strong>
2078
- <br/>
2079
- (normative)
2080
- <br/>
2081
- <br/>
2082
- <strong>Annex</strong></title>
2083
- <clause id='Q' inline-header='false' obligation='normative'>
2084
- <title depth='2'>
2085
- A.1.
2086
- <tab/>
2087
- Annex A.1
2088
- </title>
2089
- <clause id='Q1' inline-header='false' obligation='normative'>
2090
- <title depth='3'>
2091
- A.1.1.
2092
- <tab/>
2093
- Annex A.1a
2094
- </title>
2095
- </clause>
2096
- </clause>
2097
- </annex>
2098
- <annex id='QQ'>
2099
- <title>
2100
- <strong>Annex B</strong>
2101
- <br/>
2102
- (informative)
2103
- </title>
2104
- <terms id='QQ1'>
2105
- <title>B.</title>
2106
- <term id='QQ2'>
2107
- <name>B.1.</name>
2108
- </term>
2109
- </terms>
2110
- </annex>
2111
- <bibliography>
2112
- <references id='R' obligation='informative' normative='true'>
2113
- <title depth='1'>
2114
- 2.
2115
- <tab/>
2116
- Normative References
2117
- </title>
2118
- </references>
2119
- <clause id='S' obligation='informative'>
2120
- <title depth="1">Bibliography</title>
2121
- <references id='T' obligation='informative' normative='false'>
2122
- <title depth="2">Bibliography Subsection</title>
2123
- </references>
2124
- </clause>
2125
- </bibliography>
2126
- </iso-standard>
1996
+ output = <<~OUTPUT
1997
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1998
+ <preface>
1999
+ <foreword obligation='informative' displayorder='1'>
2000
+ <title>Foreword</title>
2001
+ <p id='A'>
2002
+ This is a preamble#{' '}
2003
+ <xref target='C'>Introduction Subsection</xref>
2004
+ <xref target='C1'>Introduction, 2</xref>
2005
+ <xref target='D'>Clause 1</xref>
2006
+ <xref target='H'>Clause 3</xref>
2007
+ <xref target='I'>Clause 3.1</xref>
2008
+ <xref target='J'>Clause 3.1.1</xref>
2009
+ <xref target='K'>Clause 3.2</xref>
2010
+ <xref target='L'>Clause 4</xref>
2011
+ <xref target='M'>Clause 5</xref>
2012
+ <xref target='N'>Clause 5.1</xref>
2013
+ <xref target='O'>Clause 5.2</xref>
2014
+ <xref target='P'>Annex A</xref>
2015
+ <xref target='Q'>Annex A.1</xref>
2016
+ <xref target='Q1'>Annex A.1.1</xref>
2017
+ <xref target='QQ'>Annex B</xref>
2018
+ <xref target='QQ1'>Annex B</xref>
2019
+ <xref target='QQ2'>Annex B.1</xref>
2020
+ <xref target='R'>Clause 2</xref>
2021
+ <xref target='S'>Bibliography</xref>
2022
+ </p>
2023
+ </foreword>
2024
+ <introduction id='B' obligation='informative' displayorder='2'>
2025
+ <title>Introduction</title>
2026
+ <clause id='C' inline-header='false' obligation='informative'>
2027
+ <title depth='2'>Introduction Subsection</title>
2028
+ </clause>
2029
+ <clause id='C1' inline-header='false' obligation='informative'>Text</clause>
2030
+ </introduction>
2031
+ </preface>
2032
+ <sections>
2033
+ <clause id='D' obligation='normative' type='scope' displayorder='3'>
2034
+ <title depth='1'>
2035
+ 1.
2036
+ <tab/>
2037
+ Scope
2038
+ </title>
2039
+ <p id='E'>Text</p>
2040
+ </clause>
2041
+ <terms id='H' obligation='normative' displayorder='5'>
2042
+ <title depth='1'>
2043
+ 3.
2044
+ <tab/>
2045
+ Terms, definitions, symbols and abbreviated terms
2046
+ </title>
2047
+ <terms id='I' obligation='normative'>
2048
+ <title depth='2'>
2049
+ 3.1.
2050
+ <tab/>
2051
+ Normal Terms
2052
+ </title>
2053
+ <term id='J'>
2054
+ <name>3.1.1.</name>
2055
+ <preferred>Term2</preferred>
2056
+ </term>
2057
+ </terms>
2058
+ <definitions id='K'>
2059
+ <title>3.2.</title>
2060
+ <dl>
2061
+ <dt>Symbol</dt>
2062
+ <dd>Definition</dd>
2063
+ </dl>
2064
+ </definitions>
2065
+ </terms>
2066
+ <definitions id='L' displayorder='6'>
2067
+ <title>4.</title>
2068
+ <dl>
2069
+ <dt>Symbol</dt>
2070
+ <dd>Definition</dd>
2071
+ </dl>
2072
+ </definitions>
2073
+ <clause id='M' inline-header='false' obligation='normative' displayorder='7'>
2074
+ <title depth='1'>
2075
+ 5.
2076
+ <tab/>
2077
+ Clause 4
2078
+ </title>
2079
+ <clause id='N' inline-header='false' obligation='normative'>
2080
+ <title depth='2'>
2081
+ 5.1.
2082
+ <tab/>
2083
+ Introduction
2084
+ </title>
2085
+ </clause>
2086
+ <clause id='O' inline-header='false' obligation='normative'>
2087
+ <title depth='2'>
2088
+ 5.2.
2089
+ <tab/>
2090
+ Clause 4.2
2091
+ </title>
2092
+ </clause>
2093
+ </clause>
2094
+ </sections>
2095
+ <annex id='P' inline-header='false' obligation='normative' displayorder='8'>
2096
+ <title>
2097
+ <strong>Annex A</strong>
2098
+ <br/>
2099
+ (normative)
2100
+ <br/>
2101
+ <br/>
2102
+ <strong>Annex</strong>
2103
+ </title>
2104
+ <clause id='Q' inline-header='false' obligation='normative'>
2105
+ <title depth='2'>
2106
+ A.1.
2107
+ <tab/>
2108
+ Annex A.1
2109
+ </title>
2110
+ <clause id='Q1' inline-header='false' obligation='normative'>
2111
+ <title depth='3'>
2112
+ A.1.1.
2113
+ <tab/>
2114
+ Annex A.1a
2115
+ </title>
2116
+ </clause>
2117
+ </clause>
2118
+ </annex>
2119
+ <annex id='QQ' displayorder='9'>
2120
+ <title>
2121
+ <strong>Annex B</strong>
2122
+ <br/>
2123
+ (informative)
2124
+ </title>
2125
+ <terms id='QQ1'>
2126
+ <title>B.</title>
2127
+ <term id='QQ2'>
2128
+ <name>B.1.</name>
2129
+ </term>
2130
+ </terms>
2131
+ </annex>
2132
+ <bibliography>
2133
+ <references id='R' obligation='informative' normative='true' displayorder='4'>
2134
+ <title depth='1'>
2135
+ 2.
2136
+ <tab/>
2137
+ Normative References
2138
+ </title>
2139
+ </references>
2140
+ <clause id='S' obligation='informative' displayorder='10'>
2141
+ <title depth='1'>Bibliography</title>
2142
+ <references id='T' obligation='informative' normative='false'>
2143
+ <title depth='2'>Bibliography Subsection</title>
2144
+ </references>
2145
+ </clause>
2146
+ </bibliography>
2147
+ </iso-standard>
2127
2148
  OUTPUT
2149
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2150
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
2128
2151
  end
2129
2152
 
2130
2153
  it "cross-references lists" do
2131
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2154
+ input = <<~INPUT
2132
2155
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2133
2156
  <preface>
2134
2157
  <foreword>
@@ -2189,110 +2212,115 @@ RSpec.describe IsoDoc do
2189
2212
  </annex>
2190
2213
  </iso-standard>
2191
2214
  INPUT
2192
- <?xml version='1.0'?>
2193
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2194
- <preface>
2195
- <foreword>
2196
- <p>
2197
- <xref target='N1'>Introduction, List</xref>
2198
- <xref target='N2'>Preparatory, List</xref>
2199
- <xref target='N'>Clause 1, List</xref>
2200
- <xref target='note1'>Clause 3.1, List 1</xref>
2201
- <xref target='note2'>Clause 3.1, List 2</xref>
2202
- <xref target='AN'>Annex A.1, List</xref>
2203
- <xref target='Anote1'>Annex A.2, List 1</xref>
2204
- <xref target='Anote2'>Annex A.2, List 2</xref>
2205
- </p>
2206
- </foreword>
2207
- <introduction id='intro'>
2208
- <ol id='N1'>
2209
- <li>
2210
- <p>A</p>
2211
- </li>
2212
- </ol>
2213
- <clause id='xyz'>
2214
- <title depth='2'>Preparatory</title>
2215
- <ol id='N2'>
2216
- <li>
2217
- <p>A</p>
2218
- </li>
2219
- </ol>
2220
- </clause>
2221
- </introduction>
2222
- </preface>
2223
- <sections>
2224
- <clause id='scope' type="scope">
2225
- <title depth='1'>
2226
- 1.
2227
- <tab/>
2228
- Scope
2229
- </title>
2230
- <ol id='N'>
2231
- <li>
2232
- <p>A</p>
2233
- </li>
2234
- </ol>
2235
- </clause>
2236
- <terms id='terms'>
2237
- <title>2.</title>
2238
- </terms>
2239
- <clause id='widgets'>
2240
- <title depth='1'>
2241
- 3.
2242
- <tab/>
2243
- Widgets
2244
- </title>
2245
- <clause id='widgets1'><title>3.1.</title>
2246
- <ol id='note1'>
2247
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
2248
- These results are based on a study carried out on three different
2249
- types of kernel.
2250
- </p>
2251
- </ol>
2252
- <ol id='note2'>
2253
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a'>
2254
- These results are based on a study carried out on three different
2255
- types of kernel.
2256
- </p>
2257
- </ol>
2258
- </clause>
2259
- </clause>
2260
- </sections>
2261
- <annex id='annex1'>
2262
- <title>
2263
- <strong>Annex A</strong>
2264
- <br/>
2265
- (informative)
2266
- </title>
2267
- <clause id='annex1a'><title>A.1.</title>
2268
- <ol id='AN'>
2269
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
2270
- These results are based on a study carried out on three different
2271
- types of kernel.
2272
- </p>
2273
- </ol>
2274
- </clause>
2275
- <clause id='annex1b'><title>A.2.</title>
2276
- <ol id='Anote1'>
2277
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
2278
- These results are based on a study carried out on three different
2279
- types of kernel.
2280
- </p>
2281
- </ol>
2282
- <ol id='Anote2'>
2283
- <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a'>
2284
- These results are based on a study carried out on three different
2285
- types of kernel.
2286
- </p>
2287
- </ol>
2288
- </clause>
2289
- </annex>
2290
- </iso-standard>
2215
+ output = <<~OUTPUT
2216
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
2217
+ <preface>
2218
+ <foreword displayorder='1'>
2219
+ <p>
2220
+ <xref target='N1'>Introduction, List</xref>
2221
+ <xref target='N2'>Preparatory, List</xref>
2222
+ <xref target='N'>Clause 1, List</xref>
2223
+ <xref target='note1'>Clause 3.1, List 1</xref>
2224
+ <xref target='note2'>Clause 3.1, List 2</xref>
2225
+ <xref target='AN'>Annex A.1, List</xref>
2226
+ <xref target='Anote1'>Annex A.2, List 1</xref>
2227
+ <xref target='Anote2'>Annex A.2, List 2</xref>
2228
+ </p>
2229
+ </foreword>
2230
+ <introduction id='intro' displayorder='2'>
2231
+ <ol id='N1'>
2232
+ <li>
2233
+ <p>A</p>
2234
+ </li>
2235
+ </ol>
2236
+ <clause id='xyz'>
2237
+ <title depth='2'>Preparatory</title>
2238
+ <ol id='N2'>
2239
+ <li>
2240
+ <p>A</p>
2241
+ </li>
2242
+ </ol>
2243
+ </clause>
2244
+ </introduction>
2245
+ </preface>
2246
+ <sections>
2247
+ <clause id='scope' type='scope' displayorder='3'>
2248
+ <title depth='1'>
2249
+ 1.
2250
+ <tab/>
2251
+ Scope
2252
+ </title>
2253
+ <ol id='N'>
2254
+ <li>
2255
+ <p>A</p>
2256
+ </li>
2257
+ </ol>
2258
+ </clause>
2259
+ <terms id='terms' displayorder='4'>
2260
+ <title>2.</title>
2261
+ </terms>
2262
+ <clause id='widgets' displayorder='5'>
2263
+ <title depth='1'>
2264
+ 3.
2265
+ <tab/>
2266
+ Widgets
2267
+ </title>
2268
+ <clause id='widgets1'>
2269
+ <title>3.1.</title>
2270
+ <ol id='note1'>
2271
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
2272
+ These results are based on a study carried out on three different
2273
+ types of kernel.
2274
+ </p>
2275
+ </ol>
2276
+ <ol id='note2'>
2277
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a'>
2278
+ These results are based on a study carried out on three different
2279
+ types of kernel.
2280
+ </p>
2281
+ </ol>
2282
+ </clause>
2283
+ </clause>
2284
+ </sections>
2285
+ <annex id='annex1' displayorder='6'>
2286
+ <title>
2287
+ <strong>Annex A</strong>
2288
+ <br/>
2289
+ (informative)
2290
+ </title>
2291
+ <clause id='annex1a'>
2292
+ <title>A.1.</title>
2293
+ <ol id='AN'>
2294
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
2295
+ These results are based on a study carried out on three different
2296
+ types of kernel.
2297
+ </p>
2298
+ </ol>
2299
+ </clause>
2300
+ <clause id='annex1b'>
2301
+ <title>A.2.</title>
2302
+ <ol id='Anote1'>
2303
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f'>
2304
+ These results are based on a study carried out on three different
2305
+ types of kernel.
2306
+ </p>
2307
+ </ol>
2308
+ <ol id='Anote2'>
2309
+ <p id='_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a'>
2310
+ These results are based on a study carried out on three different
2311
+ types of kernel.
2312
+ </p>
2313
+ </ol>
2314
+ </clause>
2315
+ </annex>
2316
+ </iso-standard>
2291
2317
  OUTPUT
2318
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2319
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
2292
2320
  end
2293
2321
 
2294
2322
  it "cross-references list items" do
2295
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2323
+ input = <<~INPUT
2296
2324
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2297
2325
  <preface>
2298
2326
  <foreword>
@@ -2353,105 +2381,110 @@ RSpec.describe IsoDoc do
2353
2381
  </annex>
2354
2382
  </iso-standard>
2355
2383
  INPUT
2356
- <?xml version='1.0'?>
2357
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2358
- <preface>
2359
- <foreword>
2360
- <p>
2361
- <xref target='N1'>Introduction, a)</xref>
2362
- <xref target='N2'>Preparatory, 1)</xref>
2363
- <xref target='N'>Clause 1, i)</xref>
2364
- <xref target='note1'>Clause 3.1, List 1 a)</xref>
2365
- <xref target='note2'>Clause 3.1, List 2 I)</xref>
2366
- <xref target='AN'>Annex A.1, A)</xref>
2367
- <xref target='Anote1'>Annex A.2, List 1 iv)</xref>
2368
- <xref target='Anote2'>Annex A.2, List 2 a)</xref>
2369
- </p>
2370
- </foreword>
2371
- <introduction id='intro'>
2372
- <ol id='N01'>
2373
- <li id='N1'>
2374
- <p>A</p>
2375
- </li>
2376
- </ol>
2377
- <clause id='xyz'>
2378
- <title depth='2'>Preparatory</title>
2379
- <ol id='N02' type="arabic">
2380
- <li id='N2'>
2381
- <p>A</p>
2382
- </li>
2383
- </ol>
2384
- </clause>
2385
- </introduction>
2386
- </preface>
2387
- <sections>
2388
- <clause id='scope' type="scope">
2389
- <title depth='1'>
2390
- 1.
2391
- <tab/>
2392
- Scope
2393
- </title>
2394
- <ol id='N0' type="roman">
2395
- <li id='N'>
2396
- <p>A</p>
2397
- </li>
2398
- </ol>
2399
- </clause>
2400
- <terms id='terms'>
2401
- <title>2.</title>
2402
- </terms>
2403
- <clause id='widgets'>
2404
- <title depth='1'>
2405
- 3.
2406
- <tab/>
2407
- Widgets
2408
- </title>
2409
- <clause id='widgets1'><title>3.1.</title>
2410
- <ol id='note1l' type="alphabet">
2411
- <li id='note1'>
2412
- <p>A</p>
2413
- </li>
2414
- </ol>
2415
- <ol id='note2l' type="roman_upper">
2416
- <li id='note2'>
2417
- <p>A</p>
2418
- </li>
2419
- </ol>
2420
- </clause>
2421
- </clause>
2422
- </sections>
2423
- <annex id='annex1'>
2424
- <title>
2425
- <strong>Annex A</strong>
2426
- <br/>
2427
- (informative)
2428
- </title>
2429
- <clause id='annex1a'><title>A.1.</title>
2430
- <ol id='ANl' type="alphabet_upper">
2431
- <li id='AN'>
2432
- <p>A</p>
2433
- </li>
2434
- </ol>
2435
- </clause>
2436
- <clause id='annex1b'><title>A.2.</title>
2437
- <ol id='Anote1l' type="roman" start="4">
2438
- <li id='Anote1'>
2439
- <p>A</p>
2440
- </li>
2441
- </ol>
2442
- <ol id='Anote2l'>
2443
- <li id='Anote2'>
2444
- <p>A</p>
2445
- </li>
2446
- </ol>
2447
- </clause>
2448
- </annex>
2449
- </iso-standard>
2384
+ output = <<~OUTPUT
2385
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
2386
+ <preface>
2387
+ <foreword displayorder='1'>
2388
+ <p>
2389
+ <xref target='N1'>Introduction, a)</xref>
2390
+ <xref target='N2'>Preparatory, 1)</xref>
2391
+ <xref target='N'>Clause 1, i)</xref>
2392
+ <xref target='note1'>Clause 3.1, List 1 a)</xref>
2393
+ <xref target='note2'>Clause 3.1, List 2 I)</xref>
2394
+ <xref target='AN'>Annex A.1, A)</xref>
2395
+ <xref target='Anote1'>Annex A.2, List 1 iv)</xref>
2396
+ <xref target='Anote2'>Annex A.2, List 2 a)</xref>
2397
+ </p>
2398
+ </foreword>
2399
+ <introduction id='intro' displayorder='2'>
2400
+ <ol id='N01'>
2401
+ <li id='N1'>
2402
+ <p>A</p>
2403
+ </li>
2404
+ </ol>
2405
+ <clause id='xyz'>
2406
+ <title depth='2'>Preparatory</title>
2407
+ <ol id='N02' type='arabic'>
2408
+ <li id='N2'>
2409
+ <p>A</p>
2410
+ </li>
2411
+ </ol>
2412
+ </clause>
2413
+ </introduction>
2414
+ </preface>
2415
+ <sections>
2416
+ <clause id='scope' type='scope' displayorder='3'>
2417
+ <title depth='1'>
2418
+ 1.
2419
+ <tab/>
2420
+ Scope
2421
+ </title>
2422
+ <ol id='N0' type='roman'>
2423
+ <li id='N'>
2424
+ <p>A</p>
2425
+ </li>
2426
+ </ol>
2427
+ </clause>
2428
+ <terms id='terms' displayorder='4'>
2429
+ <title>2.</title>
2430
+ </terms>
2431
+ <clause id='widgets' displayorder='5'>
2432
+ <title depth='1'>
2433
+ 3.
2434
+ <tab/>
2435
+ Widgets
2436
+ </title>
2437
+ <clause id='widgets1'>
2438
+ <title>3.1.</title>
2439
+ <ol id='note1l' type='alphabet'>
2440
+ <li id='note1'>
2441
+ <p>A</p>
2442
+ </li>
2443
+ </ol>
2444
+ <ol id='note2l' type='roman_upper'>
2445
+ <li id='note2'>
2446
+ <p>A</p>
2447
+ </li>
2448
+ </ol>
2449
+ </clause>
2450
+ </clause>
2451
+ </sections>
2452
+ <annex id='annex1' displayorder='6'>
2453
+ <title>
2454
+ <strong>Annex A</strong>
2455
+ <br/>
2456
+ (informative)
2457
+ </title>
2458
+ <clause id='annex1a'>
2459
+ <title>A.1.</title>
2460
+ <ol id='ANl' type='alphabet_upper'>
2461
+ <li id='AN'>
2462
+ <p>A</p>
2463
+ </li>
2464
+ </ol>
2465
+ </clause>
2466
+ <clause id='annex1b'>
2467
+ <title>A.2.</title>
2468
+ <ol id='Anote1l' type='roman' start='4'>
2469
+ <li id='Anote1'>
2470
+ <p>A</p>
2471
+ </li>
2472
+ </ol>
2473
+ <ol id='Anote2l'>
2474
+ <li id='Anote2'>
2475
+ <p>A</p>
2476
+ </li>
2477
+ </ol>
2478
+ </clause>
2479
+ </annex>
2480
+ </iso-standard>
2450
2481
  OUTPUT
2482
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2483
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
2451
2484
  end
2452
2485
 
2453
2486
  it "cross-references nested list items" do
2454
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2487
+ input = <<~INPUT
2455
2488
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2456
2489
  <preface>
2457
2490
  <foreword>
@@ -2489,10 +2522,11 @@ RSpec.describe IsoDoc do
2489
2522
  </sections>
2490
2523
  </iso-standard>
2491
2524
  INPUT
2525
+ output = <<~OUTPUT
2492
2526
  <?xml version='1.0'?>
2493
2527
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2494
2528
  <preface>
2495
- <foreword>
2529
+ <foreword displayorder="1">
2496
2530
  <p>
2497
2531
  <xref target='N'>Clause 1, a)</xref>
2498
2532
  <xref target='note1'>Clause 1, a.1)</xref>
@@ -2504,7 +2538,7 @@ RSpec.describe IsoDoc do
2504
2538
  </foreword>
2505
2539
  </preface>
2506
2540
  <sections>
2507
- <clause id='scope' type="scope">
2541
+ <clause id='scope' type="scope" displayorder="2">
2508
2542
  <title depth='1'>
2509
2543
  1.
2510
2544
  <tab/>
@@ -2544,10 +2578,12 @@ RSpec.describe IsoDoc do
2544
2578
  </sections>
2545
2579
  </iso-standard>
2546
2580
  OUTPUT
2581
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2582
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
2547
2583
  end
2548
2584
 
2549
2585
  it "cross-references bookmarks" do
2550
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2586
+ input = <<~INPUT
2551
2587
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2552
2588
  <preface>
2553
2589
  <foreword>
@@ -2609,96 +2645,99 @@ RSpec.describe IsoDoc do
2609
2645
  </annex>
2610
2646
  </iso-standard>
2611
2647
  INPUT
2648
+ output = <<~OUTPUT
2612
2649
  <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
2613
- <preface>
2614
- <foreword>
2615
- <p>
2616
- <xref target='N1'>Introduction</xref>
2617
- <xref target='N2'>Preparatory</xref>
2618
- <xref target='N'>Clause 1</xref>
2619
- <xref target='note1'>Note 2</xref>
2620
- <xref target='note2'>Clause 3.1</xref>
2621
- <xref target='AN'>Annex A.1</xref>
2622
- <xref target='Anote1'>Figure A.1</xref>
2623
- <xref target='Anote2'>Annex A.2</xref>
2624
- </p>
2625
- </foreword>
2626
- <introduction id='intro'>
2627
- <p id='N01'>
2628
- <bookmark id='N1'/>
2629
- </p>
2630
- <clause id='xyz'>
2631
- <title depth='2'>Preparatory</title>
2632
- <p id='N02' type='arabic'>
2633
- <bookmark id='N2'/>
2634
- </p>
2635
- </clause>
2636
- </introduction>
2637
- </preface>
2638
- <sections>
2639
- <clause id='scope' type='scope'>
2640
- <title depth='1'>
2641
- 1.
2642
- <tab/>
2643
- Scope
2644
- </title>
2645
- <p id='N0' type='roman'>
2646
- <bookmark id='N'/>
2647
- </p>
2648
- </clause>
2649
- <terms id='terms'>
2650
- <title>2.</title>
2651
- </terms>
2652
- <clause id='widgets'>
2653
- <title depth='1'>
2654
- 3.
2655
- <tab/>
2656
- Widgets
2657
- </title>
2658
- <clause id='widgets1'>
2659
- <title>3.1.</title>
2660
- <note id='note0'>
2661
- <name>NOTE 1</name>
2662
- </note>
2663
- <note id='note1l' type='alphabet'>
2664
- <name>NOTE 2</name>
2665
- <bookmark id='note1'/>
2666
- </note>
2667
- <p id='note2l' type='roman_upper'>
2668
- <bookmark id='note2'/>
2669
- </p>
2670
- </clause>
2671
- </clause>
2672
- </sections>
2673
- <annex id='annex1'>
2674
- <title>
2675
- <strong>Annex A</strong>
2676
- <br/>
2677
- (informative)
2678
- </title>
2679
- <clause id='annex1a'>
2680
- <title>A.1.</title>
2681
- <p id='ANl' type='alphabet_upper'>
2682
- <bookmark id='AN'/>
2683
- </p>
2684
- </clause>
2685
- <clause id='annex1b'>
2686
- <title>A.2.</title>
2687
- <figure id='Anote1l' type='roman' start='4'>
2688
- <name>Figure A.1</name>
2689
- <bookmark id='Anote1'/>
2690
- </figure>
2691
- <p id='Anote2l'>
2692
- <bookmark id='Anote2'/>
2693
- </p>
2694
- </clause>
2695
- </annex>
2696
- </iso-standard>
2650
+ <preface>
2651
+ <foreword displayorder='1'>
2652
+ <p>
2653
+ <xref target='N1'>Introduction</xref>
2654
+ <xref target='N2'>Preparatory</xref>
2655
+ <xref target='N'>Clause 1</xref>
2656
+ <xref target='note1'>Note 2</xref>
2657
+ <xref target='note2'>Clause 3.1</xref>
2658
+ <xref target='AN'>Annex A.1</xref>
2659
+ <xref target='Anote1'>Figure A.1</xref>
2660
+ <xref target='Anote2'>Annex A.2</xref>
2661
+ </p>
2662
+ </foreword>
2663
+ <introduction id='intro' displayorder='2'>
2664
+ <p id='N01'>
2665
+ <bookmark id='N1'/>
2666
+ </p>
2667
+ <clause id='xyz'>
2668
+ <title depth='2'>Preparatory</title>
2669
+ <p id='N02' type='arabic'>
2670
+ <bookmark id='N2'/>
2671
+ </p>
2672
+ </clause>
2673
+ </introduction>
2674
+ </preface>
2675
+ <sections>
2676
+ <clause id='scope' type='scope' displayorder='3'>
2677
+ <title depth='1'>
2678
+ 1.
2679
+ <tab/>
2680
+ Scope
2681
+ </title>
2682
+ <p id='N0' type='roman'>
2683
+ <bookmark id='N'/>
2684
+ </p>
2685
+ </clause>
2686
+ <terms id='terms' displayorder='4'>
2687
+ <title>2.</title>
2688
+ </terms>
2689
+ <clause id='widgets' displayorder='5'>
2690
+ <title depth='1'>
2691
+ 3.
2692
+ <tab/>
2693
+ Widgets
2694
+ </title>
2695
+ <clause id='widgets1'>
2696
+ <title>3.1.</title>
2697
+ <note id='note0'>
2698
+ <name>NOTE 1</name>
2699
+ </note>
2700
+ <note id='note1l' type='alphabet'>
2701
+ <name>NOTE 2</name>
2702
+ <bookmark id='note1'/>
2703
+ </note>
2704
+ <p id='note2l' type='roman_upper'>
2705
+ <bookmark id='note2'/>
2706
+ </p>
2707
+ </clause>
2708
+ </clause>
2709
+ </sections>
2710
+ <annex id='annex1' displayorder='6'>
2711
+ <title>
2712
+ <strong>Annex A</strong>
2713
+ <br/>
2714
+ (informative)
2715
+ </title>
2716
+ <clause id='annex1a'>
2717
+ <title>A.1.</title>
2718
+ <p id='ANl' type='alphabet_upper'>
2719
+ <bookmark id='AN'/>
2720
+ </p>
2721
+ </clause>
2722
+ <clause id='annex1b'>
2723
+ <title>A.2.</title>
2724
+ <figure id='Anote1l' type='roman' start='4'>
2725
+ <name>Figure A.1</name>
2726
+ <bookmark id='Anote1'/>
2727
+ </figure>
2728
+ <p id='Anote2l'>
2729
+ <bookmark id='Anote2'/>
2730
+ </p>
2731
+ </clause>
2732
+ </annex>
2733
+ </iso-standard>
2697
2734
  OUTPUT
2735
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2736
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
2698
2737
  end
2699
2738
 
2700
2739
  it "realises subsequences" do
2701
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2740
+ input = <<~INPUT
2702
2741
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2703
2742
  <preface>
2704
2743
  <foreword id="fwd">
@@ -2741,10 +2780,11 @@ RSpec.describe IsoDoc do
2741
2780
  </introduction>
2742
2781
  </iso-standard>
2743
2782
  INPUT
2783
+ output = <<~OUTPUT
2744
2784
  <?xml version='1.0'?>
2745
2785
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2746
2786
  <preface>
2747
- <foreword id='fwd'>
2787
+ <foreword id='fwd' displayorder="1">
2748
2788
  <p>
2749
2789
  <xref target='N1'>Figure 1</xref>
2750
2790
  <xref target='N2'>Figure 2a</xref>
@@ -2756,7 +2796,7 @@ RSpec.describe IsoDoc do
2756
2796
  <xref target='N8'>Figure 5</xref>
2757
2797
  </p>
2758
2798
  </foreword>
2759
- <introduction id='intro'>
2799
+ <introduction id='intro' displayorder="2">
2760
2800
  <figure id='N1'>
2761
2801
  <name>Figure 1&#xA0;&#x2014; Split-it-right sample divider</name>
2762
2802
  <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
@@ -2793,10 +2833,12 @@ RSpec.describe IsoDoc do
2793
2833
  </preface>
2794
2834
  </iso-standard>
2795
2835
  OUTPUT
2836
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
2837
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
2796
2838
  end
2797
2839
 
2798
2840
  it "realises numbering overrides" do
2799
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2841
+ input = <<~INPUT
2800
2842
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2801
2843
  <preface>
2802
2844
  <foreword id="fwd">
@@ -2961,275 +3003,277 @@ RSpec.describe IsoDoc do
2961
3003
  </bibliography>
2962
3004
  </iso-standard>
2963
3005
  INPUT
2964
- <?xml version='1.0'?>
2965
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2966
- <preface>
2967
- <foreword id='fwd'>
2968
- <p>
2969
- <xref target='N1'>Figure 1</xref>
2970
- <xref target='N2'>Figure A</xref>
2971
- <xref target='N3'>Figure B</xref>
2972
- <xref target='N4'>Figure 7</xref>
2973
- <xref target='N5'>Figure 8</xref>
2974
- <xref target='N6'>Figure 9a</xref>
2975
- <xref target='N7'>Figure 9c</xref>
2976
- <xref target='N8'>Figure 9d</xref>
2977
- <xref target='N9'>Figure 20f</xref>
2978
- <xref target='N10'>Figure 20g</xref>
2979
- <xref target='N11'>Figure A.1</xref>
2980
- <xref target='N12'>Figure A.2</xref>
2981
- <xref target='N13'>Figure 100</xref>
2982
- </p>
2983
- <p>
2984
- <xref target='S1'>Clause 1bis</xref>
2985
- <xref target='S2'>Clause 2bis</xref>
2986
- <xref target='S3'>Clause 3bis</xref>
2987
- <xref target='S4'>Clause 3bis.4bis</xref>
2988
- <xref target='S12'>Clause 12bis</xref>
2989
- <xref target='S13'>Clause 13bis</xref>
2990
- <xref target='S14'>Clause 13bis.14bis</xref>
2991
- <xref target='S15'>Clause 13bis.14bit</xref>
2992
- <xref target='S16'>Clause 13bis.14biu</xref>
2993
- <xref target='S17'>Clause 13bis.0</xref>
2994
- <xref target='S18'>Clause 13bis.1</xref>
2995
- <xref target='S19'>Clause 13bis.2</xref>
2996
- <xref target='S20'>Clause 13bis.a</xref>
2997
- <xref target='S21'>Clause 13bis.b</xref>
2998
- <xref target='S22'>Clause 13bis.B</xref>
2999
- <xref target='S23'>Clause 13bis.C</xref>
3000
- <xref target='S24'>Clause 16bis</xref>
3001
- <xref target='S25'>Annex A</xref>
3002
- <xref target='S26'>Annex 17bis</xref>
3003
- <xref target='S27'>Annex 17bis.18bis</xref>
3004
- <xref target='S28'>Annex 17bit</xref>
3005
- <xref target='S29'>Bibliography</xref>
3006
- <xref target='S30'>Bibliography Subsection</xref>
3007
- </p>
3008
- </foreword>
3009
- <introduction id='intro'>
3010
- <figure id='N1'>
3011
- <name>Figure 1&#xA0;&#x2014; Split-it-right sample divider</name>
3012
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3013
- </figure>
3014
- <figure id='N2' number='A'>
3015
- <name>Figure A&#xA0;&#x2014; Split-it-right sample divider</name>
3016
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3017
- </figure>
3018
- <figure id='N3'>
3019
- <name>Figure B&#xA0;&#x2014; Split-it-right sample divider</name>
3020
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3021
- </figure>
3022
- <figure id='N4' number='7'>
3023
- <name>Figure 7&#xA0;&#x2014; Split-it-right sample divider</name>
3024
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3025
- </figure>
3026
- <figure id='N5'>
3027
- <name>Figure 8&#xA0;&#x2014; Split-it-right sample divider</name>
3028
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3029
- </figure>
3030
- <figure id='N6' subsequence='B'>
3031
- <name>Figure 9a&#xA0;&#x2014; Split-it-right sample divider</name>
3032
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3033
- </figure>
3034
- <figure id='N7' subsequence='B' number='c'>
3035
- <name>Figure 9c&#xA0;&#x2014; Split-it-right sample divider</name>
3036
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3037
- </figure>
3038
- <figure id='N8' subsequence='B'>
3039
- <name>Figure 9d&#xA0;&#x2014; Split-it-right sample divider</name>
3040
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3041
- </figure>
3042
- <figure id='N9' subsequence='C' number='20f'>
3043
- <name>Figure 20f&#xA0;&#x2014; Split-it-right sample divider</name>
3044
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3045
- </figure>
3046
- <figure id='N10' subsequence='C'>
3047
- <name>Figure 20g&#xA0;&#x2014; Split-it-right sample divider</name>
3048
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3049
- </figure>
3050
- <figure id='N11' number='A.1'>
3051
- <name>Figure A.1&#xA0;&#x2014; Split-it-right sample divider</name>
3052
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3053
- </figure>
3054
- <figure id='N12'>
3055
- <name>Figure A.2&#xA0;&#x2014; Split-it-right sample divider</name>
3056
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3057
- </figure>
3058
- <figure id='N13' number='100'>
3059
- <name>Figure 100&#xA0;&#x2014; Split-it-right sample divider</name>
3060
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3061
- </figure>
3062
- #{' '}
3063
- </introduction>
3064
- </preface>
3065
- <sections>
3066
- <clause id='S1' number='1bis' type='scope' inline-header='false' obligation='normative'>
3067
- <title depth='1'>
3068
- 1bis.
3069
- <tab/>
3070
- Scope
3071
- </title>
3072
- <p id='_'>Text</p>
3073
- </clause>
3074
- <terms id='S3' number='3bis' obligation='normative'>
3075
- <title depth='1'>
3076
- 3bis.
3077
- <tab/>
3078
- Terms and definitions
3079
- </title>
3080
- <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
3081
- <term id='S4' number='4bis'>
3082
- <name>3bis.4bis.</name>
3083
- <preferred>Term1</preferred>
3084
- </term>
3085
- </terms>
3086
- <definitions id='S12' number='12bis' type='abbreviated_terms' obligation='normative'>
3087
- <title depth='1'>
3088
- 12bis.
3089
- <tab/>
3090
- Abbreviated terms
3091
- </title>
3092
- </definitions>
3093
- <clause id='S13' number='13bis' inline-header='false' obligation='normative'>
3094
- <title depth='1'>
3095
- 13bis.
3096
- <tab/>
3097
- Clause 4
3098
- </title>
3099
- <clause id='S14' number='14bis' inline-header='false' obligation='normative'>
3100
- <title depth='2'>
3101
- 13bis.14bis.
3102
- <tab/>
3103
- Introduction
3104
- </title>
3105
- </clause>
3106
- <clause id='S15' inline-header='false' obligation='normative'>
3107
- <title depth='2'>
3108
- 13bis.14bit.
3109
- <tab/>
3110
- Clause A
3111
- </title>
3112
- </clause>
3113
- <clause id='S16' inline-header='false' obligation='normative'>
3114
- <title depth='2'>
3115
- 13bis.14biu.
3116
- <tab/>
3117
- Clause B
3118
- </title>
3119
- </clause>
3120
- <clause id='S17' number='0' inline-header='false' obligation='normative'>
3121
- <title depth='2'>
3122
- 13bis.0.
3123
- <tab/>
3124
- Clause C
3125
- </title>
3126
- </clause>
3127
- <clause id='S18' inline-header='false' obligation='normative'>
3128
- <title depth='2'>
3129
- 13bis.1.
3130
- <tab/>
3131
- Clause D
3132
- </title>
3133
- </clause>
3134
- <clause id='S19' inline-header='false' obligation='normative'>
3135
- <title depth='2'>
3136
- 13bis.2.
3137
- <tab/>
3138
- Clause E
3139
- </title>
3140
- </clause>
3141
- <clause id='S20' number='a' inline-header='false' obligation='normative'>
3142
- <title depth='2'>
3143
- 13bis.a.
3144
- <tab/>
3145
- Clause F
3146
- </title>
3147
- </clause>
3148
- <clause id='S21' inline-header='false' obligation='normative'>
3149
- <title depth='2'>
3150
- 13bis.b.
3151
- <tab/>
3152
- Clause G
3153
- </title>
3154
- </clause>
3155
- <clause id='S22' number='B' inline-header='false' obligation='normative'>
3156
- <title depth='2'>
3157
- 13bis.B.
3158
- <tab/>
3159
- Clause H
3160
- </title>
3161
- </clause>
3162
- <clause id='S23' inline-header='false' obligation='normative'>
3163
- <title depth='2'>
3164
- 13bis.C.
3165
- <tab/>
3166
- Clause I
3167
- </title>
3168
- </clause>
3169
- </clause>
3170
- <clause id='S24' number='16bis' inline-header='false' obligation='normative'>
3171
- <title depth='1'>
3172
- 16bis.
3173
- <tab/>
3174
- Terms and Definitions
3175
- </title>
3176
- </clause>
3177
- </sections>
3178
- <annex id='S25' obligation='normative'>
3179
- <title>
3180
- <strong>Annex A</strong>
3181
- <br/>
3182
- (normative)
3183
- <br/>
3184
- <br/>
3185
- <strong>First Annex</strong>
3186
- </title>
3187
- </annex>
3188
- <annex id='S26' number='17bis' inline-header='false' obligation='normative'>
3189
- <title>
3190
- <strong>Annex 17bis</strong>
3191
- <br/>
3192
- (normative)
3193
- <br/>
3194
- <br/>
3195
- <strong>Annex</strong>
3196
- </title>
3197
- <clause id='S27' number='18bis' inline-header='false' obligation='normative'>
3198
- <title depth='2'>
3199
- 17bis.18bis.
3200
- <tab/>
3201
- Annex A.1
3202
- </title>
3203
- </clause>
3204
- </annex>
3205
- <annex id='S28' inline-header='false' obligation='normative'>
3206
- <title>
3207
- <strong>Annex 17bit</strong>
3208
- <br/>
3209
- (normative)
3210
- <br/>
3211
- <br/>
3212
- <strong>Another Annex</strong>
3213
- </title>
3214
- </annex>
3215
- <bibliography>
3216
- <references id='S2' number='2bis' normative='true' obligation='informative'>
3217
- <title depth='1'>
3218
- 2bis.
3219
- <tab/>
3220
- Normative references
3221
- </title>
3222
- <p id='_'>There are no normative references in this document.</p>
3223
- </references>
3224
- <clause id='S29' number='19bis' obligation='informative'>
3225
- <title depth='1'>Bibliography</title>
3226
- <references id='S30' number='20bis' normative='false' obligation='informative'>
3227
- <title depth='2'>Bibliography Subsection</title>
3228
- </references>
3229
- </clause>
3230
- </bibliography>
3231
- </iso-standard>
3006
+ output = <<~OUTPUT
3007
+ <?xml version='1.0'?>
3008
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
3009
+ <preface>
3010
+ <foreword id='fwd' displayorder='1'>
3011
+ <p>
3012
+ <xref target='N1'>Figure 1</xref>
3013
+ <xref target='N2'>Figure A</xref>
3014
+ <xref target='N3'>Figure B</xref>
3015
+ <xref target='N4'>Figure 7</xref>
3016
+ <xref target='N5'>Figure 8</xref>
3017
+ <xref target='N6'>Figure 9a</xref>
3018
+ <xref target='N7'>Figure 9c</xref>
3019
+ <xref target='N8'>Figure 9d</xref>
3020
+ <xref target='N9'>Figure 20f</xref>
3021
+ <xref target='N10'>Figure 20g</xref>
3022
+ <xref target='N11'>Figure A.1</xref>
3023
+ <xref target='N12'>Figure A.2</xref>
3024
+ <xref target='N13'>Figure 100</xref>
3025
+ </p>
3026
+ <p>
3027
+ <xref target='S1'>Clause 1bis</xref>
3028
+ <xref target='S2'>Clause 2bis</xref>
3029
+ <xref target='S3'>Clause 3bis</xref>
3030
+ <xref target='S4'>Clause 3bis.4bis</xref>
3031
+ <xref target='S12'>Clause 12bis</xref>
3032
+ <xref target='S13'>Clause 13bis</xref>
3033
+ <xref target='S14'>Clause 13bis.14bis</xref>
3034
+ <xref target='S15'>Clause 13bis.14bit</xref>
3035
+ <xref target='S16'>Clause 13bis.14biu</xref>
3036
+ <xref target='S17'>Clause 13bis.0</xref>
3037
+ <xref target='S18'>Clause 13bis.1</xref>
3038
+ <xref target='S19'>Clause 13bis.2</xref>
3039
+ <xref target='S20'>Clause 13bis.a</xref>
3040
+ <xref target='S21'>Clause 13bis.b</xref>
3041
+ <xref target='S22'>Clause 13bis.B</xref>
3042
+ <xref target='S23'>Clause 13bis.C</xref>
3043
+ <xref target='S24'>Clause 16bis</xref>
3044
+ <xref target='S25'>Annex A</xref>
3045
+ <xref target='S26'>Annex 17bis</xref>
3046
+ <xref target='S27'>Annex 17bis.18bis</xref>
3047
+ <xref target='S28'>Annex 17bit</xref>
3048
+ <xref target='S29'>Bibliography</xref>
3049
+ <xref target='S30'>Bibliography Subsection</xref>
3050
+ </p>
3051
+ </foreword>
3052
+ <introduction id='intro' displayorder='2'>
3053
+ <figure id='N1'>
3054
+ <name>Figure 1&#xA0;&#x2014; Split-it-right sample divider</name>
3055
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3056
+ </figure>
3057
+ <figure id='N2' number='A'>
3058
+ <name>Figure A&#xA0;&#x2014; Split-it-right sample divider</name>
3059
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3060
+ </figure>
3061
+ <figure id='N3'>
3062
+ <name>Figure B&#xA0;&#x2014; Split-it-right sample divider</name>
3063
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3064
+ </figure>
3065
+ <figure id='N4' number='7'>
3066
+ <name>Figure 7&#xA0;&#x2014; Split-it-right sample divider</name>
3067
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3068
+ </figure>
3069
+ <figure id='N5'>
3070
+ <name>Figure 8&#xA0;&#x2014; Split-it-right sample divider</name>
3071
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3072
+ </figure>
3073
+ <figure id='N6' subsequence='B'>
3074
+ <name>Figure 9a&#xA0;&#x2014; Split-it-right sample divider</name>
3075
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3076
+ </figure>
3077
+ <figure id='N7' subsequence='B' number='c'>
3078
+ <name>Figure 9c&#xA0;&#x2014; Split-it-right sample divider</name>
3079
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3080
+ </figure>
3081
+ <figure id='N8' subsequence='B'>
3082
+ <name>Figure 9d&#xA0;&#x2014; Split-it-right sample divider</name>
3083
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3084
+ </figure>
3085
+ <figure id='N9' subsequence='C' number='20f'>
3086
+ <name>Figure 20f&#xA0;&#x2014; Split-it-right sample divider</name>
3087
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3088
+ </figure>
3089
+ <figure id='N10' subsequence='C'>
3090
+ <name>Figure 20g&#xA0;&#x2014; Split-it-right sample divider</name>
3091
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3092
+ </figure>
3093
+ <figure id='N11' number='A.1'>
3094
+ <name>Figure A.1&#xA0;&#x2014; Split-it-right sample divider</name>
3095
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3096
+ </figure>
3097
+ <figure id='N12'>
3098
+ <name>Figure A.2&#xA0;&#x2014; Split-it-right sample divider</name>
3099
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3100
+ </figure>
3101
+ <figure id='N13' number='100'>
3102
+ <name>Figure 100&#xA0;&#x2014; Split-it-right sample divider</name>
3103
+ <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
3104
+ </figure>
3105
+ </introduction>
3106
+ </preface>
3107
+ <sections>
3108
+ <clause id='S1' number='1bis' type='scope' inline-header='false' obligation='normative' displayorder='3'>
3109
+ <title depth='1'>
3110
+ 1bis.
3111
+ <tab/>
3112
+ Scope
3113
+ </title>
3114
+ <p id='_'>Text</p>
3115
+ </clause>
3116
+ <terms id='S3' number='3bis' obligation='normative' displayorder='5'>
3117
+ <title depth='1'>
3118
+ 3bis.
3119
+ <tab/>
3120
+ Terms and definitions
3121
+ </title>
3122
+ <p id='_'>For the purposes of this document, the following terms and definitions apply.</p>
3123
+ <term id='S4' number='4bis'>
3124
+ <name>3bis.4bis.</name>
3125
+ <preferred>Term1</preferred>
3126
+ </term>
3127
+ </terms>
3128
+ <definitions id='S12' number='12bis' type='abbreviated_terms' obligation='normative' displayorder='6'>
3129
+ <title depth='1'>
3130
+ 12bis.
3131
+ <tab/>
3132
+ Abbreviated terms
3133
+ </title>
3134
+ </definitions>
3135
+ <clause id='S13' number='13bis' inline-header='false' obligation='normative' displayorder='7'>
3136
+ <title depth='1'>
3137
+ 13bis.
3138
+ <tab/>
3139
+ Clause 4
3140
+ </title>
3141
+ <clause id='S14' number='14bis' inline-header='false' obligation='normative'>
3142
+ <title depth='2'>
3143
+ 13bis.14bis.
3144
+ <tab/>
3145
+ Introduction
3146
+ </title>
3147
+ </clause>
3148
+ <clause id='S15' inline-header='false' obligation='normative'>
3149
+ <title depth='2'>
3150
+ 13bis.14bit.
3151
+ <tab/>
3152
+ Clause A
3153
+ </title>
3154
+ </clause>
3155
+ <clause id='S16' inline-header='false' obligation='normative'>
3156
+ <title depth='2'>
3157
+ 13bis.14biu.
3158
+ <tab/>
3159
+ Clause B
3160
+ </title>
3161
+ </clause>
3162
+ <clause id='S17' number='0' inline-header='false' obligation='normative'>
3163
+ <title depth='2'>
3164
+ 13bis.0.
3165
+ <tab/>
3166
+ Clause C
3167
+ </title>
3168
+ </clause>
3169
+ <clause id='S18' inline-header='false' obligation='normative'>
3170
+ <title depth='2'>
3171
+ 13bis.1.
3172
+ <tab/>
3173
+ Clause D
3174
+ </title>
3175
+ </clause>
3176
+ <clause id='S19' inline-header='false' obligation='normative'>
3177
+ <title depth='2'>
3178
+ 13bis.2.
3179
+ <tab/>
3180
+ Clause E
3181
+ </title>
3182
+ </clause>
3183
+ <clause id='S20' number='a' inline-header='false' obligation='normative'>
3184
+ <title depth='2'>
3185
+ 13bis.a.
3186
+ <tab/>
3187
+ Clause F
3188
+ </title>
3189
+ </clause>
3190
+ <clause id='S21' inline-header='false' obligation='normative'>
3191
+ <title depth='2'>
3192
+ 13bis.b.
3193
+ <tab/>
3194
+ Clause G
3195
+ </title>
3196
+ </clause>
3197
+ <clause id='S22' number='B' inline-header='false' obligation='normative'>
3198
+ <title depth='2'>
3199
+ 13bis.B.
3200
+ <tab/>
3201
+ Clause H
3202
+ </title>
3203
+ </clause>
3204
+ <clause id='S23' inline-header='false' obligation='normative'>
3205
+ <title depth='2'>
3206
+ 13bis.C.
3207
+ <tab/>
3208
+ Clause I
3209
+ </title>
3210
+ </clause>
3211
+ </clause>
3212
+ <clause id='S24' number='16bis' inline-header='false' obligation='normative' displayorder='8'>
3213
+ <title depth='1'>
3214
+ 16bis.
3215
+ <tab/>
3216
+ Terms and Definitions
3217
+ </title>
3218
+ </clause>
3219
+ </sections>
3220
+ <annex id='S25' obligation='normative' displayorder='9'>
3221
+ <title>
3222
+ <strong>Annex A</strong>
3223
+ <br/>
3224
+ (normative)
3225
+ <br/>
3226
+ <br/>
3227
+ <strong>First Annex</strong>
3228
+ </title>
3229
+ </annex>
3230
+ <annex id='S26' number='17bis' inline-header='false' obligation='normative' displayorder='10'>
3231
+ <title>
3232
+ <strong>Annex 17bis</strong>
3233
+ <br/>
3234
+ (normative)
3235
+ <br/>
3236
+ <br/>
3237
+ <strong>Annex</strong>
3238
+ </title>
3239
+ <clause id='S27' number='18bis' inline-header='false' obligation='normative'>
3240
+ <title depth='2'>
3241
+ 17bis.18bis.
3242
+ <tab/>
3243
+ Annex A.1
3244
+ </title>
3245
+ </clause>
3246
+ </annex>
3247
+ <annex id='S28' inline-header='false' obligation='normative' displayorder='11'>
3248
+ <title>
3249
+ <strong>Annex 17bit</strong>
3250
+ <br/>
3251
+ (normative)
3252
+ <br/>
3253
+ <br/>
3254
+ <strong>Another Annex</strong>
3255
+ </title>
3256
+ </annex>
3257
+ <bibliography>
3258
+ <references id='S2' number='2bis' normative='true' obligation='informative' displayorder='4'>
3259
+ <title depth='1'>
3260
+ 2bis.
3261
+ <tab/>
3262
+ Normative references
3263
+ </title>
3264
+ <p id='_'>There are no normative references in this document.</p>
3265
+ </references>
3266
+ <clause id='S29' number='19bis' obligation='informative' displayorder='12'>
3267
+ <title depth='1'>Bibliography</title>
3268
+ <references id='S30' number='20bis' normative='false' obligation='informative'>
3269
+ <title depth='2'>Bibliography Subsection</title>
3270
+ </references>
3271
+ </clause>
3272
+ </bibliography>
3273
+ </iso-standard>
3232
3274
  OUTPUT
3275
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
3276
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
3233
3277
  end
3234
3278
 
3235
3279
  it "realises roman counter for xrefs" do
@@ -3245,4 +3289,54 @@ RSpec.describe IsoDoc do
3245
3289
  a.increment({})
3246
3290
  expect(a.print).to eq "V"
3247
3291
  end
3292
+
3293
+ it "skips I in counter for xrefs" do
3294
+ a = IsoDoc::XrefGen::Counter.new("@", skip_i: true)
3295
+ a.increment({})
3296
+ a.increment({})
3297
+ a.increment({})
3298
+ a.increment({})
3299
+ a.increment({})
3300
+ a.increment({})
3301
+ a.increment({})
3302
+ a.increment({})
3303
+ expect(a.print).to eq "H"
3304
+ a.increment({})
3305
+ expect(a.print).to eq "J"
3306
+ a = IsoDoc::XrefGen::Counter.new("@")
3307
+ a.increment({})
3308
+ a.increment({})
3309
+ a.increment({})
3310
+ a.increment({})
3311
+ a.increment({})
3312
+ a.increment({})
3313
+ a.increment({})
3314
+ a.increment({})
3315
+ expect(a.print).to eq "H"
3316
+ a.increment({})
3317
+ expect(a.print).to eq "I"
3318
+ end
3319
+
3320
+ it "increments counter past Z for xrefs" do
3321
+ a = IsoDoc::XrefGen::Counter.new("Z")
3322
+ a.increment({})
3323
+ expect(a.print).to eq "AA"
3324
+ a.increment({})
3325
+ expect(a.print).to eq "AB"
3326
+ a = IsoDoc::XrefGen::Counter.new("BZ")
3327
+ a.increment({})
3328
+ expect(a.print).to eq "CA"
3329
+ a.increment({})
3330
+ expect(a.print).to eq "CB"
3331
+ a = IsoDoc::XrefGen::Counter.new("z")
3332
+ a.increment({})
3333
+ expect(a.print).to eq "aa"
3334
+ a.increment({})
3335
+ expect(a.print).to eq "ab"
3336
+ a = IsoDoc::XrefGen::Counter.new("Az")
3337
+ a.increment({})
3338
+ expect(a.print).to eq "Ba"
3339
+ a.increment({})
3340
+ expect(a.print).to eq "Bb"
3341
+ end
3248
3342
  end