metanorma-bsi 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of metanorma-bsi might be problematic. Click here for more details.

Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +43 -0
  3. data/.github/workflows/release_github_packages.yml +49 -0
  4. data/.hound.yml +3 -1
  5. data/.rubocop.yml +4 -8
  6. data/README.adoc +95 -11
  7. data/lib/asciidoctor/bsi/biblio.rng +1 -0
  8. data/lib/asciidoctor/bsi/bsi.rng +32 -4
  9. data/lib/asciidoctor/bsi/bsi_intro_en.xml +87 -61
  10. data/lib/asciidoctor/bsi/cleanup.rb +15 -8
  11. data/lib/asciidoctor/bsi/cleanup_ref.rb +10 -21
  12. data/lib/asciidoctor/bsi/converter.rb +7 -5
  13. data/lib/asciidoctor/bsi/front.rb +26 -5
  14. data/lib/asciidoctor/bsi/isodoc.rng +191 -3
  15. data/lib/asciidoctor/bsi/isostandard.rng +12 -0
  16. data/lib/asciidoctor/bsi/validate.rb +5 -6
  17. data/lib/asciidoctor/bsi/validate_list.rb +2 -2
  18. data/lib/isodoc/bsi/base_convert.rb +2 -1
  19. data/lib/isodoc/bsi/bsi.international-standard.xsl +3380 -2349
  20. data/lib/isodoc/bsi/html/htmlstyle.css +43 -22
  21. data/lib/isodoc/bsi/html/htmlstyle.scss +46 -22
  22. data/lib/isodoc/bsi/html_convert.rb +2 -2
  23. data/lib/isodoc/bsi/i18n-en.yaml +4 -4
  24. data/lib/isodoc/bsi/metadata.rb +2 -2
  25. data/lib/isodoc/bsi/presentation_xml_convert.rb +26 -5
  26. data/lib/isodoc/bsi/xref.rb +11 -4
  27. data/lib/metanorma/bsi/version.rb +1 -1
  28. data/metanorma-bsi.gemspec +2 -2
  29. data/spec/asciidoctor/base_spec.rb +564 -494
  30. data/spec/asciidoctor/blocks_spec.rb +192 -195
  31. data/spec/asciidoctor/cleanup_spec.rb +361 -361
  32. data/spec/asciidoctor/refs_spec.rb +8 -78
  33. data/spec/asciidoctor/section_spec.rb +227 -227
  34. data/spec/asciidoctor/validate_spec.rb +26 -1
  35. data/spec/isodoc/blocks_spec.rb +56 -21
  36. data/spec/isodoc/i18n_spec.rb +156 -234
  37. data/spec/isodoc/inline_spec.rb +7 -7
  38. data/spec/isodoc/iso_spec.rb +4 -4
  39. data/spec/isodoc/metadata_spec.rb +0 -1
  40. data/spec/isodoc/ref_spec.rb +7 -7
  41. data/spec/isodoc/section_spec.rb +400 -343
  42. data/spec/isodoc/terms_spec.rb +224 -225
  43. data/spec/isodoc/xref_spec.rb +1347 -1360
  44. data/spec/metanorma/processor_spec.rb +37 -40
  45. data/spec/spec_helper.rb +6 -4
  46. data/spec/vcr_cassettes/iso-639.yml +19 -19
  47. data/spec/vcr_cassettes/isobib_get_639_1967.yml +17 -17
  48. data/spec/vcr_cassettes/multistandard.yml +15 -193
  49. metadata +7 -5
@@ -2,8 +2,7 @@ require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc::BSI do
4
4
  it "cross-references commentaries" do
5
- expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
6
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
5
+ input = <<~INPUT
7
6
  <iso-standard xmlns="http://riboseinc.com/isoxml">
8
7
  <preface>
9
8
  <foreword>
@@ -57,60 +56,39 @@ RSpec.describe IsoDoc::BSI do
57
56
  </sections>
58
57
  </iso-standard>
59
58
  INPUT
60
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
61
- <preface>
62
- <foreword>
63
- <p>
64
- <xref target='N'>Commentary 1 on Clause 1</xref>
65
- <xref target='note1'>Commentary 2 on Clause 1</xref>
66
- <xref target='note2'>Commentary on Table 1</xref>
67
- <xref target='AN'>Commentary on Clause 2.1</xref>
68
- </p>
69
- </foreword>
70
- </preface>
71
- <sections>
72
- <clause id='reag1' inline-header='false' obligation='normative'>
73
- <title depth='1'>
74
- 1
75
- <tab/>
76
- Reagents
77
- </title>
78
- <admonition id='N' type='commentary' target='reag1'>
79
- <name>COMMENTARY 1 ON CLAUSE 1</name>
80
- <p id='p1'>This is a commentary on the reagents</p>
81
- </admonition>
82
- <admonition id='note1' type='commentary' target='reag1'>
83
- <name>COMMENTARY 2 ON CLAUSE 1</name>
84
- <p id='p2'>This is a commentary on the reagents</p>
85
- </admonition>
86
- <admonition id='note2' type='commentary' target='table1'>
87
- <name>COMMENTARY ON TABLE 1</name>
88
- <p id='p3'>This is a commentary on the reagents</p>
89
- </admonition>
90
- <table id='table1'>
91
- <name>Table 1&#xA0;&#x2014; Reagents in use</name>
92
- <tbody>
93
- <tr>
94
- <td valign='top' align='left'>A</td>
95
- <td valign='top' align='left'>B</td>
96
- </tr>
97
- </tbody>
98
- </table>
99
- </clause>
100
- <clause id='reag0'>
101
- <title>2</title>
102
- <clause id='reag2' inline-header='false' obligation='normative'>
103
- <title depth='2'>
104
- 2.1
59
+ output = <<~OUTPUT
60
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
61
+ <preface>
62
+ <foreword displayorder='1'>
63
+ <p>
64
+ <xref target='N'>Commentary 1 on Clause 1</xref>
65
+ <xref target='note1'>Commentary 2 on Clause 1</xref>
66
+ <xref target='note2'>Commentary on Table 1</xref>
67
+ <xref target='AN'>Commentary on Clause 2.1</xref>
68
+ </p>
69
+ </foreword>
70
+ </preface>
71
+ <sections>
72
+ <clause id='reag1' inline-header='false' obligation='normative' displayorder="2">
73
+ <title depth='1'>
74
+ 1
105
75
  <tab/>
106
76
  Reagents
107
77
  </title>
108
- <admonition id='AN' type='commentary' target='reag2'>
109
- <name>COMMENTARY ON CLAUSE 2.1</name>
78
+ <admonition id='N' type='commentary' target='reag1'>
79
+ <name>COMMENTARY 1 ON CLAUSE 1</name>
80
+ <p id='p1'>This is a commentary on the reagents</p>
81
+ </admonition>
82
+ <admonition id='note1' type='commentary' target='reag1'>
83
+ <name>COMMENTARY 2 ON CLAUSE 1</name>
110
84
  <p id='p2'>This is a commentary on the reagents</p>
111
85
  </admonition>
112
- <table id='table2'>
113
- <name>Table 2&#xA0;&#x2014; Reagents in use</name>
86
+ <admonition id='note2' type='commentary' target='table1'>
87
+ <name>COMMENTARY ON TABLE 1</name>
88
+ <p id='p3'>This is a commentary on the reagents</p>
89
+ </admonition>
90
+ <table id='table1'>
91
+ <name>Table 1&#xA0;&#x2014; Reagents in use</name>
114
92
  <tbody>
115
93
  <tr>
116
94
  <td valign='top' align='left'>A</td>
@@ -119,658 +97,710 @@ RSpec.describe IsoDoc::BSI do
119
97
  </tbody>
120
98
  </table>
121
99
  </clause>
122
- </clause>
123
- </sections>
124
- </iso-standard>
100
+ <clause id='reag0' displayorder="3">
101
+ <title>2</title>
102
+ <clause id='reag2' inline-header='false' obligation='normative'>
103
+ <title depth='2'>
104
+ 2.1
105
+ <tab/>
106
+ Reagents
107
+ </title>
108
+ <admonition id='AN' type='commentary' target='reag2'>
109
+ <name>COMMENTARY ON CLAUSE 2.1</name>
110
+ <p id='p2'>This is a commentary on the reagents</p>
111
+ </admonition>
112
+ <table id='table2'>
113
+ <name>Table 2&#xA0;&#x2014; Reagents in use</name>
114
+ <tbody>
115
+ <tr>
116
+ <td valign='top' align='left'>A</td>
117
+ <td valign='top' align='left'>B</td>
118
+ </tr>
119
+ </tbody>
120
+ </table>
121
+ </clause>
122
+ </clause>
123
+ </sections>
124
+ </iso-standard>
125
125
  OUTPUT
126
+ expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
127
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
126
128
  end
127
129
 
128
130
  it "cross-references notes" do
129
- expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
130
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
131
- <iso-standard xmlns="http://riboseinc.com/isoxml">
132
- <preface>
133
- <foreword>
134
- <p>
135
- <xref target="N"/>
136
- <xref target="note1"/>
137
- <xref target="note2"/>
138
- <xref target="AN"/>
139
- <xref target="Anote1"/>
140
- <xref target="Anote2"/>
141
- </p>
142
- </foreword>
143
- </preface>
144
- <sections>
145
- <clause id="scope" type="scope">
146
- <title>Scope</title>
147
- <note id="N">
148
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
149
- </note>
150
- <p>
151
- <xref target="N"/>
152
- </p>
153
- </clause>
154
- <terms id="terms"/>
155
- <clause id="widgets">
156
- <title>Widgets</title>
157
- <clause id="widgets1">
158
- <note id="note1">
159
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
160
- </note>
161
- <note id="note2">
162
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
163
- </note>
164
- <p>
165
- <xref target="note1"/>
166
- <xref target="note2"/>
167
- </p>
168
- </clause>
169
- </clause>
170
- </sections>
171
- <annex id="annex1">
172
- <clause id="annex1a">
173
- <note id="AN">
174
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
175
- </note>
176
- </clause>
177
- <clause id="annex1b">
178
- <note id="Anote1">
131
+ input = <<~INPUT
132
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
133
+ <preface>
134
+ <foreword>
135
+ <p>
136
+ <xref target="N"/>
137
+ <xref target="note1"/>
138
+ <xref target="note2"/>
139
+ <xref target="AN"/>
140
+ <xref target="Anote1"/>
141
+ <xref target="Anote2"/>
142
+ </p>
143
+ </foreword>
144
+ </preface>
145
+ <sections>
146
+ <clause id="scope" type="scope">
147
+ <title>Scope</title>
148
+ <note id="N">
149
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
150
+ </note>
151
+ <p>
152
+ <xref target="N"/>
153
+ </p>
154
+ </clause>
155
+ <terms id="terms"/>
156
+ <clause id="widgets">
157
+ <title>Widgets</title>
158
+ <clause id="widgets1">
159
+ <note id="note1">
179
160
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
180
161
  </note>
181
- <note id="Anote2">
162
+ <note id="note2">
182
163
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
183
164
  </note>
184
- </clause>
185
- </annex>
186
- </iso-standard>
187
- INPUT
188
- <?xml version='1.0'?>
189
- <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
190
- <preface>
191
- <foreword>
192
- <p>
193
- <xref target="N">Clause <strong>1</strong>, Note</xref>
194
- <xref target="note1"><strong>3.1</strong>, Note 1</xref>
195
- <xref target="note2"><strong>3.1</strong>, Note 2</xref>
196
- <xref target="AN"><strong>A.1</strong>, Note</xref>
197
- <xref target="Anote1"><strong>A.2</strong>, Note 1</xref>
198
- <xref target="Anote2"><strong>A.2</strong>, Note 2</xref>
199
- </p>
200
- </foreword>
201
- </preface>
202
- <sections>
203
- <clause id="scope" type="scope">
204
- <title depth="1">1
205
- <tab/>
206
- Scope</title>
207
- <note id="N">
208
- <name>NOTE</name>
209
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different
210
- types of kernel.
211
- </p>
212
- </note>
213
165
  <p>
214
- <xref target="N">Note</xref>
166
+ <xref target="note1"/>
167
+ <xref target="note2"/>
215
168
  </p>
216
169
  </clause>
