isodoc 1.6.4 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +1 -1
  3. data/.rubocop.yml +1 -1
  4. data/isodoc.gemspec +2 -1
  5. data/lib/isodoc-yaml/i18n-ar.yaml +19 -25
  6. data/lib/isodoc-yaml/i18n-de.yaml +1 -0
  7. data/lib/isodoc-yaml/i18n-en.yaml +2 -0
  8. data/lib/isodoc-yaml/i18n-es.yaml +1 -0
  9. data/lib/isodoc-yaml/i18n-fr.yaml +2 -0
  10. data/lib/isodoc-yaml/i18n-ru.yaml +1 -0
  11. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +2 -0
  12. data/lib/isodoc/convert.rb +4 -2
  13. data/lib/isodoc/function/blocks.rb +6 -5
  14. data/lib/isodoc/function/references.rb +33 -52
  15. data/lib/isodoc/function/section.rb +0 -1
  16. data/lib/isodoc/function/table.rb +21 -22
  17. data/lib/isodoc/function/terms.rb +6 -7
  18. data/lib/isodoc/gem_tasks.rb +8 -9
  19. data/lib/isodoc/html_convert.rb +5 -1
  20. data/lib/isodoc/html_function/comments.rb +12 -12
  21. data/lib/isodoc/html_function/html.rb +2 -2
  22. data/lib/isodoc/html_function/postprocess.rb +195 -185
  23. data/lib/isodoc/html_function/sectionsplit.rb +244 -0
  24. data/lib/isodoc/metadata.rb +22 -20
  25. data/lib/isodoc/metadata_contributor.rb +31 -28
  26. data/lib/isodoc/presentation_function/bibdata.rb +7 -0
  27. data/lib/isodoc/presentation_function/block.rb +7 -4
  28. data/lib/isodoc/presentation_function/inline.rb +7 -12
  29. data/lib/isodoc/presentation_function/section.rb +38 -1
  30. data/lib/isodoc/presentation_xml_convert.rb +2 -0
  31. data/lib/isodoc/version.rb +1 -1
  32. data/lib/isodoc/xref.rb +10 -7
  33. data/lib/isodoc/xref/xref_anchor.rb +45 -44
  34. data/lib/isodoc/xref/xref_counter.rb +113 -103
  35. data/lib/isodoc/xref/xref_gen.rb +39 -11
  36. data/spec/isodoc/blocks_spec.rb +184 -447
  37. data/spec/isodoc/cleanup_spec.rb +40 -42
  38. data/spec/isodoc/i18n_spec.rb +694 -821
  39. data/spec/isodoc/inline_spec.rb +197 -208
  40. data/spec/isodoc/metadata_spec.rb +384 -379
  41. data/spec/isodoc/postproc_spec.rb +121 -30
  42. data/spec/isodoc/presentation_xml_spec.rb +4 -4
  43. data/spec/isodoc/ref_spec.rb +5 -5
  44. data/spec/isodoc/section_spec.rb +216 -199
  45. data/spec/isodoc/sectionsplit_spec.rb +190 -0
  46. data/spec/isodoc/table_spec.rb +41 -42
  47. data/spec/isodoc/terms_spec.rb +1 -1
  48. data/spec/isodoc/xref_spec.rb +684 -1020
  49. metadata +19 -3
