metanorma-bsi 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +6 -0
  3. data/.hound.yml +3 -0
  4. data/.rubocop.yml +14 -0
  5. data/CODE_OF_CONDUCT.md +74 -0
  6. data/Gemfile +7 -0
  7. data/LICENSE +25 -0
  8. data/README.adoc +199 -0
  9. data/Rakefile +8 -0
  10. data/bin/rspec +18 -0
  11. data/lib/asciidoctor/bsi/basicdoc.rng +1131 -0
  12. data/lib/asciidoctor/bsi/biblio.rng +1235 -0
  13. data/lib/asciidoctor/bsi/bsi.rng +120 -0
  14. data/lib/asciidoctor/bsi/bsi_intro_en.xml +105 -0
  15. data/lib/asciidoctor/bsi/cleanup.rb +78 -0
  16. data/lib/asciidoctor/bsi/cleanup_ref.rb +183 -0
  17. data/lib/asciidoctor/bsi/converter.rb +83 -0
  18. data/lib/asciidoctor/bsi/front.rb +67 -0
  19. data/lib/asciidoctor/bsi/isodoc.rng +1870 -0
  20. data/lib/asciidoctor/bsi/isostandard.rng +477 -0
  21. data/lib/asciidoctor/bsi/reqt.rng +194 -0
  22. data/lib/asciidoctor/bsi/validate.rb +224 -0
  23. data/lib/asciidoctor/bsi/validate_list.rb +72 -0
  24. data/lib/asciidoctor/bsi/validate_requirement.rb +163 -0
  25. data/lib/isodoc/bsi/base_convert.rb +91 -0
  26. data/lib/isodoc/bsi/bsi.international-standard.xsl +6540 -0
  27. data/lib/isodoc/bsi/html/html_bsi_intro.html +8 -0
  28. data/lib/isodoc/bsi/html/html_bsi_titlepage.html +50 -0
  29. data/lib/isodoc/bsi/html/htmlstyle.css +968 -0
  30. data/lib/isodoc/bsi/html/htmlstyle.scss +699 -0
  31. data/lib/isodoc/bsi/html_convert.rb +56 -0
  32. data/lib/isodoc/bsi/i18n-en.yaml +56 -0
  33. data/lib/isodoc/bsi/i18n.rb +15 -0
  34. data/lib/isodoc/bsi/init.rb +24 -0
  35. data/lib/isodoc/bsi/metadata.rb +33 -0
  36. data/lib/isodoc/bsi/pdf_convert.rb +17 -0
  37. data/lib/isodoc/bsi/presentation_xml_convert.rb +72 -0
  38. data/lib/isodoc/bsi/sts_convert.rb +30 -0
  39. data/lib/isodoc/bsi/xref.rb +134 -0
  40. data/lib/metanorma-bsi.rb +15 -0
  41. data/lib/metanorma/bsi.rb +6 -0
  42. data/lib/metanorma/bsi/processor.rb +51 -0
  43. data/lib/metanorma/bsi/version.rb +6 -0
  44. data/metanorma-bsi.gemspec +47 -0
  45. data/spec/asciidoctor/base_spec.rb +778 -0
  46. data/spec/asciidoctor/blocks_spec.rb +553 -0
  47. data/spec/asciidoctor/cleanup_spec.rb +547 -0
  48. data/spec/asciidoctor/inline_spec.rb +176 -0
  49. data/spec/asciidoctor/lists_spec.rb +194 -0
  50. data/spec/asciidoctor/refs_spec.rb +318 -0
  51. data/spec/asciidoctor/section_spec.rb +382 -0
  52. data/spec/asciidoctor/validate_spec.rb +858 -0
  53. data/spec/assets/header.html +7 -0
  54. data/spec/assets/html.css +2 -0
  55. data/spec/assets/iso.xml +71 -0
  56. data/spec/assets/rice_image1.png +0 -0
  57. data/spec/assets/word.css +2 -0
  58. data/spec/assets/wordintro.html +4 -0
  59. data/spec/assets/xref_error.adoc +7 -0
  60. data/spec/isodoc/blocks_spec.rb +259 -0
  61. data/spec/isodoc/i18n_spec.rb +442 -0
  62. data/spec/isodoc/inline_spec.rb +287 -0
  63. data/spec/isodoc/iso_spec.rb +116 -0
  64. data/spec/isodoc/metadata_spec.rb +262 -0
  65. data/spec/isodoc/postproc_spec.rb +137 -0
  66. data/spec/isodoc/ref_spec.rb +376 -0
  67. data/spec/isodoc/section_spec.rb +467 -0
  68. data/spec/isodoc/terms_spec.rb +246 -0
  69. data/spec/isodoc/xref_spec.rb +1730 -0
  70. data/spec/metanorma/processor_spec.rb +76 -0
  71. data/spec/spec_helper.rb +291 -0
  72. data/spec/vcr_cassettes/iso-639.yml +182 -0
  73. data/spec/vcr_cassettes/isobib_get_639_1967.yml +136 -0
  74. data/spec/vcr_cassettes/multistandard.yml +352 -0
  75. metadata +343 -0