217
- <terms id="terms">
218
- <title>2</title>
219
- </terms>
220
- <clause id="widgets">
221
- <title depth="1">3
222
- <tab/>
223
- Widgets</title>
224
- <clause id="widgets1" inline-header="true">
225
- <title>3.1</title>
226
- <note id="note1">
227
- <name>NOTE 1</name>
228
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different
229
- types of kernel.
230
- </p>
231
- </note>
232
- <note id="note2">
233
- <name>NOTE 2</name>
234
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different
235
- types of kernel.
236
- </p>
237
- </note>
238
- <p>
239
- <xref target="note1">Note 1</xref>
240
- <xref target="note2">Note 2</xref>
241
- </p>
242
- </clause>
243
- </clause>
244
- </sections>
245
- <annex id="annex1">
246
- <title>
247
- <strong>Annex A</strong>
248
- <br/>(informative)</title>
249
- <clause id="annex1a" inline-header="true">
250
- <title>A.1</title>
251
- <note id="AN">
252
- <name>NOTE</name>
253
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different
254
- types of kernel.
255
- </p>
256
- </note>
257
- </clause>
258
- <clause id="annex1b" inline-header="true">
259
- <title>A.2</title>
260
- <note id="Anote1">
170
+ </clause>
171
+ </sections>
172
+ <annex id="annex1">
173
+ <clause id="annex1a">
174
+ <note id="AN">
175
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
176
+ </note>
177
+ </clause>
178
+ <clause id="annex1b">
179
+ <note id="Anote1">
180
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
181
+ </note>
182
+ <note id="Anote2">
183
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
184
+ </note>
185
+ </clause>
186
+ </annex>
187
+ </iso-standard>
188
+ INPUT
189
+ output = <<~OUTPUT
190
+ <?xml version='1.0'?>
191
+ <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
192
+ <preface>
193
+ <foreword displayorder='1'>
194
+ <p>
195
+ <xref target="N">Clause <strong>1</strong>, Note</xref>
196
+ <xref target="note1"><strong>3.1</strong>, Note 1</xref>
197
+ <xref target="note2"><strong>3.1</strong>, Note 2</xref>
198
+ <xref target="AN"><strong>A.1</strong>, Note</xref>
199
+ <xref target="Anote1"><strong>A.2</strong>, Note 1</xref>
200
+ <xref target="Anote2"><strong>A.2</strong>, Note 2</xref>
201
+ </p>
202
+ </foreword>
203
+ </preface>
204
+ <sections>
205
+ <clause id="scope" type="scope" displayorder='2'>
206
+ <title depth="1">1
207
+ <tab/>
208
+ Scope</title>
209
+ <note id="N">
210
+ <name>NOTE</name>
211
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different
212
+ types of kernel.
213
+ </p>
214
+ </note>
215
+ <p>
216
+ <xref target="N">Note</xref>
217
+ </p>
218
+ </clause>
219
+ <terms id="terms" displayorder='3'>
220
+ <title>2</title>
221
+ </terms>
222
+ <clause id="widgets" displayorder='4'>
223
+ <title depth="1">3
224
+ <tab/>
225
+ Widgets</title>
226
+ <clause id="widgets1" inline-header="true">
227
+ <title>3.1</title>
228
+ <note id="note1">
261
229
  <name>NOTE 1</name>
262
230
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different
263
231
  types of kernel.
264
232
  </p>
265
233
  </note>
266
- <note id="Anote2">
234
+ <note id="note2">
267
235
  <name>NOTE 2</name>
268
236
  <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different
269
237
  types of kernel.
270
238
  </p>
271
239
  </note>
240
+ <p>
241
+ <xref target="note1">Note 1</xref>
242
+ <xref target="note2">Note 2</xref>
243
+ </p>
272
244
  </clause>
273
- </annex>
274
- </iso-standard>
275
- OUTPUT
245
+ </clause>
246
+ </sections>
247
+ <annex id="annex1" displayorder='5'>
248
+ <title>
249
+ <strong>Annex A</strong>
250
+ <tab/>(informative)</title>
251
+ <clause id="annex1a" inline-header="true">
252
+ <title>A.1</title>
253
+ <note id="AN">
254
+ <name>NOTE</name>
255
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different
256
+ types of kernel.
257
+ </p>
258
+ </note>
259
+ </clause>
260
+ <clause id="annex1b" inline-header="true">
261
+ <title>A.2</title>
262
+ <note id="Anote1">
263
+ <name>NOTE 1</name>
264
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different
265
+ types of kernel.
266
+ </p>
267
+ </note>
268
+ <note id="Anote2">
269
+ <name>NOTE 2</name>
270
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different
271
+ types of kernel.
272
+ </p>
273
+ </note>
274
+ </clause>
275
+ </annex>
276
+ </iso-standard>
277
+ OUTPUT
278
+ expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
279
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
276
280
  end
277
281
 
278
282
  it "cross-references figures (Presentation XML)" do
279
- expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
280
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
281
- <iso-standard xmlns="http://riboseinc.com/isoxml">
282
- <preface>
283
- <foreword id="fwd">
284
- <p>
285
- <xref target="N"/>
286
- <xref target="note1"/>
287
- <xref target="note2"/>
288
- <xref target="AN"/>
289
- <xref target="Anote1"/>
290
- <xref target="Anote2"/>
291
- </p>
292
- </foreword>
293
- </preface>
294
- <sections>
295
- <clause id="scope" type="scope">
296
- <title>Scope</title>
297
- <figure id="N">
283
+ input = <<~INPUT
284
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
285
+ <preface>
286
+ <foreword id="fwd">
287
+ <p>
288
+ <xref target="N"/>
289
+ <xref target="note1"/>
290
+ <xref target="note2"/>
291
+ <xref target="AN"/>
292
+ <xref target="Anote1"/>
293
+ <xref target="Anote2"/>
294
+ </p>
295
+ </foreword>
296
+ </preface>
297
+ <sections>
298
+ <clause id="scope" type="scope">
299
+ <title>Scope</title>
300
+ <figure id="N">
301
+ <name>Split-it-right sample divider</name>
302
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
303
+ </figure>
304
+ <p>
305
+ <xref target="N"/>
306
+ </p>
307
+ </clause>
308
+ <terms id="terms"/>
309
+ <clause id="widgets">
310
+ <title>Widgets</title>
311
+ <clause id="widgets1">
312
+ <figure id="note1">
298
313
  <name>Split-it-right sample divider</name>
299
314
  <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
300
315
  </figure>
301
- <p>
302
- <xref target="N"/>
303
- </p>
304
- </clause>
305
- <terms id="terms"/>
306
- <clause id="widgets">
307
- <title>Widgets</title>
308
- <clause id="widgets1">
309
- <figure id="note1">
310
- <name>Split-it-right sample divider</name>
311
- <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
312
- </figure>
313
- <figure id="note2">
314
- <name>Split-it-right sample divider</name>
315
- <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
316
- </figure>
317
- <p>
318
- <xref target="note1"/>
319
- <xref target="note2"/>
320
- </p>
321
- </clause>
322
- </clause>
323
- </sections>
324
- <annex id="annex1">
325
- <clause id="annex1a">
326
- <figure id="AN">
316
+ <figure id="note2">
327
317
  <name>Split-it-right sample divider</name>
328
318
  <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
329
319
  </figure>
320
+ <p>
321
+ <xref target="note1"/>
322
+ <xref target="note2"/>
323
+ </p>
330
324
  </clause>
331
- <clause id="annex1b">
332
- <figure id="Anote1">
333
- <name>Split-it-right sample divider</name>
325
+ </clause>
326
+ </sections>
327
+ <annex id="annex1">
328
+ <clause id="annex1a">
329
+ <figure id="AN">
330
+ <name>Split-it-right sample divider</name>
331
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
332
+ </figure>
333
+ </clause>
334
+ <clause id="annex1b">
335
+ <figure id="Anote1">
336
+ <name>Split-it-right sample divider</name>
337
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
338
+ </figure>
339
+ <figure id="Anote2">
340
+ <name>Split-it-right sample divider</name>
341
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
342
+ </figure>
343
+ </clause>
344
+ </annex>
345
+ </iso-standard>
346
+ INPUT
347
+ output = <<~OUTPUT
348
+ <?xml version='1.0'?>
349
+ <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
350
+ <preface>
351
+ <foreword id="fwd" displayorder='1'>
352
+ <p>
353
+ <xref target="N">Figure 1</xref>
354
+ <xref target="note1">Figure 2</xref>
355
+ <xref target="note2">Figure 3</xref>
356
+ <xref target="AN">Figure A.1</xref>
357
+ <xref target="Anote1">Figure A.2</xref>
358
+ <xref target="Anote2">Figure A.3</xref>
359
+ </p>
360
+ </foreword>
361
+ </preface>
362
+ <sections>
363
+ <clause id="scope" type="scope" displayorder='2'>
364
+ <title depth="1">1
365
+ <tab/>
366
+ Scope</title>
367
+ <figure id="N">
368
+ <name>Figure 1 — Split-it-right sample divider</name>
369
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
370
+ </figure>
371
+ <p>
372
+ <xref target="N">Figure 1</xref>
373
+ </p>
374
+ </clause>
375
+ <terms id="terms" displayorder='3'>
376
+ <title>2</title>
377
+ </terms>
378
+ <clause id="widgets" displayorder='4'>
379
+ <title depth="1">3
380
+ <tab/>
381
+ Widgets</title>
382
+ <clause id="widgets1" inline-header="true">
383
+ <title>3.1</title>
384
+ <figure id="note1">
385
+ <name>Figure 2 — Split-it-right sample divider</name>
334
386
  <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
335
387
  </figure>
336
- <figure id="Anote2">
337
- <name>Split-it-right sample divider</name>
388
+ <figure id="note2">
389
+ <name>Figure 3 — Split-it-right sample divider</name>
338
390
  <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
339
391
  </figure>
340
- </clause>
341
- </annex>
342
- </iso-standard>
343
- INPUT
344
- <?xml version='1.0'?>
345
- <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
346
- <preface>
347
- <foreword id="fwd">
348
392
  <p>
349
- <xref target="N">Figure 1</xref>
350
393
  <xref target="note1">Figure 2</xref>
351
394
  <xref target="note2">Figure 3</xref>
352
- <xref target="AN">Figure A.1</xref>
353
- <xref target="Anote1">Figure A.2</xref>
354
- <xref target="Anote2">Figure A.3</xref>
355
- </p>
356
- </foreword>
357
- </preface>
358
- <sections>
359
- <clause id="scope" type="scope">
360
- <title depth="1">1
361
- <tab/>
362
- Scope</title>
363
- <figure id="N">
364
- <name>Figure 1 — Split-it-right sample divider</name>
365
- <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
366
- </figure>
367
- <p>
368
- <xref target="N">Figure 1</xref>
369
395
  </p>
370
396
  </clause>
371
- <terms id="terms">
372
- <title>2</title>
373
- </terms>
374
- <clause id="widgets">
375
- <title depth="1">3
376
- <tab/>
377
- Widgets</title>
378
- <clause id="widgets1" inline-header="true">
379
- <title>3.1</title>
380
- <figure id="note1">
381
- <name>Figure 2 — Split-it-right sample divider</name>
382
- <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
383
- </figure>
384
- <figure id="note2">
385
- <name>Figure 3 — Split-it-right sample divider</name>
386
- <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
387
- </figure>
388
- <p>
389
- <xref target="note1">Figure 2</xref>
390
- <xref target="note2">Figure 3</xref>
391
- </p>
392
- </clause>
393
- </clause>
394
- </sections>
395
- <annex id="annex1">
396
- <title>
397
- <strong>Annex A</strong>
398
- <br/>(informative)</title>
399
- <clause id="annex1a" inline-header="true">
400
- <title>A.1</title>
401
- <figure id="AN">
402
- <name>Figure A.1 — Split-it-right sample divider</name>
403
- <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
404
- </figure>
405
- </clause>
406
- <clause id="annex1b" inline-header="true">
407
- <title>A.2</title>
408
- <figure id="Anote1">
409
- <name>Figure A.2 — Split-it-right sample divider</name>
410
- <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
411
- </figure>
412
- <figure id="Anote2">
413
- <name>Figure A.3 — Split-it-right sample divider</name>
414
- <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
415
- </figure>
416
- </clause>
417
- </annex>
418
- </iso-standard>
419
- OUTPUT
397
+ </clause>
398
+ </sections>
399
+ <annex id="annex1" displayorder='5'>
400
+ <title>
401
+ <strong>Annex A</strong>
402
+ <tab/>(informative)</title>
403
+ <clause id="annex1a" inline-header="true">
404
+ <title>A.1</title>
405
+ <figure id="AN">
406
+ <name>Figure A.1 — Split-it-right sample divider</name>
407
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
408
+ </figure>
409
+ </clause>
410
+ <clause id="annex1b" inline-header="true">
411
+ <title>A.2</title>
412
+ <figure id="Anote1">
413
+ <name>Figure A.2 — Split-it-right sample divider</name>
414
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
415
+ </figure>
416
+ <figure id="Anote2">
417
+ <name>Figure A.3 — Split-it-right sample divider</name>
418
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
419
+ </figure>
420
+ </clause>
421
+ </annex>
422
+ </iso-standard>
423
+ OUTPUT
424
+ expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
425
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
420
426
  end
421
427
 
422
428
  it "cross-references subfigures (Presentation XML)" do