@@ -0,0 +1,190 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "processes section split HTML" do
5
+ FileUtils.rm_f "test.xml"
6
+ FileUtils.rm_f "test.html.yaml"
7
+ FileUtils.rm_rf "test_collection"
8
+ FileUtils.rm_rf "test_files"
9
+ input = <<~INPUT
10
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
11
+ <bibdata>
12
+ <title>ISO Title</title>
13
+ <docidentifier type="ISO">ISO 1</docidentifier>
14
+ </bibdata>
15
+ <preface>
16
+ <abstract id="A" displayorder='1'><title>abstract</title></abstract>
17
+ <introduction id="B" displayorder='2'><title>introduction</title></introduction>
18
+ </preface>
19
+ <sections>
20
+ <clause id="M" inline-header="false" obligation="normative" displayorder='4'>
21
+ <title>Clause 4</title>
22
+ <clause id="N" inline-header="false" obligation="normative">
23
+ <title>Introduction</title>
24
+ <p><xref target="A">HE</xref></p>
25
+ <p><eref bibitemid="R1">SHE</xref></p>
26
+ <svgmap>
27
+ <figure>
28
+ <svg xmlns="http://www.w3.org/2000/svg">
29
+ <a href="#A">A</a>
30
+ <a href="#B">B</a>
31
+ </svg>
32
+ <target href="B"><eref bibitemid="R1"/></target>
33
+ </figure>
34
+ </svgmap>
35
+ <figure>
36
+ <svg xmlns="http://www.w3.org/2000/svg">
37
+ <a href="#P">P</a>
38
+ </svg>
39
+ </figure>
40
+ </clause>
41
+ <clause id="O" inline-header="true" obligation="normative">
42
+ <title>Clause 4.2</title>
43
+ </clause></clause>
44
+ <admonition id="L" type="caution"><p>admonition</p></admonition>
45
+ </sections>
46
+ <annex id="P" inline-header="false" obligation="normative" displayorder='5'>
47
+ <title><strong>Annex</strong><br/>(informative)</title>
48
+ <clause id="Q" inline-header="false" obligation="normative">
49
+ <title>Annex A.1</title>
50
+ <clause id="Q1" inline-header="false" obligation="normative">
51
+ <title>Annex A.1a</title>
52
+ </clause>
53
+ <references id="Q2" normative="false">
54
+ <title>Annex Bibliography</title>
55
+ </references>
56
+ </clause>
57
+ </annex>
58
+ <annex id="P1" inline-header="false" obligation="normative" displayorder='6'>
59
+ </annex>
60
+ <bibliography><references id="R" obligation="informative" normative="true" displayorder='3'>
61
+ <title>Normative References</title>
62
+ <bibitem id="R1"><docidentifier>R1</docidentifier><title>Hello</title></bibitem>
63
+ </references><clause id="S" obligation="informative" displayorder='7'>
64
+ <title>Bibliography</title>
65
+ <references id="T" obligation="informative" normative="false">
66
+ <title>Bibliography Subsection</title>
67
+ </references>
68
+ </clause>
69
+ </bibliography>
70
+ </iso-standard>
71
+ INPUT
72
+ mock_render
73
+ IsoDoc::HtmlConvert.new({ sectionsplit: "true" })
74
+ .convert("test", input, true)
75
+ expect(File.exist?("test_collection/index.html")).to be true
76
+ expect(File.exist?("test_collection/test.0.html")).to be true
77
+ expect(File.exist?("test_collection/test.1.html")).to be true
78
+ expect(File.exist?("test_collection/test.2.html")).to be true
79
+ expect(File.exist?("test_collection/test.3.html")).to be false
80
+ expect(File.exist?("test_collection/test.4.html")).to be true
81
+ expect(File.exist?("test_collection/test.5.html")).to be true
82
+ expect(File.exist?("test_collection/test.6.html")).to be true
83
+ expect(File.exist?("test_collection/test.7.html")).to be true
84
+ expect(File.exist?("test_collection/test.8.html")).to be false
85
+ expect(File.exist?("test_files/cover.html")).to be true
86
+ expect(File.exist?("test_files/test.0.xml")).to be true
87
+ expect(File.exist?("test_files/test.1.xml")).to be true
88
+ expect(File.exist?("test_files/test.2.xml")).to be true
89
+ expect(File.exist?("test_files/test.3.xml")).to be true
90
+ expect(File.exist?("test_files/test.4.xml")).to be true
91
+ expect(File.exist?("test_files/test.5.xml")).to be true
92
+ expect(File.exist?("test_files/test.6.xml")).to be true
93
+ expect(File.exist?("test_files/test.7.xml")).to be true
94
+ expect(File.exist?("test_files/test.8.xml")).to be false
95
+ expect(File.exist?("test_files/test.html.yaml")).to be true
96
+ m = /type="([^"]+)"/.match(File.read("test_files/test.0.xml"))
97
+ file2 = Nokogiri::XML(File.read("test_files/test.2.xml"))
98
+ expect(xmlpp(file2
99
+ .at("//xmlns:eref[@bibitemid = '#{m[1]}_A']").to_xml))
100
+ .to be_equivalent_to xmlpp(<<~OUTPUT)
101
+ <eref bibitemid="#{m[1]}_A" type="#{m[1]}">HE<localityStack><locality type="anchor"><referenceFrom>A</referenceFrom></locality></localityStack></eref>
102
+ OUTPUT
103
+ expect(xmlpp(file2
104
+ .at("//xmlns:eref[@bibitemid = '#{m[1]}_R1']").to_xml))
105
+ .to be_equivalent_to xmlpp(<<~OUTPUT)
106
+ <eref bibitemid="#{m[1]}_R1" type="#{m[1]}">SHE<localityStack><locality type="anchor"><referenceFrom>#{m[1]}_R1</referenceFrom></locality></localityStack></eref>
107
+ OUTPUT
108
+ expect(xmlpp(file2
109
+ .at("//xmlns:bibitem[@id = '#{m[1]}_R1']").to_xml))
110
+ .to be_equivalent_to xmlpp(<<~OUTPUT)
111
+ <bibitem id="#{m[1]}_R1" type="internal">
112
+ <docidentifier type="repository">#{m[1]}/R1</docidentifier>
113
+ </bibitem>
114
+ OUTPUT
115
+ expect(xmlpp(file2
116
+ .at("//xmlns:bibitem[@id = '#{m[1]}_A']").to_xml))
117
+ .to be_equivalent_to xmlpp(<<~OUTPUT)
118
+ <bibitem id="#{m[1]}_A" type="internal">
119
+ <docidentifier type="repository">#{m[1]}/A</docidentifier>
120
+ </bibitem>
121
+ OUTPUT
122
+ expect(xmlpp(file2
123
+ .at("//xmlns:svgmap[1]").to_xml))
124
+ .to be_equivalent_to xmlpp(<<~OUTPUT)
125
+ <svgmap>
126
+ <figure>
127
+ <svg xmlns="http://www.w3.org/2000/svg">
128
+ <a href="A">A</a>
129
+ <a href="B">B</a>
130
+ </svg>
131
+ <target href="B"><eref bibitemid="#{m[1]}_R1" type="#{m[1]}"><localityStack><locality type="anchor"><referenceFrom>#{m[1]}_R1</referenceFrom></locality></localityStack></eref></target>
132
+ </figure>
133
+ <target href="A"><eref bibitemid="#{m[1]}_A" type="#{m[1]}"><localityStack><locality type="anchor"><referenceFrom>A</referenceFrom></locality></localityStack></eref></target><target href="B"><eref bibitemid="#{m[1]}_B" type="#{m[1]}"><localityStack><locality type="anchor"><referenceFrom>B</referenceFrom></locality></localityStack></eref></target></svgmap>
134
+ OUTPUT
135
+ expect(xmlpp(file2
136
+ .at("//xmlns:svgmap[2]").to_xml))
137
+ .to be_equivalent_to xmlpp(<<~OUTPUT)
138
+ <svgmap><figure>
139
+ <svg xmlns="http://www.w3.org/2000/svg">
140
+ <a href="P">P</a>
141
+ </svg>
142
+ </figure><target href="P"><eref bibitemid="#{m[1]}_P" type="#{m[1]}"><localityStack><locality type="anchor"><referenceFrom>P</referenceFrom></locality></localityStack></eref></target></svgmap>
143
+ OUTPUT
144
+ expect(File.read("test_files/test.html.yaml")).to be_equivalent_to <<~OUTPUT
145
+ ---
146
+ directives:
147
+ - presentation-xml
148
+ - bare-after-first
149
+ bibdata:
150
+ title:
151
+ type: title-main
152
+ language: en
153
+ content: ISO Title
154
+ type: collection
155
+ docid:
156
+ type: ISO
157
+ id: ISO 1
158
+ manifest:
159
+ level: collection
160
+ title: Collection
161
+ docref:
162
+ - fileref: test.3.xml
163
+ identifier: "[Untitled]"
164
+ - fileref: test.0.xml
165
+ identifier: abstract
166
+ - fileref: test.1.xml
167
+ identifier: introduction
168
+ - fileref: test.6.xml
169
+ identifier: Normative References
170
+ - fileref: test.2.xml
171
+ identifier: Clause 4
172
+ - fileref: test.4.xml
173
+ identifier: Annex (informative)
174
+ - fileref: test.5.xml
175
+ identifier: "[Untitled]"
176
+ - fileref: test.7.xml
177
+ identifier: Bibliography
178
+ OUTPUT
179
+ end
180
+
181
+ private
182
+
183
+ def mock_render
184
+ original_add = ::Metanorma::CollectionRenderer.method(:render)
185
+ allow(::Metanorma::CollectionRenderer)
186
+ .to receive(:render) do |col, opts|
187
+ original_add.call(col, opts.merge(compile: { no_install_fonts: true }))
188
+ end
189
+ end
190
+ end
@@ -62,7 +62,6 @@ RSpec.describe IsoDoc do
62
62
  </dl>