@@ -0,0 +1,246 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc do
4
+ it "processes IsoXML terms" do
5
+ input = <<~INPUT
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <sections>
8
+ <terms id="_terms_and_definitions" obligation="normative"><title>Terms and definitions</title>
9
+
10
+ <term id="paddy1"><preferred>paddy</preferred>
11
+ <domain>rice</domain>
12
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
13
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74a">
14
+ <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
15
+ </termnote>
16
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f892">
17
+ <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
18
+ <ul>
19
+ <li>A</li>
20
+ </ul>
21
+ </termexample>
22
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f894">
23
+ <ul>
24
+ <li>A</li>
25
+ </ul>
26
+ </termexample>
27
+
28
+ <termsource status="modified">
29
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
30
+ <modification>
31
+ <p id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
32
+ </modification>
33
+ </termsource></term>
34
+
35
+ <term id="paddy">
36
+ <preferred>paddy</preferred><admitted>paddy rice</admitted>
37
+ <admitted>rough rice</admitted>
38
+ <deprecates>cargo rice</deprecates>
39
+ <definition><p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p></definition>
40
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74e">
41
+ <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
42
+ </termnote>
43
+ <termnote id="_671a1994-4783-40d0-bc81-987d06ffb74f">
44
+ <ul><li>A</li></ul>
45
+ <p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p>
46
+ </termnote>
47
+ <termexample id="_bd57bbf1-f948-4bae-b0ce-73c00431f893">
48
+ <ul>
49
+ <li>A</li>
50
+ </ul>
51
+ </termexample>
52
+ <termsource status="identical">
53
+ <origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>
54
+ </termsource></term>
55
+ </terms>
56
+ </sections>
57
+ </iso-standard>
58
+ INPUT
59
+ presxml = <<~INPUT
60
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
61
+ <sections>
62
+ <terms id='_terms_and_definitions' obligation='normative'>
63
+ <title depth='1'>
64
+ 1
65
+ <tab/>
66
+ Terms and definitions
67
+ </title>
68
+ <term id='paddy1'>
69
+ <name>1.1</name>
70
+ <preferred>paddy</preferred>
71
+ <domain>rice</domain>
72
+ <definition>
73
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
74
+ </definition>
75
+ <termnote id='_671a1994-4783-40d0-bc81-987d06ffb74a'>
76
+ <name>NOTE</name>
77
+ <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
78
+ The starch of waxy rice consists almost entirely of amylopectin. The
79
+ kernels have a tendency to stick together after cooking.
80
+ </p>
81
+ </termnote>
82
+ <termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f892'>
83
+ <name>EXAMPLE 1</name>
84
+ <p id='_65c9a509-9a89-4b54-a890-274126aeb55c'>Foreign seeds, husks, bran, sand, dust.</p>
85
+ <ul>
86
+ <li>A</li>
87
+ </ul>
88
+ </termexample>
89
+ <termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f894'>
90
+ <name>EXAMPLE 2</name>
91
+ <ul>
92
+ <li>A</li>
93
+ </ul>
94
+ </termexample>
95
+ <termsource status='modified'>
96
+ <origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'>
97
+ <locality type='clause'>
98
+ <referenceFrom>3.1</referenceFrom>
99
+ </locality>
100
+ ISO 7301:2011, 3.1
101
+ </origin>
102
+ <modification>
103
+ <p id='_e73a417d-ad39-417d-a4c8-20e4e2529489'>
104
+ The term "cargo rice" is shown as deprecated, and Note 1 to entry
105
+ is not included here
106
+ </p>
107
+ </modification>
108
+ </termsource>
109
+ </term>
110
+ <term id='paddy'>
111
+ <name>1.2</name>
112
+ <preferred>paddy</preferred>
113
+ <admitted>paddy rice</admitted>
114
+ <admitted>rough rice</admitted>
115
+ <deprecates>cargo rice</deprecates>
116
+ <definition>
117
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
118
+ </definition>
119
+ <termnote id='_671a1994-4783-40d0-bc81-987d06ffb74e'>
120
+ <name>NOTE 1</name>
121
+ <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
122
+ The starch of waxy rice consists almost entirely of amylopectin. The
123
+ kernels have a tendency to stick together after cooking.
124
+ </p>
125
+ </termnote>
126
+ <termnote id='_671a1994-4783-40d0-bc81-987d06ffb74f'>
127
+ <name>NOTE 2</name>
128
+ <ul>
129
+ <li>A</li>
130
+ </ul>
131
+ <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
132
+ The starch of waxy rice consists almost entirely of amylopectin. The
133
+ kernels have a tendency to stick together after cooking.
134
+ </p>
135
+ </termnote>
136
+ <termexample id='_bd57bbf1-f948-4bae-b0ce-73c00431f893'>
137
+ <name>EXAMPLE</name>
138
+ <ul>
139
+ <li>A</li>
140
+ </ul>
141
+ </termexample>
142
+ <termsource status='identical'>
143
+ <origin bibitemid='ISO7301' type='inline' citeas='ISO 7301:2011'>
144
+ <locality type='clause'>
145
+ <referenceFrom>3.1</referenceFrom>
146
+ </locality>
147
+ ISO 7301:2011, 3.1
148
+ </origin>
149
+ </termsource>
150
+ </term>
151
+ </terms>
152
+ </sections>
153
+ </iso-standard>
154
+ INPUT
155
+ html = <<~OUTPUT
156
+ #{HTML_HDR}
157
+ <div id="">
158
+ <h1 class="ForewordTitle">FOREWORD</h1>
159
+ <div class="boilerplate_legal"/>
160
+ </div>
161
+ #{IEC_TITLE1}
162
+ <div id='_terms_and_definitions'>
163
+ <h1> 1 &#8195; Terms and definitions </h1>
164
+ <p class='TermNum' id='paddy1'>1.1</p>
165
+ <p class='Terms' style='text-align:left;'>paddy</p>
166
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>&lt;rice&gt; rice retaining its husk after threshing</p>
167
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f892' class='example'>
168
+ <p>
169
+ <span class='example_label'>EXAMPLE 1</span>
170
+ &#8195;Foreign seeds, husks, bran, sand, dust.
171
+ </p>
172
+ <ul>
173
+ <li>A</li>
174
+ </ul>
175
+ </div>
176
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f894' class='example'>
177
+ <p>
178
+ <span class='example_label'>EXAMPLE 2</span>
179
+ &#8195;
180
+ </p>
181
+ <ul>
182
+ <li>A</li>
183
+ </ul>
184
+ </div>
185
+ <div id='_671a1994-4783-40d0-bc81-987d06ffb74a' class='Note'>
186
+ <p>
187
+ NOTE: The starch of waxy rice consists almost entirely of
188
+ amylopectin. The kernels have a tendency to stick together after
189
+ cooking.
190
+ </p>
191
+ </div>
192
+ <p>
193
+ [TERMREF]
194
+ <a href='#ISO7301'> ISO 7301:2011, 3.1 </a>
195
+ [MODIFICATION] The term "cargo rice" is shown as deprecated, and Note
196
+ 1 to entry is not included here [/TERMREF]
197
+ </p>
198
+ <p class='TermNum' id='paddy'>1.2</p>
199
+ <p class='Terms' style='text-align:left;'>paddy</p>
200
+ <p class='AltTerms' style='text-align:left;'>paddy rice</p>
201
+ <p class='AltTerms' style='text-align:left;'>rough rice</p>
202
+ <p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: cargo rice</p>
203
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
204
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f893' class='example'>
205
+ <p>
206
+ <span class='example_label'>EXAMPLE</span>
207
+ &#8195;
208
+ </p>
209
+ <ul>
210
+ <li>A</li>
211
+ </ul>
212
+ </div>
213
+ <div id='_671a1994-4783-40d0-bc81-987d06ffb74e' class='Note'>
214
+ <p>
215
+ NOTE 1: The starch of waxy rice consists almost entirely of
216
+ amylopectin. The kernels have a tendency to stick together after
217
+ cooking.
218
+ </p>
219
+ </div>
220
+ <div id='_671a1994-4783-40d0-bc81-987d06ffb74f' class='Note'>
221
+ <p>
222
+ NOTE 2:
223
+ <ul>
224
+ <li>A</li>
225
+ </ul>
226
+ <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
227
+ The starch of waxy rice consists almost entirely of amylopectin.
228
+ The kernels have a tendency to stick together after cooking.
229
+ </p>
230
+ </p>
231
+ </div>
232
+ <p>
233
+ [TERMREF]
234
+ <a href='#ISO7301'> ISO 7301:2011, 3.1 </a>
235
+ [/TERMREF]
236
+ </p>
237
+ </div>
238
+ </div>
239
+ </body>
240
+ </html>
241
+ OUTPUT
242
+
243
+ expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
244
+ expect(xmlpp(IsoDoc::BSI::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
245
+ end
246
+ end
@@ -0,0 +1,1730 @@
1
+ require "spec_helper"
2
+
3
+ RSpec.describe IsoDoc::BSI do
4
+ it "cross-references commentaries" do
5
+ expect(xmlpp(IsoDoc::BSI::PresentationXMLConvert.new({})
6
+ .convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
7
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
8
+ <preface>
9
+ <foreword>
10
+ <p>
11
+ <xref target="N"/>
12
+ <xref target="note1"/>
13
+ <xref target="note2"/>
14
+ <xref target="AN"/>
15
+ </p>
16
+ </foreword>
17
+ </preface>
18
+ <sections>
19
+ <clause id='reag1' inline-header='false' obligation='normative'>
20
+ <title>Reagents</title>
21
+ <admonition id='N' type='commentary' target="reag1">
22
+ <p id='p1'>This is a commentary on the reagents</p>
23
+ </admonition>
24
+ <admonition id='note1' type='commentary' target="reag1">
25
+ <p id='p2'>This is a commentary on the reagents</p>
26
+ </admonition>
27
+ <admonition id='note2' type='commentary' target='table1'>
28
+ <p id='p3'>This is a commentary on the reagents</p>
29
+ </admonition>
30
+ <table id='table1'>
31
+ <name>Reagents in use</name>
32
+ <tbody>
33
+ <tr>
34
+ <td valign='top' align='left'>A</td>
35
+ <td valign='top' align='left'>B</td>
36
+ </tr>
37
+ </tbody>
38
+ </table>
39
+ </clause>
40
+ <clause id="reag0">
41
+ <clause id='reag2' inline-header='false' obligation='normative'>
42
+ <title>Reagents</title>
43
+ <admonition id='AN' type='commentary' target='reag2'>
44
+ <p id='p2'>This is a commentary on the reagents</p>
45
+ </admonition>
46
+ <table id='table2'>
47
+ <name>Reagents in use</name>
48
+ <tbody>
49
+ <tr>
50
+ <td valign='top' align='left'>A</td>
51
+ <td valign='top' align='left'>B</td>
52
+ </tr>
53
+ </tbody>
54
+ </table>
55
+ </clause>
56
+ </clause>
57
+ </sections>
58
+ </iso-standard>
59
+ 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
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
+ OUTPUT
126
+ end
127
+
128
+ 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">
179
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
180
+ </note>
181
+ <note id="Anote2">
182
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
183
+ </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
+ <p>
214
+ <xref target="N">Note</xref>
215
+ </p>
216
+ </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">
261
+ <name>NOTE 1</name>
262
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different
263
+ types of kernel.
264
+ </p>
265
+ </note>
266
+ <note id="Anote2">
267
+ <name>NOTE 2</name>
268
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different
269
+ types of kernel.
270
+ </p>
271
+ </note>
272
+ </clause>
273
+ </annex>
274
+ </iso-standard>
275
+ OUTPUT
276
+ end
277
+
278
+ 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">
298
+ <name>Split-it-right sample divider</name>
299
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
300
+ </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">
327
+ <name>Split-it-right sample divider</name>
328
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
329
+ </figure>
330
+ </clause>
331
+ <clause id="annex1b">
332
+ <figure id="Anote1">
333
+ <name>Split-it-right sample divider</name>
334
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
335
+ </figure>
336
+ <figure id="Anote2">
337
+ <name>Split-it-right sample divider</name>
338
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
339
+ </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
+ <p>
349
+ <xref target="N">Figure 1</xref>
350
+ <xref target="note1">Figure 2</xref>
351
+ <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
+ </p>
370
+ </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
420
+ end
421
+
422
+ 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">
468
+ <name>Split-it-right sample divider</name>
469
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
470
+ </figure>
471
+ <figure id="Anote2">
472
+ <name>Split-it-right sample divider</name>
473
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
474
+ </figure>
475
+ </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
+ <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>
491
+ </p>
492
+ </foreword>
493
+ </preface>
494
+ <sections>
495
+ <clause id="scope" type="scope">
496
+ <title depth="1">1
497
+ <tab/>
498
+ Scope</title>
499
+ </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">
539
+ <name>a)  Split-it-right sample divider</name>
540
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
541
+ </figure>
542
+ <figure id="Anote2">
543
+ <name>b)  Split-it-right sample divider</name>
544
+ <image id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" src="rice_images/rice_image1.png"/>
545
+ </figure>
546
+ </figure>
547
+ </clause>
548
+ </annex>
549
+ </iso-standard>
550
+ OUTPUT
551
+ end
552
+
553
+ 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">
607
+ <p>Hello</p>
608
+ </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>
634
+ <p>Hello</p>
635
+ </example>
636
+ <p>
637
+ <xref target="N">Example</xref>
638
+ </p>
639
+ </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">
678
+ <name>EXAMPLE 1</name>
679
+ <p>Hello</p>
680
+ </example>
681
+ <example id="Anote2">
682
+ <name>EXAMPLE 2</name>
683
+ <p>Hello</p>
684
+ </example>
685
+ </clause>
686
+ </annex>
687
+ </iso-standard>
688
+ OUTPUT
689
+ end
690
+
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>
715
+ 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
739
+ <tab/>
740
+ Preparatory
741
+ </title>
742
+ <formula id='N2' inequality='true'>
743
+ <name>2</name>
744
+ <stem type='AsciiMath'>r = 1 %</stem>
745
+ </formula>
746
+ <xref target='N2'>Inequality (2)</xref>
747
+ </clause>
748
+ </clause>
749
+ </sections>
750
+ </iso-standard>
751
+ OUTPUT
752
+ end
753
+
754
+ 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">
774
+ <name>Repeatability and reproducibility of husked rice yield</name>
775
+ <tbody>
776
+ <tr>
777
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
778
+ <td align="center">13</td>
779
+ <td align="center">11</td>
780
+ </tr>
781
+ </tbody>
782
+ </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">
821
+ <name>Repeatability and reproducibility of husked rice yield</name>
822
+ <tbody>
823
+ <tr>
824
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
825
+ <td align="center">13</td>
826
+ <td align="center">11</td>
827
+ </tr>
828
+ </tbody>
829
+ </table>
830
+ </clause>
831
+ <clause id="annex1b">
832
+ <table id="Anote1">
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
+ <table id="Anote2">
843
+ <name>Repeatability and reproducibility of husked rice yield</name>
844
+ <tbody>
845
+ <tr>
846
+ <td align="left">Number of laboratories retained after eliminating outliers</td>
847
+ <td align="center">13</td>
848
+ <td align="center">11</td>
849
+ </tr>
850
+ </tbody>
851
+ </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
+ <p>
861
+ <xref target="N">Table 1</xref>
862
+ <xref target="note1">Table 2</xref>
863
+ <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
+ </p>
888
+ </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>
967
+ OUTPUT
968
+ end
969
+
970
+ 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>
1004
+
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
1056
+ end
1057
+
1058
+ 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>
1096
+ </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>
1111
+ </terms>
1112
+ <definitions id="L">
1113
+ <dl>
1114
+ <dt>Symbol</dt>
1115
+ <dd>Definition</dd>
1116
+ </dl>
1117
+ </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>
1152
+ </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>
1201
+ </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>
1244
+ </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>
1262
+ </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>
1279
+ </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
1289
+ end
1290
+
1291
+ it "cross-references lists" do
1292
+ output = IsoDoc::BSI::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true)
1293
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1294
+ <preface>
1295
+ <foreword>
1296
+ <p>
1297
+ <xref target="N"/>
1298
+ <xref target="note1"/>
1299
+ <xref target="note2"/>
1300
+ <xref target="AN"/>
1301
+ <xref target="Anote1"/>
1302
+ <xref target="Anote2"/>
1303
+ </p>
1304
+ </foreword>
1305
+ </preface>
1306
+ <sections>
1307
+ <clause id="scope" type="scope">
1308
+ <title>Scope</title>
1309
+ <ol id="N" type="alphabet">
1310
+ <li>
1311
+ <p>A</p>
1312
+ </li>
1313
+ </ol>
1314
+ </clause>
1315
+ <terms id="terms"/>
1316
+ <clause id="widgets">
1317
+ <title>Widgets</title>
1318
+ <clause id="widgets1">
1319
+ <ol id="note1" type="alphabet">
1320
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1321
+ </ol>
1322
+ <ol id="note2" type="arabic">
1323
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
1324
+ </ol>
1325
+ </clause>
1326
+ </clause>
1327
+ </sections>
1328
+ <annex id="annex1">
1329
+ <clause id="annex1a">
1330
+ <ol id="AN" type="alphabet">
1331
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1332
+ </ol>
1333
+ </clause>
1334
+ <clause id="annex1b">
1335
+ <ol id="Anote1" type="alphabet">
1336
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
1337
+ </ol>
1338
+ <ol id="Anote2" type="arabic">
1339
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different types of kernel.</p>
1340
+ </ol>
1341
+ </clause>
1342
+ </annex>
1343
+ </iso-standard>
1344
+ INPUT
1345
+ expect(xmlpp(output)).to be_equivalent_to xmlpp(<<~"OUTPUT")
1346
+ <?xml version='1.0'?>
1347
+ <iso-standard type="presentation" xmlns="http://riboseinc.com/isoxml">
1348
+ <preface>
1349
+ <foreword>
1350
+ <p>
1351
+ <xref target="N">Clause <strong>1</strong>, List</xref>
1352
+ <xref target="note1"><strong>3.1</strong>, List 1</xref>
1353
+ <xref target="note2"><strong>3.1</strong>, List 2</xref>
1354
+ <xref target="AN"><strong>A.1</strong>, List</xref>
1355
+ <xref target="Anote1"><strong>A.2</strong>, List 1</xref>
1356
+ <xref target="Anote2"><strong>A.2</strong>, List 2</xref>
1357
+ </p>
1358
+ </foreword>
1359
+ </preface>
1360
+ <sections>
1361
+ <clause id="scope" type="scope">
1362
+ <title depth="1">1
1363
+ <tab/>
1364
+ Scope</title>
1365
+ <ol id="N" type="alphabet">
1366
+ <li>
1367
+ <p>A</p>
1368
+ </li>
1369
+ </ol>
1370
+ </clause>
1371
+ <terms id="terms">
1372
+ <title>2</title>
1373
+ </terms>
1374
+ <clause id="widgets">
1375
+ <title depth="1">3
1376
+ <tab/>
1377
+ Widgets</title>
1378
+ <clause id="widgets1" inline-header="true">
1379
+ <title>3.1</title>
1380
+ <ol id="note1" type="alphabet">
1381
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different
1382
+ types of kernel.
1383
+ </p>
1384
+ </ol>
1385
+ <ol id="note2" type="arabic">
1386
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different
1387
+ types of kernel.
1388
+ </p>
1389
+ </ol>
1390
+ </clause>
1391
+ </clause>
1392
+ </sections>
1393
+ <annex id="annex1">
1394
+ <title>
1395
+ <strong>Annex A</strong>
1396
+ <br/>(informative)</title>
1397
+ <clause id="annex1a" inline-header="true">
1398
+ <title>A.1</title>
1399
+ <ol id="AN" type="alphabet">
1400
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different
1401
+ types of kernel.
1402
+ </p>
1403
+ </ol>
1404
+ </clause>
1405
+ <clause id="annex1b" inline-header="true">
1406
+ <title>A.2</title>
1407
+ <ol id="Anote1" type="alphabet">
1408
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different
1409
+ types of kernel.
1410
+ </p>
1411
+ </ol>
1412
+ <ol id="Anote2" type="arabic">
1413
+ <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83a">These results are based on a study carried out on three different
1414
+ types of kernel.
1415
+ </p>
1416
+ </ol>
1417
+ </clause>
1418
+ </annex>
1419
+ </iso-standard>
1420
+ OUTPUT
1421
+ end
1422
+
1423
+ 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">
1444
+ <p>A</p>
1445
+ </li>
1446
+ </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">
1469
+ <p>A</p>
1470
+ </li>
1471
+ </ol>
1472
+ </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">
1481
+ <p>A</p>
1482
+ </li>
1483
+ </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'>
1507
+ <p>A</p>
1508
+ </li>
1509
+ </ol>
1510
+ </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'>
1517
+ <p>A</p>
1518
+ </li>
1519
+ </ol>
1520
+ <ol id='note2l' type="arabic">
1521
+ <li id='note2'>
1522
+ <p>A</p>
1523
+ </li>
1524
+ </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
1554
+ 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
1729
+ end
1730
+ end