423
- expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
424
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
425
- <iso-standard xmlns="http://riboseinc.com/isoxml">
426
- <preface>
427
- <foreword id="fwd">
428
- <p>
429
- <xref target="N"/>
430
- <xref target="note1"/>
431
- <xref target="note2"/>
432
- <xref target="AN"/>
433
- <xref target="Anote1"/>
434
- <xref target="Anote2"/>
435
- </p>
436
- </foreword>
437
- </preface>
438
- <sections>
439
- <clause id="scope" type="scope">
440
- <title>Scope</title>
441
- </clause>
442
- <terms id="terms"/>
443
- <clause id="widgets">
444
- <title>Widgets</title>
445
- <clause id="widgets1">
446
- <figure id="N">
447
- <figure id="note1">
448
- <name>Split-it-right sample divider</name>
449
- <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
450
- </figure>
451
- <figure id="note2">
452
- <name>Split-it-right sample divider</name>
453
- <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
454
- </figure>
455
- </figure>
456
- <p>
457
- <xref target="note1"/>
458
- <xref target="note2"/>
459
- </p>
460
- </clause>
461
- </clause>
462
- </sections>
463
- <annex id="annex1">
464
- <clause id="annex1a"/>
465
- <clause id="annex1b">
466
- <figure id="AN">
467
- <figure id="Anote1">
429
+ input = <<~INPUT
430
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
431
+ <preface>
432
+ <foreword id="fwd">
433
+ <p>
434
+ <xref target="N"/>
435
+ <xref target="note1"/>
436
+ <xref target="note2"/>
437
+ <xref target="AN"/>
438
+ <xref target="Anote1"/>
439
+ <xref target="Anote2"/>
440
+ </p>
441
+ </foreword>
442
+ </preface>
443
+ <sections>
444
+ <clause id="scope" type="scope">
445
+ <title>Scope</title>
446
+ </clause>
447
+ <terms id="terms"/>
448
+ <clause id="widgets">
449
+ <title>Widgets</title>
450
+ <clause id="widgets1">
451
+ <figure id="N">
452
+ <figure id="note1">
468
453
  <name>Split-it-right sample divider</name>
469
454
  <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
470
455
  </figure>
471
- <figure id="Anote2">
456
+ <figure id="note2">
472
457
  <name>Split-it-right sample divider</name>
473
458
  <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
474
459
  </figure>
475
460
  </figure>
476
- </clause>
477
- </annex>
478
- </iso-standard>
479
- INPUT
480
- <?xml version='1.0'?>
481
- <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
482
- <preface>
483
- <foreword id="fwd">
484
461
  <p>
485
- <xref target="N">Figure 1</xref>
486
- <xref target="note1">Figure 1 a)</xref>
487
- <xref target="note2">Figure 1 b)</xref>
488
- <xref target="AN">Figure A.1</xref>
489
- <xref target="Anote1">Figure A.1 a)</xref>
490
- <xref target="Anote2">Figure A.1 b)</xref>
462
+ <xref target="note1"/>
463
+ <xref target="note2"/>
491
464
  </p>
492
- </foreword>
493
- </preface>
494
- <sections>
495
- <clause id="scope" type="scope">
496
- <title depth="1">1
497
- <tab/>
498
- Scope</title>
499
465
  </clause>
500
- <terms id="terms">
501
- <title>2</title>
502
- </terms>
503
- <clause id="widgets">
504
- <title depth="1">3
505
- <tab/>
506
- Widgets</title>
507
- <clause id="widgets1" inline-header="true">
508
- <title>3.1</title>
509
- <figure id="N">
510
- <name>Figure 1</name>
511
- <figure id="note1">
512
- <name>a)  Split-it-right sample divider</name>
513
- <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
514
- </figure>
515
- <figure id="note2">
516
- <name>b)  Split-it-right sample divider</name>
517
- <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
518
- </figure>
519
- </figure>
520
- <p>
521
- <xref target="note1">Figure 1 a)</xref>
522
- <xref target="note2">Figure 1 b)</xref>
523
- </p>
524
- </clause>
525
- </clause>
526
- </sections>
527
- <annex id="annex1">
528
- <title>
529
- <strong>Annex A</strong>
530
- <br/>(informative)</title>
531
- <clause id="annex1a" inline-header="true">
532
- <title>A.1</title>
533
- </clause>
534
- <clause id="annex1b" inline-header="true">
535
- <title>A.2</title>
536
- <figure id="AN">
537
- <name>Figure A.1</name>
538
- <figure id="Anote1">
466
+ </clause>
467
+ </sections>
468
+ <annex id="annex1">
469
+ <clause id="annex1a"/>
470
+ <clause id="annex1b">
471
+ <figure id="AN">
472
+ <figure id="Anote1">
473
+ <name>Split-it-right sample divider</name>
474
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
475
+ </figure>
476
+ <figure id="Anote2">
477
+ <name>Split-it-right sample divider</name>
478
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
479
+ </figure>
480
+ </figure>
481
+ </clause>
482
+ </annex>
483
+ </iso-standard>
484
+ INPUT
485
+ output = <<~OUTPUT
486
+ <?xml version='1.0'?>
487
+ <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
488
+ <preface>
489
+ <foreword id="fwd" displayorder='1'>
490
+ <p>
491
+ <xref target="N">Figure 1</xref>
492
+ <xref target="note1">Figure 1 a)</xref>
493
+ <xref target="note2">Figure 1 b)</xref>
494
+ <xref target="AN">Figure A.1</xref>
495
+ <xref target="Anote1">Figure A.1 a)</xref>
496
+ <xref target="Anote2">Figure A.1 b)</xref>
497
+ </p>
498
+ </foreword>
499
+ </preface>
500
+ <sections>
501
+ <clause id="scope" type="scope" displayorder='2'>
502
+ <title depth="1">1
503
+ <tab/>
504
+ Scope</title>
505
+ </clause>
506
+ <terms id="terms" displayorder='3'>
507
+ <title>2</title>
508
+ </terms>
509
+ <clause id="widgets" displayorder='4'>
510
+ <title depth="1">3
511
+ <tab/>
512
+ Widgets</title>
513
+ <clause id="widgets1" inline-header="true">
514
+ <title>3.1</title>
515
+ <figure id="N">
516
+ <name>Figure 1</name>
517
+ <figure id="note1">
539
518
  <name>a)  Split-it-right sample divider</name>
540
519
  <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
541
520
  </figure>
542
- <figure id="Anote2">
521
+ <figure id="note2">
543
522
  <name>b)  Split-it-right sample divider</name>
544
523
  <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
545
524
  </figure>
546
525
  </figure>
526
+ <p>
527
+ <xref target="note1">Figure 1 a)</xref>
528
+ <xref target="note2">Figure 1 b)</xref>
529
+ </p>
547
530
  </clause>
548
- </annex>
549
- </iso-standard>
550
- OUTPUT
531
+ </clause>
532
+ </sections>
533
+ <annex id="annex1" displayorder='5'>
534
+ <title>
535
+ <strong>Annex A</strong>
536
+ <tab/>(informative)</title>
537
+ <clause id="annex1a" inline-header="true">
538
+ <title>A.1</title>
539
+ </clause>
540
+ <clause id="annex1b" inline-header="true">
541
+ <title>A.2</title>
542
+ <figure id="AN">
543
+ <name>Figure A.1</name>
544
+ <figure id="Anote1">
545
+ <name>a)  Split-it-right sample divider</name>
546
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
547
+ </figure>
548
+ <figure id="Anote2">
549
+ <name>b)  Split-it-right sample divider</name>
550
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
551
+ </figure>
552
+ </figure>
553
+ </clause>
554
+ </annex>
555
+ </iso-standard>
556
+ OUTPUT
557
+ expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
558
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
551
559
  end
552
560
 
553
561
  it "cross-references examples" do
554
- expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
555
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
556
- <iso-standard xmlns="http://riboseinc.com/isoxml">
557
- <preface>
558
- <foreword>
559
- <p>
560
- <xref target="N"/>
561
- <xref target="note1"/>
562
- <xref target="note2"/>
563
- <xref target="AN"/>
564
- <xref target="Anote1"/>
565
- <xref target="Anote2"/>
566
- </p>
567
- </foreword>
568
- </preface>
569
- <sections>
570
- <clause id="scope" type="scope">
571
- <title>Scope</title>
572
- <example id="N">
573
- <p>Hello</p>
574
- </example>
575
- <p>
576
- <xref target="N"/>
577
- </p>
578
- </clause>
579
- <terms id="terms"/>
580
- <clause id="widgets">
581
- <title>Widgets</title>
582
- <clause id="widgets1">
583
- <example id="note1">
584
- <p>Hello</p>
585
- </example>
586
- <example id="note2">
587
- <p>Hello</p>
588
- </example>
589
- <p>
590
- <xref target="note1"/>
591
- <xref target="note2"/>
592
- </p>
593
- </clause>
594
- </clause>
595
- </sections>
596
- <annex id="annex1">
597
- <clause id="annex1a">
598
- <example id="AN">
599
- <p>Hello</p>
600
- </example>
601
- </clause>
602
- <clause id="annex1b">
603
- <example id="Anote1">
604
- <p>Hello</p>
605
- </example>
606
- <example id="Anote2">
562
+ input = <<~INPUT
563
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
564
+ <preface>
565
+ <foreword>
566
+ <p>
567
+ <xref target="N"/>
568
+ <xref target="note1"/>
569
+ <xref target="note2"/>
570
+ <xref target="AN"/>
571
+ <xref target="Anote1"/>
572
+ <xref target="Anote2"/>
573
+ </p>
574
+ </foreword>
575
+ </preface>
576
+ <sections>
577
+ <clause id="scope" type="scope">
578
+ <title>Scope</title>
579
+ <example id="N">
580
+ <p>Hello</p>
581
+ </example>
582
+ <p>
583
+ <xref target="N"/>
584
+ </p>
585
+ </clause>
586
+ <terms id="terms"/>
587
+ <clause id="widgets">
588
+ <title>Widgets</title>
589
+ <clause id="widgets1">
590
+ <example id="note1">
607
591
  <p>Hello</p>
608
592
  </example>
609
- </clause>
610
- </annex>
611
- </iso-standard>
612
- INPUT
613
- <?xml version='1.0'?>
614
- <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
615
- <preface>
616
- <foreword>
617
- <p>
618
- <xref target="N">Clause <strong>1</strong>, Example</xref>
619
- <xref target="note1"><strong>3.1</strong>, Example 1</xref>
620
- <xref target="note2"><strong>3.1</strong>, Example 2</xref>
621
- <xref target="AN"><strong>A.1</strong>, Example</xref>
622
- <xref target="Anote1"><strong>A.2</strong>, Example 1</xref>
623
- <xref target="Anote2"><strong>A.2</strong>, Example 2</xref>
624
- </p>
625
- </foreword>
626
- </preface>
627
- <sections>
628
- <clause id="scope" type="scope">
629
- <title depth="1">1
630
- <tab/>
631
- Scope</title>
632
- <example id="N">
633
- <name>EXAMPLE</name>
593
+ <example id="note2">
634
594
  <p>Hello</p>
635
595
  </example>
636
596
  <p>
637
- <xref target="N">Example</xref>
597
+ <xref target="note1"/>
598
+ <xref target="note2"/>
638
599
  </p>
639
600
  </clause>
640
- <terms id="terms">
641
- <title>2</title>
642
- </terms>
643
- <clause id="widgets">
644
- <title depth="1">3
645
- <tab/>
646
- Widgets</title>
647
- <clause id="widgets1" inline-header="true">
648
- <title>3.1</title>
649
- <example id="note1">
650
- <name>EXAMPLE 1</name>
651
- <p>Hello</p>
652
- </example>
653
- <example id="note2">
654
- <name>EXAMPLE 2</name>
655
- <p>Hello</p>
656
- </example>
657
- <p>
658
- <xref target="note1">Example 1</xref>
659
- <xref target="note2">Example 2</xref>
660
- </p>
661
- </clause>
662
- </clause>
663
- </sections>
664
- <annex id="annex1">
665
- <title>
666
- <strong>Annex A</strong>
667
- <br/>(informative)</title>
668
- <clause id="annex1a" inline-header="true">
669
- <title>A.1</title>
670
- <example id="AN">
671
- <name>EXAMPLE</name>
672
- <p>Hello</p>
673
- </example>
674
- </clause>
675
- <clause id="annex1b" inline-header="true">
676
- <title>A.2</title>
677
- <example id="Anote1">
601
+ </clause>
602
+ </sections>
603
+ <annex id="annex1">
604
+ <clause id="annex1a">
605
+ <example id="AN">
606
+ <p>Hello</p>
607
+ </example>
608
+ </clause>
609
+ <clause id="annex1b">
610
+ <example id="Anote1">
611
+ <p>Hello</p>
612
+ </example>
613
+ <example id="Anote2">
614
+ <p>Hello</p>
615
+ </example>
616
+ </clause>
617
+ </annex>
618
+ </iso-standard>
619
+ INPUT
620
+ output = <<~OUTPUT
621
+ <?xml version='1.0'?>
622
+ <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
623
+ <preface>
624
+ <foreword displayorder='1'>
625
+ <p>
626
+ <xref target="N">Clause <strong>1</strong>, Example</xref>
627
+ <xref target="note1"><strong>3.1</strong>, Example 1</xref>
628
+ <xref target="note2"><strong>3.1</strong>, Example 2</xref>
629
+ <xref target="AN"><strong>A.1</strong>, Example</xref>
630
+ <xref target="Anote1"><strong>A.2</strong>, Example 1</xref>
631
+ <xref target="Anote2"><strong>A.2</strong>, Example 2</xref>
632
+ </p>
633
+ </foreword>
634
+ </preface>
635
+ <sections>
636
+ <clause id="scope" type="scope" displayorder='2'>
637
+ <title depth="1">1
638
+ <tab/>
639
+ Scope</title>
640
+ <example id="N">
641
+ <name>EXAMPLE</name>
642
+ <p>Hello</p>
643
+ </example>
644
+ <p>
645
+ <xref target="N">Example</xref>
646
+ </p>
647
+ </clause>
648
+ <terms id="terms" displayorder='3'>
649
+ <title>2</title>
650
+ </terms>
651
+ <clause id="widgets" displayorder='4'>
652
+ <title depth="1">3
653
+ <tab/>
654
+ Widgets</title>
655
+ <clause id="widgets1" inline-header="true">
656
+ <title>3.1</title>
657
+ <example id="note1">
678
658
  <name>EXAMPLE 1</name>