63
63
  <note><p>This is a table about rice</p></note>
64
64
  </table>
65
- #{' '}
66
65
  <table id="tableD-2" unnumbered="true">
67
66
  <tbody><tr><td>A</td></tr></tbody>
68
67
  </table>
@@ -74,7 +73,7 @@ RSpec.describe IsoDoc do
74
73
  presxml = <<~OUTPUT
75
74
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
76
75
  <preface>
77
- <foreword>
76
+ <foreword displayorder="1">
78
77
  <table id='tableD-1' alt='tool tip' summary='long desc' width='70%' keep-with-next='true' keep-lines-together='true'>
79
78
  <name>
80
79
  Table 1&#xA0;&#x2014; Repeatability and reproducibility of
@@ -406,46 +405,46 @@ RSpec.describe IsoDoc do
406
405
  <thead>
407
406
  <tr>
408
407
  <td>
409
- Description Description Description Description Description Description Description Description Description#{' '}
410
- Description Description Description Description Description Description Description Description Description#{' '}
411
- Description Description Description Description Description Description Description Description Description#{' '}
412
- Description Description Description Description Description Description Description Description Description#{' '}
413
- Description Description Description Description Description Description Description Description Description#{' '}
414
- Description Description Description Description Description Description Description Description Description#{' '}
415
- Description Description Description Description Description Description Description Description Description#{' '}
416
- Description Description Description Description Description Description Description Description Description#{' '}
417
- Description Description Description Description Description Description Description Description Description#{' '}
418
- Description Description Description Description Description Description Description Description Description#{' '}
419
- Description Description Description Description Description Description Description Description Description#{' '}
420
- Description Description Description Description Description Description Description Description Description#{' '}
421
- Description Description Description Description Description Description Description Description Description#{' '}
422
- Description Description Description Description Description Description Description Description Description#{' '}
423
- Description Description Description Description Description Description Description Description Description#{' '}
424
- Description Description Description Description Description Description Description Description Description#{' '}
425
- Description Description Description Description Description Description Description Description Description#{' '}
426
- Description Description Description Description Description Description Description Description Description#{' '}
427
- Description Description Description Description Description Description Description Description Description#{' '}
428
- Description Description Description Description Description Description Description Description Description#{' '}
429
- Description Description Description Description Description Description Description Description Description#{' '}
430
- Description Description Description Description Description Description Description Description Description#{' '}
431
- Description Description Description Description Description Description Description Description Description#{' '}
432
- Description Description Description Description Description Description Description Description Description#{' '}
433
- Description Description Description Description Description Description Description Description Description#{' '}
434
- Description Description Description Description Description Description Description Description Description#{' '}
435
- Description Description Description Description Description Description Description Description Description#{' '}
436
- Description Description Description Description Description Description Description Description Description#{' '}
437
- Description Description Description Description Description Description Description Description Description#{' '}
438
- Description Description Description Description Description Description Description Description Description#{' '}
439
- Description Description Description Description Description Description Description Description Description#{' '}
440
- Description Description Description Description Description Description Description Description Description#{' '}
441
- Description Description Description Description Description Description Description Description Description#{' '}
442
- Description Description Description Description Description Description Description Description Description#{' '}
443
- Description Description Description Description Description Description Description Description Description#{' '}
444
- Description Description Description Description Description Description Description Description Description#{' '}
445
- Description Description Description Description Description Description Description Description Description#{' '}
446
- Description Description Description Description Description Description Description Description Description#{' '}
447
- Description Description Description Description Description Description Description Description Description#{' '}
448
- Description Description Description Description Description Description Description Description Description#{' '}
408
+ Description Description Description Description Description Description Description Description Description
409
+ Description Description Description Description Description Description Description Description Description
410
+ Description Description Description Description Description Description Description Description Description
411
+ Description Description Description Description Description Description Description Description Description
412
+ Description Description Description Description Description Description Description Description Description
413
+ Description Description Description Description Description Description Description Description Description
414
+ Description Description Description Description Description Description Description Description Description
415
+ Description Description Description Description Description Description Description Description Description
416
+ Description Description Description Description Description Description Description Description Description
417
+ Description Description Description Description Description Description Description Description Description
418
+ Description Description Description Description Description Description Description Description Description
419
+ Description Description Description Description Description Description Description Description Description
420
+ Description Description Description Description Description Description Description Description Description
421
+ Description Description Description Description Description Description Description Description Description
422
+ Description Description Description Description Description Description Description Description Description
423
+ Description Description Description Description Description Description Description Description Description
424
+ Description Description Description Description Description Description Description Description Description
425
+ Description Description Description Description Description Description Description Description Description
426
+ Description Description Description Description Description Description Description Description Description
427
+ Description Description Description Description Description Description Description Description Description
428
+ Description Description Description Description Description Description Description Description Description
429
+ Description Description Description Description Description Description Description Description Description
430
+ Description Description Description Description Description Description Description Description Description
431
+ Description Description Description Description Description Description Description Description Description
432
+ Description Description Description Description Description Description Description Description Description
433
+ Description Description Description Description Description Description Description Description Description
434
+ Description Description Description Description Description Description Description Description Description
435
+ Description Description Description Description Description Description Description Description Description
436
+ Description Description Description Description Description Description Description Description Description
437
+ Description Description Description Description Description Description Description Description Description
438
+ Description Description Description Description Description Description Description Description Description
439
+ Description Description Description Description Description Description Description Description Description
440
+ Description Description Description Description Description Description Description Description Description
441
+ Description Description Description Description Description Description Description Description Description
442
+ Description Description Description Description Description Description Description Description Description
443
+ Description Description Description Description Description Description Description Description Description
444
+ Description Description Description Description Description Description Description Description Description
445
+ Description Description Description Description Description Description Description Description Description
446
+ Description Description Description Description Description Description Description Description Description
447
+ Description Description Description Description Description Description Description Description Description
449
448
  </td>
450
449
  <td>Rice sample</td>
451
450
  </tr>
@@ -69,7 +69,7 @@ RSpec.describe IsoDoc do
69
69
  presxml = <<~"PRESXML"
70
70
  <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
71
71
  <sections>
72
- <terms id='_terms_and_definitions' obligation='normative'>
72
+ <terms id='_terms_and_definitions' obligation='normative' displayorder="1">
73
73
  <title depth='1'>
74
74
  1.
75
75
  <tab/>
@@ -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,28 @@ 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
+ <foreword displayorder='1'>
2217
+ <p>
2218
+ <xref target='N1'>Introduction, List</xref>
2219
+ <xref target='N2'>Preparatory, List</xref>
2220
+ <xref target='N'>Clause 1, List</xref>
2221
+ <xref target='note1'>Clause 3.1, List 1</xref>
2222
+ <xref target='note2'>Clause 3.1, List 2</xref>
2223
+ <xref target='AN'>Annex A.1, List</xref>
2224
+ <xref target='Anote1'>Annex A.2, List 1</xref>
2225
+ <xref target='Anote2'>Annex A.2, List 2</xref>
2226
+ </p>
2227
+ </foreword>
2291
2228
  OUTPUT
2229
+ expect(xmlpp(Nokogiri::XML(IsoDoc::PresentationXMLConvert.new({})
2230
+ .convert("test", input, true))
2231
+ .at("//xmlns:foreword").to_xml))
2232
+ .to be_equivalent_to xmlpp(output)
2292
2233
  end