679
659
  <p>Hello</p>
680
660
  </example>
681
- <example id="Anote2">
661
+ <example id="note2">
682
662
  <name>EXAMPLE 2</name>
683
663
  <p>Hello</p>
684
664
  </example>
665
+ <p>
666
+ <xref target="note1">Example 1</xref>
667
+ <xref target="note2">Example 2</xref>
668
+ </p>
685
669
  </clause>
686
- </annex>
687
- </iso-standard>
688
- OUTPUT
670
+ </clause>
671
+ </sections>
672
+ <annex id="annex1" displayorder='5'>
673
+ <title>
674
+ <strong>Annex A</strong>
675
+ <tab/>(informative)</title>
676
+ <clause id="annex1a" inline-header="true">
677
+ <title>A.1</title>
678
+ <example id="AN">
679
+ <name>EXAMPLE</name>
680
+ <p>Hello</p>
681
+ </example>
682
+ </clause>
683
+ <clause id="annex1b" inline-header="true">
684
+ <title>A.2</title>
685
+ <example id="Anote1">
686
+ <name>EXAMPLE 1</name>
687
+ <p>Hello</p>
688
+ </example>
689
+ <example id="Anote2">
690
+ <name>EXAMPLE 2</name>
691
+ <p>Hello</p>
692
+ </example>
693
+ </clause>
694
+ </annex>
695
+ </iso-standard>
696
+ OUTPUT
697
+ expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
698
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
689
699
  end
690
700
 
691
- it "cross-references formulae" do
692
- expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true).gsub(%r{^.*<body}m, "<body").gsub(%r{</body>.*}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
693
- <iso-standard xmlns="http://riboseinc.com/isoxml">
694
- <preface>
695
- <foreword>
696
- <p>
697
- <xref target="N1"/>
698
- <xref target="N2"/>
699
- </p>
700
- </foreword>
701
- </preface>
702
- <sections>
703
- <clause id="intro"><title>First</title>
704
- <formula id="N1">
705
- <stem type="AsciiMath">r = 1 %</stem>
706
- </formula>
707
- <clause id="xyz"><title>Preparatory</title>
708
- <formula id="N2" inequality="true">
709
- <stem type="AsciiMath">r = 1 %</stem>
710
- </formula>
711
- <xref target="N2"/>
712
- </clause>
713
- </sections>
714
- </iso-standard>
701
+ it "cross-references formulae" do
702
+ input = <<~INPUT
703
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
704
+ <preface>
705
+ <foreword>
706
+ <p>
707
+ <xref target="N1"/>
708
+ <xref target="N2"/>
709
+ </p>
710
+ </foreword>
711
+ </preface>
712
+ <sections>
713
+ <clause id="intro"><title>First</title>
714
+ <formula id="N1">
715
+ <stem type="AsciiMath">r = 1 %</stem>
716
+ </formula>
717
+ <clause id="xyz"><title>Preparatory</title>
718
+ <formula id="N2" inequality="true">
719
+ <stem type="AsciiMath">r = 1 %</stem>
720
+ </formula>
721
+ <xref target="N2"/>
722
+ </clause>
723
+ </sections>
724
+ </iso-standard>
715
725
  INPUT
716
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
717
- <preface>
718
- <foreword>
719
- <p>
720
- <xref target='N1'>Clause <strong>1</strong>, Equation (1)</xref>
721
- <xref target='N2'><strong>1.1</strong>, Inequality (2)</xref>
722
- </p>
723
- </foreword>
724
- </preface>
725
- <sections>
726
- <clause id='intro'>
727
- <title depth='1'>
728
- 1
729
- <tab/>
730
- First
731
- </title>
732
- <formula id='N1'>
733
- <name>1</name>
734
- <stem type='AsciiMath'>r = 1 %</stem>
735
- </formula>
736
- <clause id='xyz'>
737
- <title depth='2'>
738
- 1.1
726
+ output = <<~OUTPUT
727
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
728
+ <preface>
729
+ <foreword displayorder='1'>
730
+ <p>
731
+ <xref target='N1'>Clause <strong>1</strong>, Equation (1)</xref>
732
+ <xref target='N2'><strong>1.1</strong>, Inequality (2)</xref>
733
+ </p>
734
+ </foreword>
735
+ </preface>
736
+ <sections>
737
+ <clause id='intro' displayorder="2">
738
+ <title depth='1'>
739
+ 1
739
740
  <tab/>
740
- Preparatory
741
+ First
741
742
  </title>
742
- <formula id='N2' inequality='true'>
743
- <name>2</name>
743
+ <formula id='N1'>
744
+ <name>1</name>
744
745
  <stem type='AsciiMath'>r = 1 %</stem>
745
746
  </formula>
746
- <xref target='N2'>Inequality (2)</xref>
747
+ <clause id='xyz'>
748
+ <title depth='2'>
749
+ 1.1
750
+ <tab/>
751
+ Preparatory
752
+ </title>
753
+ <formula id='N2' inequality='true'>
754
+ <name>2</name>
755
+ <stem type='AsciiMath'>r = 1 %</stem>
756
+ </formula>
757
+ <xref target='N2'>Inequality (2)</xref>
758
+ </clause>
747
759
  </clause>
748
- </clause>
749
- </sections>
750
- </iso-standard>
760
+ </sections>
761
+ </iso-standard>
751
762
  OUTPUT
752
- end
763
+ expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
764
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
765
+ end
753
766
 
754
767
  it "cross-references tables" do
755
- expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
756
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
757
- <iso-standard xmlns="http://riboseinc.com/isoxml">
758
- <preface>
759
- <foreword>
760
- <p>
761
- <xref target="N"/>
762
- <xref target="note1"/>
763
- <xref target="note2"/>
764
- <xref target="AN"/>
765
- <xref target="Anote1"/>
766
- <xref target="Anote2"/>
767
- </p>
768
- </foreword>
769
- </preface>
770
- <sections>
771
- <clause id="scope" type="scope">
772
- <title>Scope</title>
773
- <table id="N">
768
+ input = <<~INPUT
769
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
770
+ <preface>
771
+ <foreword>
772
+ <p>
773
+ <xref target="N"/>
774
+ <xref target="note1"/>
775
+ <xref target="note2"/>
776
+ <xref target="AN"/>
777
+ <xref target="Anote1"/>
778
+ <xref target="Anote2"/>
779
+ </p>
780
+ </foreword>
781
+ </preface>
782
+ <sections>
783
+ <clause id="scope" type="scope">
784
+ <title>Scope</title>
785
+ <table id="N">
786
+ <name>Repeatability and reproducibility of husked rice yield</name>
787
+ <tbody>
788
+ <tr>
789
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
790
+ <td align="center">13</td>
791
+ <td align="center">11</td>
792
+ </tr>
793
+ </tbody>
794
+ </table>
795
+ <p>
796
+ <xref target="N"/>
797
+ </p>
798
+ </clause>
799
+ <terms id="terms"/>
800
+ <clause id="widgets">
801
+ <title>Widgets</title>
802
+ <clause id="widgets1">
803
+ <table id="note1">
774
804
  <name>Repeatability and reproducibility of husked rice yield</name>
775
805
  <tbody>
776
806
  <tr>
@@ -780,44 +810,7 @@ RSpec.describe IsoDoc::BSI do
780
810
  </tr>
781
811
  </tbody>
782
812
  </table>
783
- <p>
784
- <xref target="N"/>
785
- </p>
786
- </clause>
787
- <terms id="terms"/>
788
- <clause id="widgets">
789
- <title>Widgets</title>
790
- <clause id="widgets1">
791
- <table id="note1">
792
- <name>Repeatability and reproducibility of husked rice yield</name>
793
- <tbody>
794
- <tr>
795
- <td align="left">Number of laboratories retained after eliminating outliers</td>
796
- <td align="center">13</td>
797
- <td align="center">11</td>
798
- </tr>
799
- </tbody>
800
- </table>
801
- <table id="note2">
802
- <name>Repeatability and reproducibility of husked rice yield</name>
803
- <tbody>
804
- <tr>
805
- <td align="left">Number of laboratories retained after eliminating outliers</td>
806
- <td align="center">13</td>
807
- <td align="center">11</td>
808
- </tr>
809
- </tbody>
810
- </table>
811
- <p>
812
- <xref target="note1"/>
813
- <xref target="note2"/>
814
- </p>
815
- </clause>
816
- </clause>
817
- </sections>
818
- <annex id="annex1">
819
- <clause id="annex1a">
820
- <table id="AN">
813
+ <table id="note2">
821
814
  <name>Repeatability and reproducibility of husked rice yield</name>
822
815
  <tbody>
823
816
  <tr>
@@ -827,10 +820,96 @@ RSpec.describe IsoDoc::BSI do
827
820
  </tr>
828
821
  </tbody>
829
822
  </table>
823
+ <p>
824
+ <xref target="note1"/>
825
+ <xref target="note2"/>
826
+ </p>
830
827
  </clause>
831
- <clause id="annex1b">
832
- <table id="Anote1">
833
- <name>Repeatability and reproducibility of husked rice yield</name>
828
+ </clause>
829
+ </sections>
830
+ <annex id="annex1">
831
+ <clause id="annex1a">
832
+ <table id="AN">
833
+ <name>Repeatability and reproducibility of husked rice yield</name>
834
+ <tbody>
835
+ <tr>
836
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
837
+ <td align="center">13</td>
838
+ <td align="center">11</td>
839
+ </tr>
840
+ </tbody>
841
+ </table>
842
+ </clause>
843
+ <clause id="annex1b">
844
+ <table id="Anote1">
845
+ <name>Repeatability and reproducibility of husked rice yield</name>
846
+ <tbody>
847
+ <tr>
848
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
849
+ <td align="center">13</td>
850
+ <td align="center">11</td>
851
+ </tr>
852
+ </tbody>
853
+ </table>
854
+ <table id="Anote2">
855
+ <name>Repeatability and reproducibility of husked rice yield</name>
856
+ <tbody>
857
+ <tr>
858
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
859
+ <td align="center">13</td>
860
+ <td align="center">11</td>
861
+ </tr>
862
+ </tbody>
863
+ </table>
864
+ </clause>
865
+ </annex>
866
+ </iso-standard>
867
+ INPUT
868
+ output = <<~OUTPUT
869
+ <?xml version='1.0'?>
870
+ <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
871
+ <preface>
872
+ <foreword displayorder='1'>
873
+ <p>
874
+ <xref target="N">Table 1</xref>
875
+ <xref target="note1">Table 2</xref>
876
+ <xref target="note2">Table 3</xref>
877
+ <xref target="AN">Table A.1</xref>
878
+ <xref target="Anote1">Table A.2</xref>
879
+ <xref target="Anote2">Table A.3</xref>
880
+ </p>
881
+ </foreword>
882
+ </preface>
883
+ <sections>
884
+ <clause id="scope" type="scope" displayorder='2'>
885
+ <title depth="1">1
886
+ <tab/>
887
+ Scope</title>
888
+ <table id="N">
889
+ <name>Table 1 — Repeatability and reproducibility of husked rice yield</name>
890
+ <tbody>
891
+ <tr>
892
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
893
+ <td align="center">13</td>
894
+ <td align="center">11</td>
895
+ </tr>
896
+ </tbody>
897
+ </table>
898
+ <p>
899
+ <xref target="N">Table 1</xref>
900
+ </p>
901
+ </clause>
902
+ <terms id="terms" displayorder='3'>
903
+ <title>2</title>
904
+ </terms>
905
+ <clause id="widgets" displayorder='4'>
906
+ <title depth="1">3
907
+ <tab/>
908
+ Widgets</title>
909
+ <clause id="widgets1" inline-header="true">
910
+ <title>3.1</title>
911
+ <table id="note1">
912
+ <name>Table 2 — Repeatability and reproducibility of husked rice yield</name>
834
913
  <tbody>
835
914
  <tr>
836
915
  <td align="left">Number of laboratories retained after eliminating outliers</td>
@@ -839,8 +918,8 @@ RSpec.describe IsoDoc::BSI do
839
918
  </tr>
840
919
  </tbody>
841
920
  </table>
842
- <table id="Anote2">
843
- <name>Repeatability and reproducibility of husked rice yield</name>
921
+ <table id="note2">
922
+ <name>Table 3 — Repeatability and reproducibility of husked rice yield</name>
844
923
  <tbody>
845
924
  <tr>
846
925
  <td align="left">Number of laboratories retained after eliminating outliers</td>
@@ -849,447 +928,349 @@ RSpec.describe IsoDoc::BSI do
849
928
  </tr>
850
929
  </tbody>
851
930
  </table>
852
- </clause>
853
- </annex>
854
- </iso-standard>
855
- INPUT
856
- <?xml version='1.0'?>
857
- <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
858
- <preface>
859
- <foreword>
860
931
  <p>
861
- <xref target="N">Table 1</xref>
862
932
  <xref target="note1">Table 2</xref>
863
933
  <xref target="note2">Table 3</xref>
864
- <xref target="AN">Table A.1</xref>
865
- <xref target="Anote1">Table A.2</xref>
866
- <xref target="Anote2">Table A.3</xref>
867
- </p>
868
- </foreword>
869
- </preface>
870
- <sections>
871
- <clause id="scope" type="scope">
872
- <title depth="1">1
873
- <tab/>
874
- Scope</title>
875
- <table id="N">
876
- <name>Table 1 — Repeatability and reproducibility of husked rice yield</name>
877
- <tbody>
878
- <tr>
879
- <td align="left">Number of laboratories retained after eliminating outliers</td>
880
- <td align="center">13</td>
881
- <td align="center">11</td>
882
- </tr>
883
- </tbody>
884
- </table>
885
- <p>
886
- <xref target="N">Table 1</xref>
887
934
  </p>
888
935
  </clause>
889
- <terms id="terms">
890
- <title>2</title>
891
- </terms>
892
- <clause id="widgets">
893
- <title depth="1">3
894
- <tab/>
895
- Widgets</title>
896
- <clause id="widgets1" inline-header="true">
897
- <title>3.1</title>
898
- <table id="note1">
899
- <name>Table 2 — Repeatability and reproducibility of husked rice yield</name>
900
- <tbody>
901
- <tr>
902
- <td align="left">Number of laboratories retained after eliminating outliers</td>
903
- <td align="center">13</td>
904
- <td align="center">11</td>
905
- </tr>
906
- </tbody>
907
- </table>
908
- <table id="note2">
909
- <name>Table 3 — Repeatability and reproducibility of husked rice yield</name>
910
- <tbody>
911
- <tr>
912
- <td align="left">Number of laboratories retained after eliminating outliers</td>
913
- <td align="center">13</td>
914
- <td align="center">11</td>
915
- </tr>
916
- </tbody>
917
- </table>
918
- <p>
919
- <xref target="note1">Table 2</xref>
920
- <xref target="note2">Table 3</xref>
921
- </p>
922
- </clause>
923
- </clause>
924
- </sections>
925
- <annex id="annex1">
926
- <title>
927
- <strong>Annex A</strong>
928
- <br/>(informative)</title>
929
- <clause id="annex1a" inline-header="true">
930
- <title>A.1</title>
931
- <table id="AN">
932
- <name>Table A.1 — Repeatability and reproducibility of husked rice yield</name>
933
- <tbody>
934
- <tr>
935
- <td align="left">Number of laboratories retained after eliminating outliers</td>
936
- <td align="center">13</td>
937
- <td align="center">11</td>
938
- </tr>
939
- </tbody>
940
- </table>
941
- </clause>
942
- <clause id="annex1b" inline-header="true">
943
- <title>A.2</title>
944
- <table id="Anote1">
945
- <name>Table A.2 — Repeatability and reproducibility of husked rice yield</name>
946
- <tbody>
947
- <tr>
948
- <td align="left">Number of laboratories retained after eliminating outliers</td>
949
- <td align="center">13</td>
950
- <td align="center">11</td>
951
- </tr>
952
- </tbody>
953
- </table>
954
- <table id="Anote2">
955
- <name>Table A.3 — Repeatability and reproducibility of husked rice yield</name>
956
- <tbody>
957
- <tr>
958
- <td align="left">Number of laboratories retained after eliminating outliers</td>
959
- <td align="center">13</td>
960
- <td align="center">11</td>
961
- </tr>
962
- </tbody>
963
- </table>
964
- </clause>
965
- </annex>
966
- </iso-standard>
936
+ </clause>
937
+ </sections>
938
+ <annex id="annex1" displayorder='5'>
939
+ <title>
940
+ <strong>Annex A</strong>
941
+ <tab/>(informative)</title>
942
+ <clause id="annex1a" inline-header="true">
943
+ <title>A.1</title>
944
+ <table id="AN">
945
+ <name>Table A.1 — Repeatability and reproducibility of husked rice yield</name>
946
+ <tbody>
947
+ <tr>
948
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
949
+ <td align="center">13</td>
950
+ <td align="center">11</td>
951
+ </tr>
952
+ </tbody>
953
+ </table>
954
+ </clause>
955
+ <clause id="annex1b" inline-header="true">
956
+ <title>A.2</title>
957
+ <table id="Anote1">
958
+ <name>Table A.2 — Repeatability and reproducibility of husked rice yield</name>
959
+ <tbody>
960
+ <tr>
961
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
962
+ <td align="center">13</td>
963
+ <td align="center">11</td>
964
+ </tr>
965
+ </tbody>
966
+ </table>
967
+ <table id="Anote2">
968
+ <name>Table A.3 — Repeatability and reproducibility of husked rice yield</name>
969
+ <tbody>
970
+ <tr>
971
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
972
+ <td align="center">13</td>
973
+ <td align="center">11</td>
974
+ </tr>
975
+ </tbody>
976
+ </table>
977
+ </clause>
978
+ </annex>
979
+ </iso-standard>
967
980
  OUTPUT
981
+ expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
982
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
968
983
  end
969
984
 
970
985
  it "cross-references term notes" do
971
- expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
972
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
973
- <iso-standard xmlns="http://riboseinc.com/isoxml">
974
- <preface>
975
- <foreword>
976
- <p>
977
- <xref target="note1"/>
978
- <xref target="note2"/>
979
- <xref target="note3"/>
980
- </p>
981
- </foreword>
982
- </preface>
983
- <sections>
984
- <clause id="scope" type="scope">
985
- <title>Scope</title>
986
- </clause>
987
- <terms id="terms">
988
- <term id="_waxy_rice">
989
- <preferred>waxy rice</preferred>
990
- <termnote id="note1">
991
- <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>
992
- </termnote>
993
- </term>
994
- <term id="_nonwaxy_rice">
995
- <preferred>nonwaxy rice</preferred>
996
- <termnote id="note2">
997
- <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>
998
- </termnote>
999
- <termnote id="note3">
1000
- <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>
1001
- </termnote>
1002
- </term>
1003
- </terms>
986
+ input = <<~INPUT
987
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
988
+ <preface>
989
+ <foreword>
990
+ <p>
991
+ <xref target="note1"/>
992
+ <xref target="note2"/>
993
+ <xref target="note3"/>
994
+ </p>
995
+ </foreword>
996
+ </preface>
997
+ <sections>
998
+ <clause id="scope" type="scope">
999
+ <title>Scope</title>
1000
+ </clause>
1001
+ <terms id="terms">
1002
+ <term id="_waxy_rice">
1003
+ <preferred>waxy rice</preferred>
1004
+ <termnote id="note1">
1005
+ <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>
1006
+ </termnote>
1007
+ </term>
1008
+ <term id="_nonwaxy_rice">
1009
+ <preferred>nonwaxy rice</preferred>
1010
+ <termnote id="note2">
1011
+ <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>
1012
+ </termnote>
1013
+ <termnote id="note3">
1014
+ <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>
1015
+ </termnote>
1016
+ </term>
1017
+ </terms>
1004
1018
 
1005
- </iso-standard>
1006
- INPUT
1007
- <?xml version='1.0'?>
1008
- <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
1009
- <preface>
1010
- <foreword>
1011
- <p>
1012
- <xref target="note1"><strong>2.1</strong>, Note</xref>
1013
- <xref target="note2"><strong>2.2</strong>, Note 1</xref>
1014
- <xref target="note3"><strong>2.2</strong>, Note 2</xref>
1015
- </p>
1016
- </foreword>
1017
- </preface>
1018
- <sections>
1019
- <clause id="scope" type="scope">
1020
- <title depth="1">1
1021
- <tab/>
1022
- Scope</title>
1023
- </clause>
1024
- <terms id="terms">
1025
- <title>2</title>
1026
- <term id="_waxy_rice">
1027
- <name>2.1</name>
1028
- <preferred>waxy rice</preferred>
1029
- <termnote id="note1">
1030
- <name>NOTE</name>
1031
- <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The
1032
- kernels have a tendency to stick together after cooking.
1033
- </p>
1034
- </termnote>
1035
- </term>
1036
- <term id="_nonwaxy_rice">
1037
- <name>2.2</name>
1038
- <preferred>nonwaxy rice</preferred>
1039
- <termnote id="note2">
1040
- <name>NOTE 1</name>
1041
- <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The
1042
- kernels have a tendency to stick together after cooking.
1043
- </p>
1044
- </termnote>
1045
- <termnote id="note3">
1046
- <name>NOTE 2</name>
1047
- <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The
1048
- kernels have a tendency to stick together after cooking.
1049
- </p>
1050
- </termnote>
1051
- </term>
1052
- </terms>
1053
- </sections>
1054
- </iso-standard>
1055
- OUTPUT
1019
+ </iso-standard>
1020
+ INPUT
1021
+ output = <<~OUTPUT
1022
+ <?xml version='1.0'?>
1023
+ <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
1024
+ <preface>
1025
+ <foreword displayorder='1'>
1026
+ <p>
1027
+ <xref target="note1"><strong>2.1</strong>, Note</xref>
1028
+ <xref target="note2"><strong>2.2</strong>, Note 1</xref>
1029
+ <xref target="note3"><strong>2.2</strong>, Note 2</xref>
1030
+ </p>
1031
+ </foreword>
1032
+ </preface>
1033
+ <sections>
1034
+ <clause id="scope" type="scope" displayorder='2'>
1035
+ <title depth="1">1
1036
+ <tab/>
1037
+ Scope</title>
1038
+ </clause>
1039
+ <terms id="terms" displayorder='3'>
1040
+ <title>2</title>
1041
+ <term id="_waxy_rice">
1042
+ <name>2.1</name>
1043
+ <preferred>waxy rice</preferred>
1044
+ <termnote id="note1">
1045
+ <name>NOTE</name>
1046
+ <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The
1047
+ kernels have a tendency to stick together after cooking.
1048
+ </p>
1049
+ </termnote>
1050
+ </term>
1051
+ <term id="_nonwaxy_rice">
1052
+ <name>2.2</name>
1053
+ <preferred>nonwaxy rice</preferred>
1054
+ <termnote id="note2">
1055
+ <name>NOTE 1</name>
1056
+ <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The
1057
+ kernels have a tendency to stick together after cooking.
1058
+ </p>
1059
+ </termnote>
1060
+ <termnote id="note3">
1061
+ <name>NOTE 2</name>
1062
+ <p id="_b0cb3dfd-78fc-47dd-a339-84070d947463">The starch of waxy rice consists almost entirely of amylopectin. The
1063
+ kernels have a tendency to stick together after cooking.
1064
+ </p>
1065
+ </termnote>
1066
+ </term>
1067
+ </terms>
1068
+ </sections>
1069
+ </iso-standard>
1070
+ OUTPUT
1071
+ expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
1072
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1056
1073
  end
1057
1074
 
1058
1075
  it "cross-references sections" do
1059
- expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
1060
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1061
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1062
- <preface>
1063
- <foreword obligation="informative">
1064
- <title>Foreword</title>
1065
- <p id="A">This is a preamble
1066
- <xref target="C"/>
1067
- <xref target="C1"/>
1068
- <xref target="D"/>
1069
- <xref target="H"/>
1070
- <xref target="I"/>
1071
- <xref target="J"/>
1072
- <xref target="K"/>
1073
- <xref target="L"/>
1074
- <xref target="M"/>
1075
- <xref target="N"/>
1076
- <xref target="O"/>
1077
- <xref target="P"/>
1078
- <xref target="Q"/>
1079
- <xref target="Q1"/>
1080
- <xref target="Q2"/>
1081
- <xref target="Q3"/>
1082
- <xref target="R"/></p>
1083
- </foreword>
1084
- <introduction id="B" obligation="informative">
1085
- <title>Introduction</title>
1086
- <clause id="C" inline-header="false" obligation="informative">
1087
- <title>Introduction Subsection</title>
1088
- </clause>
1089
- <clause id="C1" inline-header="false" obligation="informative">Text</clause>
1090
- </introduction>
1091
- </preface>
1092
- <sections>
1093
- <clause id="D" obligation="normative" type="scope">
1094
- <title>Scope</title>
1095
- <p id="E">Text</p>
1076
+ input = <<~INPUT
1077
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1078
+ <preface>
1079
+ <foreword obligation="informative">
1080
+ <title>Foreword</title>
1081
+ <p id="A">This is a preamble
1082
+ <xref target="C"/>
1083
+ <xref target="C1"/>
1084
+ <xref target="D"/>
1085
+ <xref target="H"/>
1086
+ <xref target="I"/>
1087
+ <xref target="J"/>
1088
+ <xref target="K"/>
1089
+ <xref target="L"/>
1090
+ <xref target="M"/>
1091
+ <xref target="N"/>
1092
+ <xref target="O"/>
1093
+ <xref target="P"/>
1094
+ <xref target="Q"/>
1095
+ <xref target="Q1"/>
1096
+ <xref target="Q2"/>
1097
+ <xref target="Q3"/>
1098
+ <xref target="R"/></p>
1099
+ </foreword>
1100
+ <introduction id="B" obligation="informative">
1101
+ <title>Introduction</title>
1102
+ <clause id="C" inline-header="false" obligation="informative">
1103
+ <title>Introduction Subsection</title>
1096
1104
  </clause>
1097
- <terms id="H" obligation="normative">
1098
- <title>Terms, definitions, symbols and abbreviated terms</title>
1099
- <terms id="I" obligation="normative">
1100
- <title>Normal Terms</title>
1101
- <term id="J">
1102
- <preferred>Term2</preferred>
1103
- </term>
1104
- </terms>
1105
- <definitions id="K">
1106
- <dl>
1107
- <dt>Symbol</dt>
1108
- <dd>Definition</dd>
1109
- </dl>
1110
- </definitions>
1105
+ <clause id="C1" inline-header="false" obligation="informative">Text</clause>
1106
+ </introduction>
1107
+ </preface>
1108
+ <sections>
1109
+ <clause id="D" obligation="normative" type="scope">
1110
+ <title>Scope</title>
1111
+ <p id="E">Text</p>
1112
+ </clause>
1113
+ <terms id="H" obligation="normative">
1114
+ <title>Terms, definitions, symbols and abbreviated terms</title>
1115
+ <terms id="I" obligation="normative">
1116
+ <title>Normal Terms</title>
1117
+ <term id="J">
1118
+ <preferred>Term2</preferred>
1119
+ </term>
1111
1120
  </terms>
1112
- <definitions id="L">
1121
+ <definitions id="K">
1113
1122
  <dl>
1114
1123
  <dt>Symbol</dt>
1115
1124
  <dd>Definition</dd>
1116
1125
  </dl>
1117
1126
  </definitions>
1118
- <clause id="M" inline-header="false" obligation="normative">
1119
- <title>Clause 4</title>
1120
- <clause id="N" inline-header="false" obligation="normative">
1121
- <title>Introduction</title>
1122
- </clause>
1123
- <clause id="O" inline-header="false" obligation="normative">
1124
- <title>Clause 4.2</title>
1125
- </clause>
1126
- </clause>
1127
- </sections>
1128
- <annex id="P" inline-header="false" obligation="normative">
1129
- <title>Annex</title>
1130
- <clause id="Q" inline-header="false" obligation="normative">
1131
- <title>Annex A.1</title>
1132
- <clause id="Q1" inline-header="false" obligation="normative">
1133
- <title>Annex A.1a</title>
1134
- </clause>
1135
- </clause>
1136
- <appendix id="Q2" inline-header="false" obligation="normative">
1137
- <title>An Appendix</title>
1138
- <clause id="Q3" inline-header="false" obligation="normative">
1139
- <title>Appendix subclause</title>
1140
- </clause>
1141
- </appendix>
1142
- </annex>
1143
- <bibliography>
1144
- <references id="R" normative="true" obligation="informative">
1145
- <title>Normative References</title>
1146
- </references>
1147
- <clause id="S" obligation="informative">
1148
- <title>Bibliography</title>
1149
- <references id="T" normative="false" obligation="informative">
1150
- <title>Bibliography Subsection</title>
1151
- </references>
1127
+ </terms>
1128
+ <definitions id="L">
1129
+ <dl>
1130
+ <dt>Symbol</dt>
1131
+ <dd>Definition</dd>
1132
+ </dl>
1133
+ </definitions>
1134
+ <clause id="M" inline-header="false" obligation="normative">
1135
+ <title>Clause 4</title>
1136
+ <clause id="N" inline-header="false" obligation="normative">
1137
+ <title>Introduction</title>
1152
1138
  </clause>
1153
- </bibliography>
1154
- </iso-standard>
1155
- INPUT
1156
- <?xml version='1.0'?>
1157
- <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
1158
- <preface>
1159
- <foreword obligation="informative">
1160
- <title>Foreword</title>
1161
- <p id="A">This is a preamble
1162
- <xref target="C"><strong>0.1</strong></xref>
1163
- <xref target="C1"><strong>0.2</strong></xref>
1164
- <xref target="D">Clause <strong>1</strong></xref>
1165
- <xref target="H">Clause <strong>3</strong></xref>
1166
- <xref target="I"><strong>3.1</strong></xref>
1167
- <xref target="J"><strong>3.1.1</strong></xref>
1168
- <xref target="K"><strong>3.2</strong></xref>
1169
- <xref target="L">Clause <strong>4</strong></xref>
1170
- <xref target="M">Clause <strong>5</strong></xref>
1171
- <xref target="N"><strong>5.1</strong></xref>
1172
- <xref target="O"><strong>5.2</strong></xref>
1173
- <xref target="P">Annex A</xref>
1174
- <xref target="Q"><strong>A.1</strong></xref>
1175
- <xref target="Q1"><strong>A.1.1</strong></xref>
1176
- <xref target="Q2">Annex A, Appendix 1</xref>
1177
- <xref target="Q3">Annex A, Appendix 1.1</xref>
1178
- <xref target="R">Clause <strong>2</strong></xref></p>
1179
- </foreword>
1180
- <introduction id="B" obligation="informative">
1181
- <title depth="1">
1182
- 0
1183
- <tab/>
1184
- Introduction</title>
1185
- <clause id="C" inline-header="false" obligation="informative">
1186
- <title depth="2">
1187
- 0.1
1188
- <tab/>
1189
- Introduction Subsection</title>
1190
- </clause>
1191
- <clause id="C1" inline-header="true" obligation="informative">
1192
- <title>0.2</title>Text</clause>
1193
- </introduction>
1194
- </preface>
1195
- <sections>
1196
- <clause id="D" obligation="normative" type="scope">
1197
- <title depth="1">1
1198
- <tab/>
1199
- Scope</title>
1200
- <p id="E">Text</p>
1139
+ <clause id="O" inline-header="false" obligation="normative">
1140
+ <title>Clause 4.2</title>
1201
1141
  </clause>
1202
- <terms id="H" obligation="normative">
1203
- <title depth="1">3
1204
- <tab/>
1205
- Terms, definitions, symbols and abbreviated terms</title>
1206
- <terms id="I" obligation="normative">
1207
- <title depth="2">3.1
1208
- <tab/>
1209
- Normal Terms</title>
1210
- <term id="J">
1211
- <name>3.1.1</name>
1212
- <preferred>Term2</preferred>
1213
- </term>
1214
- </terms>
1215
- <definitions id="K" inline-header="true">
1216
- <title>3.2</title>
1217
- <dl>
1218
- <dt>Symbol</dt>
1219
- <dd>Definition</dd>
1220
- </dl>
1221
- </definitions>
1222
- </terms>
1223
- <definitions id="L">
1224
- <title>4</title>
1225
- <dl>
1226
- <dt>Symbol</dt>
1227
- <dd>Definition</dd>
1228
- </dl>
1229
- </definitions>
1230
- <clause id="M" inline-header="false" obligation="normative">
1231
- <title depth="1">5
1232
- <tab/>
1233
- Clause 4</title>
1234
- <clause id="N" inline-header="false" obligation="normative">
1235
- <title depth="2">5.1
1236
- <tab/>
1237
- Introduction</title>
1238
- </clause>
1239
- <clause id="O" inline-header="false" obligation="normative">
1240
- <title depth="2">5.2
1241
- <tab/>
1242
- Clause 4.2</title>
1243
- </clause>
1142
+ </clause>
1143
+ </sections>
1144
+ <annex id="P" inline-header="false" obligation="normative">
1145
+ <title>Annex</title>
1146
+ <clause id="Q" inline-header="false" obligation="normative">
1147
+ <title>Annex A.1</title>
1148
+ <clause id="Q1" inline-header="false" obligation="normative">
1149
+ <title>Annex A.1a</title>
1244
1150
  </clause>
1245
- </sections>
1246
- <annex id="P" inline-header="false" obligation="normative">
1247
- <title>
1248
- <strong>Annex A</strong>
1249
- <br/>(normative)
1250
- <br/>
1251
- <br/>
1252
- <strong>Annex</strong></title>
1253
- <clause id="Q" inline-header="false" obligation="normative">
1254
- <title depth="2">A.1
1255
- <tab/>
1256
- Annex A.1</title>
1257
- <clause id="Q1" inline-header="false" obligation="normative">
1258
- <title depth="3">A.1.1
1259
- <tab/>
1260
- Annex A.1a</title>
1261
- </clause>
1151
+ </clause>
1152
+ <appendix id="Q2" inline-header="false" obligation="normative">
1153
+ <title>An Appendix</title>
1154
+ <clause id="Q3" inline-header="false" obligation="normative">
1155
+ <title>Appendix subclause</title>
1262
1156
  </clause>
1263
- <appendix id="Q2" inline-header="false" obligation="normative">
1264
- <title depth="2">Appendix 1
1265
- <tab/>
1266
- An Appendix</title>
1267
- <clause id="Q3" inline-header="false" obligation="normative">
1268
- <title depth="3">Appendix 1.1
1269
- <tab/>
1270
- Appendix subclause</title>
1271
- </clause>
1272
- </appendix>
1273
- </annex>
1274
- <bibliography>
1275
- <references id="R" normative="true" obligation="informative">
1276
- <title depth="1">2
1277
- <tab/>
1278
- Normative References</title>
1157
+ </appendix>
1158
+ </annex>
1159
+ <bibliography>
1160
+ <references id="R" normative="true" obligation="informative">
1161
+ <title>Normative References</title>
1162
+ </references>
1163
+ <clause id="S" obligation="informative">
1164
+ <title>Bibliography</title>
1165
+ <references id="T" normative="false" obligation="informative">
1166
+ <title>Bibliography Subsection</title>
1279
1167
  </references>
1280
- <clause id="S" obligation="informative">
1281
- <title depth="1">Bibliography</title>
1282
- <references id="T" normative="false" obligation="informative">
1283
- <title depth="2">Bibliography Subsection</title>
1284
- </references>
1285
- </clause>
1286
- </bibliography>
1287
- </iso-standard>
1288
- OUTPUT
1168
+ </clause>
1169
+ </bibliography>
1170
+ </iso-standard>
1171
+ INPUT
1172
+ output = <<~OUTPUT
1173
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
1174
+ <preface>
1175
+ <foreword obligation="informative" displayorder="1">
1176
+ <title>Foreword</title>
1177
+ <p id="A">This is a preamble
1178
+ <xref target="C"><strong>0.1</strong></xref>
1179
+ <xref target="C1"><strong>0.2</strong></xref>
1180
+ <xref target="D">Clause <strong>1</strong></xref>
1181
+ <xref target="H">Clause <strong>3</strong></xref>
1182
+ <xref target="I"><strong>3.1</strong></xref>
1183
+ <xref target="J"><strong>3.1.1</strong></xref>
1184
+ <xref target="K"><strong>3.2</strong></xref>
1185
+ <xref target="L">Clause <strong>4</strong></xref>
1186
+ <xref target="M">Clause <strong>5</strong></xref>
1187
+ <xref target="N"><strong>5.1</strong></xref>
1188
+ <xref target="O"><strong>5.2</strong></xref>
1189
+ <xref target="P">Annex A</xref>
1190
+ <xref target="Q"><strong>A.1</strong></xref>
1191
+ <xref target="Q1"><strong>A.1.1</strong></xref>
1192
+ <xref target="Q2">Annex A, Appendix 1</xref>
1193
+ <xref target="Q3">Annex A, Appendix 1.1</xref>
1194
+ <xref target="R">Clause <strong>2</strong></xref></p>
1195
+ </foreword>
1196
+ <introduction id="B" obligation="informative" displayorder="2">
1197
+ <title depth="1">0<tab/>Introduction</title>
1198
+ <clause id="C" inline-header="false" obligation="informative">
1199
+ <title depth="2">0.1<tab/>Introduction Subsection</title>
1200
+ </clause>
1201
+ <clause id="C1" inline-header="true" obligation="informative"><title>0.2</title>Text</clause>
1202
+ </introduction>
1203
+ </preface>
1204
+ <sections>
1205
+ <clause id="D" obligation="normative" type="scope" displayorder="3">
1206
+ <title depth="1">1<tab/>Scope</title>
1207
+ <p id="E">Text</p>
1208
+ </clause>
1209
+ <terms id="H" obligation="normative" displayorder="5">
1210
+ <title depth="1">3<tab/>Terms, definitions, symbols and abbreviated terms</title>
1211
+ <terms id="I" obligation="normative">
1212
+ <title depth="2">3.1<tab/>Normal Terms</title>
1213
+ <term id="J"><name>3.1.1</name>
1214
+ <preferred>Term2</preferred>
1215
+ </term>
1216
+ </terms>
1217
+ <definitions id="K" inline-header="true"><title>3.2</title>
1218
+ <dl>
1219
+ <dt>Symbol</dt>
1220
+ <dd>Definition</dd>
1221
+ </dl>
1222
+ </definitions>
1223
+ </terms>
1224
+ <definitions id="L" displayorder="6"><title>4</title>
1225
+ <dl>
1226
+ <dt>Symbol</dt>
1227
+ <dd>Definition</dd>
1228
+ </dl>
1229
+ </definitions>
1230
+ <clause id="M" inline-header="false" obligation="normative" displayorder="7">
1231
+ <title depth="1">5<tab/>Clause 4</title>
1232
+ <clause id="N" inline-header="false" obligation="normative">
1233
+ <title depth="2">5.1<tab/>Introduction</title>
1234
+ </clause>
1235
+ <clause id="O" inline-header="false" obligation="normative">
1236
+ <title depth="2">5.2<tab/>Clause 4.2</title>
1237
+ </clause>
1238
+ </clause>
1239
+ </sections>
1240
+ <annex id="P" inline-header="false" obligation="normative" displayorder="8">
1241
+ <title><strong>Annex A</strong><tab/>(normative)<br/><strong>Annex</strong></title>
1242
+ <clause id="Q" inline-header="false" obligation="normative">
1243
+ <title depth="2">A.1<tab/>Annex A.1</title>
1244
+ <clause id="Q1" inline-header="false" obligation="normative">
1245
+ <title depth="3">A.1.1<tab/>Annex A.1a</title>
1246
+ </clause>
1247
+ </clause>
1248
+ <appendix id="Q2" inline-header="false" obligation="normative">
1249
+ <title depth="2">Appendix 1<tab/>An Appendix</title>
1250
+ <clause id="Q3" inline-header="false" obligation="normative">
1251
+ <title depth="3">Appendix 1.1<tab/>Appendix subclause</title>
1252
+ </clause>
1253
+ </appendix>
1254
+ </annex>
1255
+ <bibliography>
1256
+ <references id="R" normative="true" obligation="informative" displayorder="4">
1257
+ <title depth="1">2<tab/>Normative References</title>
1258
+ </references>
1259
+ <clause id="S" obligation="informative" displayorder="9">
1260
+ <title depth="1">Bibliography</title>
1261
+ <references id="T" normative="false" obligation="informative">
1262
+ <title depth="2">Bibliography Subsection</title>
1263
+ </references>
1264
+ </clause>
1265
+ </bibliography>
1266
+ </iso-standard>
1267
+ OUTPUT
1268
+ expect((IsoDoc::BSI::PresentationXMLConvert.new({})
1269
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1289
1270
  end
1290
1271
 
1291
1272
  it "cross-references lists" do
1292
- output = IsoDoc::BSI::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)
1273
+ input = <<~INPUT
1293
1274
  <iso-standard xmlns="http://riboseinc.com/isoxml">
1294
1275
  <preface>
1295
1276
  <foreword>
@@ -1342,11 +1323,11 @@ RSpec.describe IsoDoc::BSI do
1342
1323
  </annex>
1343
1324
  </iso-standard>
1344
1325
  INPUT
1345
- expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
1326
+ output = <<~OUTPUT
1346
1327
  <?xml version='1.0'?>
1347
1328
  <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
1348
1329
  <preface>
1349
- <foreword>
1330
+ <foreword displayorder='1'>
1350
1331
  <p>
1351
1332
  <xref target="N">Clause <strong>1</strong>, List</xref>
1352
1333
  <xref target="note1"><strong>3.1</strong>, List 1</xref>
@@ -1358,7 +1339,7 @@ RSpec.describe IsoDoc::BSI do
1358
1339
  </foreword>
1359
1340
  </preface>
1360
1341
  <sections>
1361
- <clause id="scope" type="scope">
1342
+ <clause id="scope" type="scope" displayorder='2'>
1362
1343
  <title depth="1">1
1363
1344
  <tab/>
1364
1345
  Scope</title>
@@ -1368,10 +1349,10 @@ RSpec.describe IsoDoc::BSI do
1368
1349
  </li>
1369
1350
  </ol>
1370
1351
  </clause>
1371
- <terms id="terms">
1352
+ <terms id="terms" displayorder='3'>
1372
1353
  <title>2</title>
1373
1354
  </terms>
1374
- <clause id="widgets">
1355
+ <clause id="widgets" displayorder='4'>
1375
1356
  <title depth="1">3
1376
1357
  <tab/>
1377
1358
  Widgets</title>
@@ -1390,10 +1371,10 @@ RSpec.describe IsoDoc::BSI do
1390
1371
  </clause>
1391
1372
  </clause>
1392
1373
  </sections>
1393
- <annex id="annex1">
1374
+ <annex id="annex1" displayorder='5'>
1394
1375
  <title>
1395
1376
  <strong>Annex A</strong>
1396
- <br/>(informative)</title>
1377
+ <tab/>(informative)</title>
1397
1378
  <clause id="annex1a" inline-header="true">
1398
1379
  <title>A.1</title>
1399
1380
  <ol id="AN" type="alphabet">
@@ -1418,313 +1399,319 @@ RSpec.describe IsoDoc::BSI do
1418
1399
  </annex>
1419
1400
  </iso-standard>
1420
1401
  OUTPUT
1402
+ expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
1403
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1421
1404
  end
1422
1405
 
1423
1406
  it "cross-references list items" do
1424
- expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
1425
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1426
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1427
- <preface>
1428
- <foreword>
1429
- <p>
1430
- <xref target="N"/>
1431
- <xref target="note1"/>
1432
- <xref target="note2"/>
1433
- <xref target="AN"/>
1434
- <xref target="Anote1"/>
1435
- <xref target="Anote2"/>
1436
- </p>
1437
- </foreword>
1438
- </preface>
1439
- <sections>
1440
- <clause id="scope" type="scope">
1441
- <title>Scope</title>
1442
- <ol id="N1" type="alphabet">
1443
- <li id="N">
1407
+ input = <<~INPUT
1408
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1409
+ <preface>
1410
+ <foreword>
1411
+ <p>
1412
+ <xref target="N"/>
1413
+ <xref target="note1"/>
1414
+ <xref target="note2"/>
1415
+ <xref target="AN"/>
1416
+ <xref target="Anote1"/>
1417
+ <xref target="Anote2"/>
1418
+ </p>
1419
+ </foreword>
1420
+ </preface>
1421
+ <sections>
1422
+ <clause id="scope" type="scope">
1423
+ <title>Scope</title>
1424
+ <ol id="N1" type="alphabet">
1425
+ <li id="N">
1426
+ <p>A</p>
1427
+ </li>
1428
+ </ol>
1429
+ </clause>
1430
+ <terms id="terms"/>
1431
+ <clause id="widgets">
1432
+ <title>Widgets</title>
1433
+ <clause id="widgets1">
1434
+ <ol id="note1l" type="alphabet">
1435
+ <li id="note1">
1444
1436
  <p>A</p>
1445
1437
  </li>
1446
1438
  </ol>
1447
- </clause>
1448
- <terms id="terms"/>
1449
- <clause id="widgets">
1450
- <title>Widgets</title>
1451
- <clause id="widgets1">
1452
- <ol id="note1l" type="alphabet">
1453
- <li id="note1">
1454
- <p>A</p>
1455
- </li>
1456
- </ol>
1457
- <ol id="note2l" type="arabic">
1458
- <li id="note2">
1459
- <p>A</p>
1460
- </li>
1461
- </ol>
1462
- </clause>
1463
- </clause>
1464
- </sections>
1465
- <annex id="annex1">
1466
- <clause id="annex1a">
1467
- <ol id="ANl" type="alphabet">
1468
- <li id="AN">
1439
+ <ol id="note2l" type="arabic">
1440
+ <li id="note2">
1469
1441
  <p>A</p>
1470
1442
  </li>
1471
1443
  </ol>
1472
1444
  </clause>
1473
- <clause id="annex1b">
1474
- <ol id="Anote1l" type="alphabet">
1475
- <li id="Anote1">
1476
- <p>A</p>
1477
- </li>
1478
- </ol>
1479
- <ol id="Anote2l" type="arabic">
1480
- <li id="Anote2">
1445
+ </clause>
1446
+ </sections>
1447
+ <annex id="annex1">
1448
+ <clause id="annex1a">
1449
+ <ol id="ANl" type="alphabet">
1450
+ <li id="AN">
1451
+ <p>A</p>
1452
+ </li>
1453
+ </ol>
1454
+ </clause>
1455
+ <clause id="annex1b">
1456
+ <ol id="Anote1l" type="alphabet">
1457
+ <li id="Anote1">
1458
+ <p>A</p>
1459
+ </li>
1460
+ </ol>
1461
+ <ol id="Anote2l" type="arabic">
1462
+ <li id="Anote2">
1463
+ <p>A</p>
1464
+ </li>
1465
+ </ol>
1466
+ </clause>
1467
+ </annex>
1468
+ </iso-standard>
1469
+ INPUT
1470
+ output = <<~OUTPUT
1471
+ <?xml version='1.0'?>
1472
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1473
+ <preface>
1474
+ <foreword displayorder='1'>
1475
+ <p>
1476
+ <xref target='N'>Clause <strong>1</strong>a)</xref>
1477
+ <xref target='note1'><strong>3.1</strong>a)</xref>
1478
+ <xref target='note2'><strong>3.1</strong>1)</xref>
1479
+ <xref target='AN'><strong>A.1</strong>a)</xref>
1480
+ <xref target='Anote1'><strong>A.2</strong>a)</xref>
1481
+ <xref target='Anote2'><strong>A.2</strong>1)</xref>
1482
+ </p>
1483
+ </foreword>
1484
+ </preface>
1485
+ <sections>
1486
+ <clause id='scope' type='scope' displayorder='2'>
1487
+ <title depth='1'>1<tab/>Scope</title>
1488
+ <ol id='N1' type="alphabet">
1489
+ <li id='N'>
1490
+ <p>A</p>
1491
+ </li>
1492
+ </ol>
1493
+ </clause>
1494
+ <terms id='terms' displayorder='3'><title>2</title></terms>
1495
+ <clause id='widgets' displayorder='4'>
1496
+ <title depth='1'>3<tab/>Widgets</title>
1497
+ <clause inline-header="true" id='widgets1'><title>3.1</title>
1498
+ <ol id='note1l' type="alphabet">
1499
+ <li id='note1'>
1481
1500
  <p>A</p>