2293
2234
 
2294
2235
  it "cross-references list items" do
2295
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2236
+ input = <<~INPUT
2296
2237
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2297
2238
  <preface>
2298
2239
  <foreword>
@@ -2353,105 +2294,28 @@ RSpec.describe IsoDoc do
2353
2294
  </annex>
2354
2295
  </iso-standard>
2355
2296
  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>
2297
+ output = <<~OUTPUT
2298
+ <foreword displayorder='1'>
2299
+ <p>
2300
+ <xref target='N1'>Introduction, a)</xref>
2301
+ <xref target='N2'>Preparatory, 1)</xref>
2302
+ <xref target='N'>Clause 1, i)</xref>
2303
+ <xref target='note1'>Clause 3.1, List 1 a)</xref>
2304
+ <xref target='note2'>Clause 3.1, List 2 I)</xref>
2305
+ <xref target='AN'>Annex A.1, A)</xref>
2306
+ <xref target='Anote1'>Annex A.2, List 1 iv)</xref>
2307
+ <xref target='Anote2'>Annex A.2, List 2 a)</xref>
2308
+ </p>
2309
+ </foreword>
2450
2310
  OUTPUT
2311
+ expect(xmlpp(Nokogiri::XML(IsoDoc::PresentationXMLConvert.new({})
2312
+ .convert("test", input, true))
2313
+ .at("//xmlns:foreword").to_xml))
2314
+ .to be_equivalent_to xmlpp(output)
2451
2315
  end
2452
2316
 
2453
2317
  it "cross-references nested list items" do
2454
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2318
+ input = <<~INPUT
2455
2319
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2456
2320
  <preface>
2457
2321
  <foreword>
@@ -2489,65 +2353,190 @@ RSpec.describe IsoDoc do
2489
2353
  </sections>
2490
2354
  </iso-standard>
2491
2355
  INPUT
2492
- <?xml version='1.0'?>
2493
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2494
- <preface>
2356
+ output = <<~OUTPUT
2357
+ <foreword displayorder="1">
2358
+ <p>
2359
+ <xref target='N'>Clause 1, a)</xref>
2360
+ <xref target='note1'>Clause 1, a.1)</xref>
2361
+ <xref target='note2'>Clause 1, a.1.i)</xref>
2362
+ <xref target='AN'>Clause 1, a.1.i.A)</xref>
2363
+ <xref target='Anote1'>Clause 1, a.1.i.A.I)</xref>
2364
+ <xref target='Anote2'>Clause 1, a.1.i.A.I.a)</xref>
2365
+ </p>
2366
+ </foreword>
2367
+ OUTPUT
2368
+ expect(xmlpp(Nokogiri::XML(IsoDoc::PresentationXMLConvert.new({})
2369
+ .convert("test", input, true))
2370
+ .at("//xmlns:foreword").to_xml))
2371
+ .to be_equivalent_to xmlpp(output)
2372
+ end
2373
+
2374
+ it "cross-references definition lists" do
2375
+ input = <<~INPUT
2376
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
2377
+ <preface>
2495
2378
  <foreword>
2496
- <p>
2497
- <xref target='N'>Clause 1, a)</xref>
2498
- <xref target='note1'>Clause 1, a.1)</xref>
2499
- <xref target='note2'>Clause 1, a.1.i)</xref>
2500
- <xref target='AN'>Clause 1, a.1.i.A)</xref>
2501
- <xref target='Anote1'>Clause 1, a.1.i.A.I)</xref>
2502
- <xref target='Anote2'>Clause 1, a.1.i.A.I.a)</xref>
2503
- </p>
2379
+ <p>
2380
+ <xref target="N1"/>
2381
+ <xref target="N2"/>
2382
+ <xref target="N"/>
2383
+ <xref target="note1"/>
2384
+ <xref target="note2"/>
2385
+ <xref target="AN"/>
2386
+ <xref target="Anote1"/>
2387
+ <xref target="Anote2"/>
2388
+ </p>
2504
2389
  </foreword>
2505
- </preface>
2506
- <sections>
2507
- <clause id='scope' type="scope">
2508
- <title depth='1'>
2509
- 1.
2510
- <tab/>
2511
- Scope
2512
- </title>
2513
- <ol id='N1'>
2514
- <li id='N'>
2515
- <p>A</p>
2516
- <ol>
2517
- <li id='note1'>
2518
- <p>A</p>
2519
- <ol>
2520
- <li id='note2'>
2521
- <p>A</p>
2522
- <ol>
2523
- <li id='AN'>
2524
- <p>A</p>
2525
- <ol>
2526
- <li id='Anote1'>
2527
- <p>A</p>
2528
- <ol>
2529
- <li id='Anote2'>
2530
- <p>A</p>
2531
- </li>
2532
- </ol>
2533
- </li>
2534
- </ol>
2535
- </li>
2536
- </ol>
2537
- </li>
2538
- </ol>
2539
- </li>
2540
- </ol>
2541
- </li>
2542
- </ol>
2390
+ <introduction id="intro">
2391
+ <dl id="N1">
2392
+ <li><p>A</p></li>
2393
+ </dl>
2394
+ <clause id="xyz"><title>Preparatory</title>
2395
+ <dl id="N2">
2396
+ <li><p>A</p></li>
2397
+ </dl>
2398
+ </clause>
2399
+ </introduction>
2400
+ </preface>
2401
+ <sections>
2402
+ <clause id="scope" type="scope"><title>Scope</title>
2403
+ <dl id="N">
2404
+ <li><p>A</p></li>
2405
+ </dl>
2543
2406
  </clause>
2544
- </sections>
2545
- </iso-standard>
2407
+ <terms id="terms"/>
2408
+ <clause id="widgets"><title>Widgets</title>
2409
+ <clause id="widgets1">
2410
+ <dl id="note1">
2411
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
2412
+ </dl>
2413
+ <dl id="note2">
2414
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
2415
+ </dl>
2416
+ </clause>
2417
+ </clause>
2418
+ </sections>
2419
+ <annex id="annex1">
2420
+ <clause id="annex1a">
2421
+ <dl id="AN">
2422
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
2423
+ </dl>
2424
+ </clause>
2425
+ <clause id="annex1b">
2426
+ <dl id="Anote1">
2427
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
2428
+ </dl>
2429
+ <dl id="Anote2">
2430
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
2431
+ </dl>
2432
+ </clause>
2433
+ </annex>
2434
+ </iso-standard>
2435
+ INPUT
2436
+ output = <<~OUTPUT
2437
+ <foreword displayorder='1'>
2438
+ <p>
2439
+ <xref target='N1'>Introduction, Definition List</xref>
2440
+ <xref target='N2'>Preparatory, Definition List</xref>
2441
+ <xref target='N'>Clause 1, Definition List</xref>
2442
+ <xref target='note1'>Clause 3.1, Definition List 1</xref>
2443
+ <xref target='note2'>Clause 3.1, Definition List 2</xref>
2444
+ <xref target='AN'>Annex A.1, Definition List</xref>
2445
+ <xref target='Anote1'>Annex A.2, Definition List 1</xref>
2446
+ <xref target='Anote2'>Annex A.2, Definition List 2</xref>
2447
+ </p>
2448
+ </foreword>
2546
2449
  OUTPUT
2450
+ expect(xmlpp(Nokogiri::XML(IsoDoc::PresentationXMLConvert.new({})
2451
+ .convert("test", input, true))
2452
+ .at("//xmlns:foreword").to_xml))
2453
+ .to be_equivalent_to xmlpp(output)
2547
2454
  end
2548
2455
 