1482
1501
  </li>
1483
1502
  </ol>
1484
- </clause>
1485
- </annex>
1486
- </iso-standard>
1487
- INPUT
1488
- <?xml version='1.0'?>
1489
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1490
- <preface>
1491
- <foreword>
1492
- <p>
1493
- <xref target='N'>Clause <strong>1</strong>a)</xref>
1494
- <xref target='note1'><strong>3.1</strong>a)</xref>
1495
- <xref target='note2'><strong>3.1</strong>1)</xref>
1496
- <xref target='AN'><strong>A.1</strong>a)</xref>
1497
- <xref target='Anote1'><strong>A.2</strong>a)</xref>
1498
- <xref target='Anote2'><strong>A.2</strong>1)</xref>
1499
- </p>
1500
- </foreword>
1501
- </preface>
1502
- <sections>
1503
- <clause id='scope' type='scope'>
1504
- <title depth='1'>1<tab/>Scope</title>
1505
- <ol id='N1' type="alphabet">
1506
- <li id='N'>
1503
+ <ol id='note2l' type="arabic">
1504
+ <li id='note2'>
1507
1505
  <p>A</p>
1508
1506
  </li>
1509
1507
  </ol>
1510
1508
  </clause>
1511
- <terms id='terms'><title>2</title></terms>
1512
- <clause id='widgets'>
1513
- <title depth='1'>3<tab/>Widgets</title>
1514
- <clause inline-header="true" id='widgets1'><title>3.1</title>
1515
- <ol id='note1l' type="alphabet">
1516
- <li id='note1'>
1509
+ </clause>
1510
+ </sections>
1511
+ <annex id='annex1' displayorder='5'><title><strong>Annex A</strong><tab/>(informative)</title>
1512
+ <clause inline-header="true" id='annex1a'><title>A.1</title>
1513
+ <ol id='ANl' type="alphabet">
1514
+ <li id='AN'>
1515
+ <p>A</p>
1516
+ </li>
1517
+ </ol>
1518
+ </clause>
1519
+ <clause inline-header="true" id='annex1b'><title>A.2</title>
1520
+ <ol id='Anote1l' type="alphabet">
1521
+ <li id='Anote1'>
1522
+ <p>A</p>
1523
+ </li>
1524
+ </ol>
1525
+ <ol id='Anote2l' type="arabic">
1526
+ <li id='Anote2'>
1527
+ <p>A</p>
1528
+ </li>
1529
+ </ol>
1530
+ </clause>
1531
+ </annex>
1532
+ </iso-standard>
1533
+ OUTPUT
1534
+ expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
1535
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1536
+ end
1537
+
1538
+ it "cross-references nested list items" do
1539
+ input = <<~INPUT
1540
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1541
+ <preface>
1542
+ <foreword>
1543
+ <p>
1544
+ <xref target="N"/>
1545
+ <xref target="note1"/>
1546
+ <xref target="note2"/>
1547
+ <xref target="AN"/>
1548
+ <xref target="Anote1"/>
1549
+ <xref target="Anote2"/>
1550
+ <xref target="Na"/>
1551
+ <xref target="note1a"/>
1552
+ <xref target="note2a"/>
1553
+ <xref target="ANa"/>
1554
+ <xref target="Anote1a"/>
1555
+ <xref target="Anote2a"/>
1556
+ </p>
1557
+ </foreword>
1558
+ </preface>
1559
+ <sections>
1560
+ <clause id="scope" type="scope">
1561
+ <title>Scope</title>
1562
+ <ol id="N1" type="alphabet">
1563
+ <li id="N">
1564
+ <p>A</p>
1565
+ <ol type="arabic">
1566
+ <li id="note1">
1517
1567
  <p>A</p>