2456
+ it "cross-references definition list terms" do
2457
+ input = <<~INPUT
2458
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
2459
+ <preface>
2460
+ <foreword>
2461
+ <p>
2462
+ <xref target="N1"/>
2463
+ <xref target="N2"/>
2464
+ <xref target="N"/>
2465
+ <xref target="note1"/>
2466
+ <xref target="note2"/>
2467
+ <xref target="AN"/>
2468
+ <xref target="Anote1"/>
2469
+ <xref target="Anote2"/>
2470
+ </p>
2471
+ </foreword>
2472
+ <introduction id="intro">
2473
+ <dl id="N01">
2474
+ <dt id="N1"><p>A</p></dt>
2475
+ </dl>
2476
+ <clause id="xyz"><title>Preparatory</title>
2477
+ <dl id="N02" type="arabic">
2478
+ <dt id="N2"><p>A</p></dt>
2479
+ </dl>
2480
+ </clause>
2481
+ </introduction>
2482
+ </preface>
2483
+ <sections>
2484
+ <clause id="scope" type="scope"><title>Scope</title>
2485
+ <dl id="N0" type="roman">
2486
+ <dt id="N"><p>A</p></dt>
2487
+ </dl>
2488
+ </clause>
2489
+ <terms id="terms"/>
2490
+ <clause id="widgets"><title>Widgets</title>
2491
+ <clause id="widgets1">
2492
+ <dl id="note1l" type="alphabet">
2493
+ <dt id="note1"><p>A</p></dt>
2494
+ </dl>
2495
+ <dl id="note2l" type="roman_upper">
2496
+ <dt id="note2"><p>A</p></dt>
2497
+ </dl>
2498
+ </clause>
2499
+ </clause>
2500
+ </sections>
2501
+ <annex id="annex1">
2502
+ <clause id="annex1a">
2503
+ <dl id="ANl" type="alphabet_upper">
2504
+ <dt id="AN"><p>A</p></dt>
2505
+ </dl>
2506
+ </clause>
2507
+ <clause id="annex1b">
2508
+ <dl id="Anote1l" type="roman" start="4">
2509
+ <dt id="Anote1"><p>A</p></dt>
2510
+ </dl>
2511
+ <dl id="Anote2l">
2512
+ <dt id="Anote2"><p>A</p></dt>
2513
+ </dl>
2514
+ </clause>
2515
+ </annex>
2516
+ </iso-standard>
2517
+ INPUT
2518
+ output = <<~OUTPUT
2519
+ <foreword displayorder='1'>
2520
+ <p>
2521
+ <xref target='N1'>Introduction, Definition List: A</xref>
2522
+ <xref target='N2'>Preparatory, Definition List: A</xref>
2523
+ <xref target='N'>Clause 1, Definition List: A</xref>
2524
+ <xref target='note1'>Clause 3.1, Definition List 1: A</xref>
2525
+ <xref target='note2'>Clause 3.1, Definition List 2: A</xref>
2526
+ <xref target='AN'>Annex A.1, Definition List: A</xref>
2527
+ <xref target='Anote1'>Annex A.2, Definition List 1: A</xref>
2528
+ <xref target='Anote2'>Annex A.2, Definition List 2: A</xref>
2529
+ </p>
2530
+ </foreword>
2531
+ OUTPUT
2532
+ expect(xmlpp(Nokogiri::XML(IsoDoc::PresentationXMLConvert.new({})
2533
+ .convert("test", input, true))
2534
+ .at("//xmlns:foreword").to_xml))
2535
+ .to be_equivalent_to xmlpp(output)
2536
+ end
2537
+
2549
2538
  it "cross-references bookmarks" do
2550
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2539
+ input = <<~INPUT
2551
2540
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2552
2541
  <preface>
2553
2542
  <foreword>
@@ -2609,96 +2598,28 @@ RSpec.describe IsoDoc do
2609
2598
  </annex>
2610
2599
  </iso-standard>
2611
2600
  INPUT
2612
- <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>
2601
+ output = <<~OUTPUT
2602
+ <foreword displayorder='1'>
2603
+ <p>
2604
+ <xref target='N1'>Introduction</xref>
2605
+ <xref target='N2'>Preparatory</xref>
2606
+ <xref target='N'>Clause 1</xref>
2607
+ <xref target='note1'>Note 2</xref>
2608
+ <xref target='note2'>Clause 3.1</xref>
2609
+ <xref target='AN'>Annex A.1</xref>
2610
+ <xref target='Anote1'>Figure A.1</xref>
2611
+ <xref target='Anote2'>Annex A.2</xref>
2612
+ </p>
2613
+ </foreword>
2697
2614
  OUTPUT
2615
+ expect(xmlpp(Nokogiri::XML(IsoDoc::PresentationXMLConvert.new({})
2616
+ .convert("test", input, true))
2617
+ .at("//xmlns:foreword").to_xml))
2618
+ .to be_equivalent_to xmlpp(output)
2698
2619
  end
2699
2620
 
2700
2621
  it "realises subsequences" do
2701
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2622
+ input = <<~INPUT
2702
2623
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2703
2624
  <preface>
2704
2625
  <foreword id="fwd">
@@ -2741,10 +2662,8 @@ RSpec.describe IsoDoc do
2741
2662
  </introduction>
2742
2663
  </iso-standard>
2743
2664
  INPUT
2744
- <?xml version='1.0'?>
2745
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
2746
- <preface>
2747
- <foreword id='fwd'>
2665
+ output = <<~OUTPUT
2666
+ <foreword id='fwd' displayorder="1">
2748
2667
  <p>
2749
2668
  <xref target='N1'>Figure 1</xref>
2750
2669
  <xref target='N2'>Figure 2a</xref>
@@ -2756,47 +2675,15 @@ RSpec.describe IsoDoc do
2756
2675
  <xref target='N8'>Figure 5</xref>
2757
2676
  </p>
2758
2677
  </foreword>
2759
- <introduction id='intro'>
2760
- <figure id='N1'>
2761
- <name>Figure 1&#xA0;&#x2014; Split-it-right sample divider</name>
2762
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
2763
- </figure>
2764
- <figure id='N2' subsequence='A'>
2765
- <name>Figure 2a&#xA0;&#x2014; Split-it-right sample divider</name>
2766
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
2767
- </figure>
2768
- <figure id='N3' subsequence='A'>
2769
- <name>Figure 2b&#xA0;&#x2014; Split-it-right sample divider</name>
2770
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
2771
- </figure>
2772
- <figure id='N4' subsequence='B'>
2773
- <name>Figure 3a&#xA0;&#x2014; Split-it-right sample divider</name>
2774
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
2775
- </figure>
2776
- <figure id='N5' subsequence='B'>
2777
- <name>Figure 3b&#xA0;&#x2014; Split-it-right sample divider</name>
2778
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
2779
- </figure>
2780
- <figure id='N6' subsequence='B'>
2781
- <name>Figure 3c&#xA0;&#x2014; Split-it-right sample divider</name>
2782
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
2783
- </figure>
2784
- <figure id='N7'>
2785
- <name>Figure 4&#xA0;&#x2014; Split-it-right sample divider</name>
2786
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
2787
- </figure>
2788
- <figure id='N8'>
2789
- <name>Figure 5&#xA0;&#x2014; Split-it-right sample divider</name>
2790
- <image src='rice_images/rice_image1.png' id='_8357ede4-6d44-4672-bac4-9a85e82ab7f0' mimetype='image/png'/>
2791
- </figure>
2792
- </introduction>
2793
- </preface>
2794
- </iso-standard>
2795
2678
  OUTPUT
2679
+ expect(xmlpp(Nokogiri::XML(IsoDoc::PresentationXMLConvert.new({})
2680
+ .convert("test", input, true))
2681
+ .at("//xmlns:foreword").to_xml))
2682
+ .to be_equivalent_to xmlpp(output)
2796
2683
  end
2797
2684
 
2798
2685
  it "realises numbering overrides" do
2799
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
2686
+ input = <<~INPUT
2800
2687
  <iso-standard xmlns="http://riboseinc.com/isoxml">
2801
2688
  <preface>
2802
2689
  <foreword id="fwd">
@@ -2961,275 +2848,54 @@ RSpec.describe IsoDoc do
2961
2848
  </bibliography>
2962
2849
  </iso-standard>
2963
2850
  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>
2851
+ output = <<~OUTPUT
2852
+ <foreword id='fwd' displayorder='1'>
2853
+ <p>
2854
+ <xref target='N1'>Figure 1</xref>
2855
+ <xref target='N2'>Figure A</xref>
2856
+ <xref target='N3'>Figure B</xref>
2857
+ <xref target='N4'>Figure 7</xref>
2858
+ <xref target='N5'>Figure 8</xref>
2859
+ <xref target='N6'>Figure 9a</xref>
2860
+ <xref target='N7'>Figure 9c</xref>
2861
+ <xref target='N8'>Figure 9d</xref>
2862
+ <xref target='N9'>Figure 20f</xref>
2863
+ <xref target='N10'>Figure 20g</xref>
2864
+ <xref target='N11'>Figure A.1</xref>
2865
+ <xref target='N12'>Figure A.2</xref>
2866
+ <xref target='N13'>Figure 100</xref>
2867
+ </p>
2868
+ <p>
2869
+ <xref target='S1'>Clause 1bis</xref>
2870
+ <xref target='S2'>Clause 2bis</xref>
2871
+ <xref target='S3'>Clause 3bis</xref>
2872
+ <xref target='S4'>Clause 3bis.4bis</xref>
2873
+ <xref target='S12'>Clause 12bis</xref>
2874
+ <xref target='S13'>Clause 13bis</xref>
2875
+ <xref target='S14'>Clause 13bis.14bis</xref>
2876
+ <xref target='S15'>Clause 13bis.14bit</xref>
2877
+ <xref target='S16'>Clause 13bis.14biu</xref>
2878
+ <xref target='S17'>Clause 13bis.0</xref>
2879
+ <xref target='S18'>Clause 13bis.1</xref>
2880
+ <xref target='S19'>Clause 13bis.2</xref>
2881
+ <xref target='S20'>Clause 13bis.a</xref>
2882
+ <xref target='S21'>Clause 13bis.b</xref>
2883
+ <xref target='S22'>Clause 13bis.B</xref>
2884
+ <xref target='S23'>Clause 13bis.C</xref>
2885
+ <xref target='S24'>Clause 16bis</xref>
2886
+ <xref target='S25'>Annex A</xref>
2887
+ <xref target='S26'>Annex 17bis</xref>
2888
+ <xref target='S27'>Annex 17bis.18bis</xref>
2889
+ <xref target='S28'>Annex 17bit</xref>
2890
+ <xref target='S29'>Bibliography</xref>
2891
+ <xref target='S30'>Bibliography Subsection</xref>
2892
+ </p>
2893
+ </foreword>
3232
2894
  OUTPUT
2895
+ expect(xmlpp(Nokogiri::XML(IsoDoc::PresentationXMLConvert.new({})
2896
+ .convert("test", input, true))
2897
+ .at("//xmlns:foreword").to_xml))
2898
+ .to be_equivalent_to xmlpp(output)
3233
2899
  end
3234
2900
 
3235
2901
  it "realises roman counter for xrefs" do
@@ -3295,6 +2961,4 @@ RSpec.describe IsoDoc do
3295
2961
  a.increment({})
3296
2962
  expect(a.print).to eq "Bb"
3297
2963
  end
3298
-
3299
-
3300
2964
  end