1568
+ <ol type="roman">
1569
+ <li id="note2">
1570
+ <p>A</p>
1571
+ <ol type="alphabet">
1572
+ <li id="AN">
1573
+ <p>A</p>
1574
+ <ol type="arabic">
1575
+ <li id="Anote1">
1576
+ <p>A</p>
1577
+ <ol type="roman">
1578
+ <li id="Anote2">
1579
+ <p>A</p>
1580
+ </li>
1581
+ </ol>
1582
+ </li>
1583
+ </ol>
1584
+ </li>
1585
+ </ol>
1586
+ </li>
1587
+ </ol>
1518
1588
  </li>
1519
1589
  </ol>
1520
- <ol id='note2l' type="arabic">
1521
- <li id='note2'>
1590
+ </li>
1591
+ </ol>
1592
+ <ol id="N1a" type="arabic">
1593
+ <li id="Na">
1594
+ <p>A</p>
1595
+ <ol type="roman">
1596
+ <li id="note1a">
1522
1597
  <p>A</p>
1598
+ <ol type="alphabet">
1599
+ <li id="note2a">
1600
+ <p>A</p>
1601
+ <ol type="arabic">
1602
+ <li id="ANa">
1603
+ <p>A</p>
1604
+ <ol type="roman">
1605
+ <li id="Anote1a">
1606
+ <p>A</p>
1607
+ <ol type="alphabet">
1608
+ <li id="Anote2a">
1609
+ <p>A</p>
1610
+ </li>
1611
+ </ol>
1612
+ </li>
1613
+ </ol>
1614
+ </li>
1615
+ </ol>
1616
+ </li>
1617
+ </ol>
1523
1618
  </li>
1524
1619
  </ol>
1525
- </clause>
1526
- </clause>
1527
- </sections>
1528
- <annex id='annex1'><title><strong>Annex A</strong><br/>(informative)</title>
1529
- <clause inline-header="true" id='annex1a'><title>A.1</title>
1530
- <ol id='ANl' type="alphabet">
1531
- <li id='AN'>
1532
- <p>A</p>
1533
- </li>
1534
- </ol>
1535
- </clause>
1536
- <clause inline-header="true" id='annex1b'><title>A.2</title>
1537
- <ol id='Anote1l' type="alphabet">
1538
- <li id='Anote1'>
1539
- <p>A</p>
1540
- </li>
1541
- </ol>
1542
- <ol id='Anote2l' type="arabic">
1543
- <li id='Anote2'>
1544
- <p>A</p>
1545
- </li>
1546
- </ol>
1547
- </clause>
1548
- </annex>
1549
- </iso-standard>
1550
- OUTPUT
1551
- end
1552
-
1553
- it "cross-references nested list items" do
1620
+ </li>
1621
+ </ol>
1622
+ </clause>
1623
+ </sections>
1624
+ </iso-standard>
1625
+ INPUT
1626
+ output = <<~OUTPUT
1627
+ <?xml version='1.0'?>
1628
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1629
+ <preface>
1630
+ <foreword displayorder='1'>
1631
+ <p>
1632
+ <xref target='N'>Clause <strong>1</strong>a)</xref>
1633
+ <xref target='note1'>Clause <strong>1</strong>a.1)</xref>
1634
+ <xref target='note2'>Clause <strong>1</strong>a.1.i)</xref>
1635
+ <xref target='AN'>Clause <strong>1</strong>a.1.i.a)</xref>
1636
+ <xref target='Anote1'>Clause <strong>1</strong>a.1.i.a.1)</xref>
1637
+ <xref target='Anote2'>Clause <strong>1</strong>a.1.i.a.1.i)</xref>
1638
+ <xref target='Na'>Clause <strong>1</strong>1)</xref>
1639
+ <xref target='note1a'>Clause <strong>1</strong>1.i)</xref>
1640
+ <xref target='note2a'>Clause <strong>1</strong>1.i.a)</xref>
1641
+ <xref target='ANa'>Clause <strong>1</strong>1.i.a.1)</xref>
1642
+ <xref target='Anote1a'>Clause <strong>1</strong>1.i.a.1.i)</xref>
1643
+ <xref target='Anote2a'>Clause <strong>1</strong>1.i.a.1.i.a)</xref>
1644
+ </p>
1645
+ </foreword>
1646
+ </preface>
1647
+ <sections>
1648
+ <clause id='scope' type='scope' displayorder='2'>
1649
+ <title depth='1'>1<tab/>Scope</title>
1650
+ <ol id='N1' type="alphabet">
1651
+ <li id='N'>
1652
+ <p>A</p>
1653
+ <ol type="arabic">
1654
+ <li id='note1'>
1655
+ <p>A</p>
1656
+ <ol type="roman">
1657
+ <li id='note2'>
1658
+ <p>A</p>
1659
+ <ol type="alphabet">
1660
+ <li id='AN'>
1661
+ <p>A</p>
1662
+ <ol type="arabic">
1663
+ <li id='Anote1'>
1664
+ <p>A</p>
1665
+ <ol type="roman">
1666
+ <li id='Anote2'>
1667
+ <p>A</p>
1668
+ </li>
1669
+ </ol>
1670
+ </li>
1671
+ </ol>
1672
+ </li>
1673
+ </ol>
1674
+ </li>
1675
+ </ol>
1676
+ </li>
1677
+ </ol>
1678
+ </li>
1679
+ </ol>
1680
+ <ol id='N1a' type='arabic'>
1681
+ <li id='Na'>
1682
+ <p>A</p>
1683
+ <ol type='roman'>
1684
+ <li id='note1a'>
1685
+ <p>A</p>
1686
+ <ol type='alphabet'>
1687
+ <li id='note2a'>
1688
+ <p>A</p>
1689
+ <ol type='arabic'>
1690
+ <li id='ANa'>
1691
+ <p>A</p>
1692
+ <ol type='roman'>
1693
+ <li id='Anote1a'>
1694
+ <p>A</p>
1695
+ <ol type='alphabet'>
1696
+ <li id='Anote2a'>
1697
+ <p>A</p>
1698
+ </li>
1699
+ </ol>
1700
+ </li>
1701
+ </ol>
1702
+ </li>
1703
+ </ol>
1704
+ </li>
1705
+ </ol>
1706
+ </li>
1707
+ </ol>
1708
+ </li>
1709
+ </ol>
1710
+ </clause>
1711
+ </sections>
1712
+ </iso-standard>
1713
+ OUTPUT
1554
1714
  expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
1555
- .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1556
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1557
- <preface>
1558
- <foreword>
1559
- <p>
1560
- <xref target="N"/>
1561
- <xref target="note1"/>
1562
- <xref target="note2"/>
1563
- <xref target="AN"/>
1564
- <xref target="Anote1"/>
1565
- <xref target="Anote2"/>
1566
- <xref target="Na"/>
1567
- <xref target="note1a"/>
1568
- <xref target="note2a"/>
1569
- <xref target="ANa"/>
1570
- <xref target="Anote1a"/>
1571
- <xref target="Anote2a"/>
1572
- </p>
1573
- </foreword>
1574
- </preface>
1575
- <sections>
1576
- <clause id="scope" type="scope">
1577
- <title>Scope</title>
1578
- <ol id="N1" type="alphabet">
1579
- <li id="N">
1580
- <p>A</p>
1581
- <ol type="arabic">
1582
- <li id="note1">
1583
- <p>A</p>
1584
- <ol type="roman">
1585
- <li id="note2">
1586
- <p>A</p>
1587
- <ol type="alphabet">
1588
- <li id="AN">
1589
- <p>A</p>
1590
- <ol type="arabic">
1591
- <li id="Anote1">
1592
- <p>A</p>
1593
- <ol type="roman">
1594
- <li id="Anote2">
1595
- <p>A</p>
1596
- </li>
1597
- </ol>
1598
- </li>
1599
- </ol>
1600
- </li>
1601
- </ol>
1602
- </li>
1603
- </ol>
1604
- </li>
1605
- </ol>
1606
- </li>
1607
- </ol>
1608
- <ol id="N1a" type="arabic">
1609
- <li id="Na">
1610
- <p>A</p>
1611
- <ol type="roman">
1612
- <li id="note1a">
1613
- <p>A</p>
1614
- <ol type="alphabet">
1615
- <li id="note2a">
1616
- <p>A</p>
1617
- <ol type="arabic">
1618
- <li id="ANa">
1619
- <p>A</p>
1620
- <ol type="roman">
1621
- <li id="Anote1a">
1622
- <p>A</p>
1623
- <ol type="alphabet">
1624
- <li id="Anote2a">
1625
- <p>A</p>
1626
- </li>
1627
- </ol>
1628
- </li>
1629
- </ol>
1630
- </li>
1631
- </ol>
1632
- </li>
1633
- </ol>
1634
- </li>
1635
- </ol>
1636
- </li>
1637
- </ol>
1638
- </clause>
1639
- </sections>
1640
- </iso-standard>
1641
- INPUT
1642
- <?xml version='1.0'?>
1643
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1644
- <preface>
1645
- <foreword>
1646
- <p>
1647
- <xref target='N'>Clause <strong>1</strong>a)</xref>
1648
- <xref target='note1'>Clause <strong>1</strong>a.1)</xref>
1649
- <xref target='note2'>Clause <strong>1</strong>a.1.i)</xref>
1650
- <xref target='AN'>Clause <strong>1</strong>a.1.i.a)</xref>
1651
- <xref target='Anote1'>Clause <strong>1</strong>a.1.i.a.1)</xref>
1652
- <xref target='Anote2'>Clause <strong>1</strong>a.1.i.a.1.i)</xref>
1653
- <xref target='Na'>Clause <strong>1</strong>1)</xref>
1654
- <xref target='note1a'>Clause <strong>1</strong>1.i)</xref>
1655
- <xref target='note2a'>Clause <strong>1</strong>1.i.a)</xref>
1656
- <xref target='ANa'>Clause <strong>1</strong>1.i.a.1)</xref>
1657
- <xref target='Anote1a'>Clause <strong>1</strong>1.i.a.1.i)</xref>
1658
- <xref target='Anote2a'>Clause <strong>1</strong>1.i.a.1.i.a)</xref>
1659
- </p>
1660
- </foreword>
1661
- </preface>
1662
- <sections>
1663
- <clause id='scope' type='scope'>
1664
- <title depth='1'>1<tab/>Scope</title>
1665
- <ol id='N1' type="alphabet">
1666
- <li id='N'>
1667
- <p>A</p>
1668
- <ol type="arabic">
1669
- <li id='note1'>
1670
- <p>A</p>
1671
- <ol type="roman">
1672
- <li id='note2'>
1673
- <p>A</p>
1674
- <ol type="alphabet">
1675
- <li id='AN'>
1676
- <p>A</p>
1677
- <ol type="arabic">
1678
- <li id='Anote1'>
1679
- <p>A</p>
1680
- <ol type="roman">
1681
- <li id='Anote2'>
1682
- <p>A</p>
1683
- </li>
1684
- </ol>
1685
- </li>
1686
- </ol>
1687
- </li>
1688
- </ol>
1689
- </li>
1690
- </ol>
1691
- </li>
1692
- </ol>
1693
- </li>
1694
- </ol>
1695
- <ol id='N1a' type='arabic'>
1696
- <li id='Na'>
1697
- <p>A</p>
1698
- <ol type='roman'>
1699
- <li id='note1a'>
1700
- <p>A</p>
1701
- <ol type='alphabet'>
1702
- <li id='note2a'>
1703
- <p>A</p>
1704
- <ol type='arabic'>
1705
- <li id='ANa'>
1706
- <p>A</p>
1707
- <ol type='roman'>
1708
- <li id='Anote1a'>
1709
- <p>A</p>
1710
- <ol type='alphabet'>
1711
- <li id='Anote2a'>
1712
- <p>A</p>
1713
- </li>
1714
- </ol>
1715
- </li>
1716
- </ol>
1717
- </li>
1718
- </ol>
1719
- </li>
1720
- </ol>
1721
- </li>
1722
- </ol>
1723
- </li>
1724
- </ol>
1725
- </clause>
1726
- </sections>
1727
- </iso-standard>
1728
- OUTPUT
1715
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1729
1716
  end
1730
1717
  end