isodoc 1.6.0 → 1.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +2 -12
  3. data/.hound.yml +3 -1
  4. data/.rubocop.yml +4 -8
  5. data/Rakefile +2 -2
  6. data/bin/rspec +1 -2
  7. data/isodoc.gemspec +4 -3
  8. data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
  9. data/lib/isodoc-yaml/i18n-de.yaml +149 -0
  10. data/lib/isodoc-yaml/i18n-en.yaml +1 -0
  11. data/lib/isodoc-yaml/i18n-es.yaml +151 -0
  12. data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
  13. data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
  14. data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
  15. data/lib/isodoc.rb +0 -2
  16. data/lib/isodoc/common.rb +2 -0
  17. data/lib/isodoc/convert.rb +10 -4
  18. data/lib/isodoc/css.rb +30 -26
  19. data/lib/isodoc/function/blocks.rb +26 -8
  20. data/lib/isodoc/function/blocks_example_note.rb +2 -2
  21. data/lib/isodoc/function/cleanup.rb +53 -45
  22. data/lib/isodoc/function/form.rb +51 -0
  23. data/lib/isodoc/function/inline.rb +8 -7
  24. data/lib/isodoc/function/references.rb +71 -77
  25. data/lib/isodoc/function/section.rb +28 -16
  26. data/lib/isodoc/function/table.rb +22 -22
  27. data/lib/isodoc/function/terms.rb +6 -7
  28. data/lib/isodoc/function/to_word_html.rb +19 -25
  29. data/lib/isodoc/function/utils.rb +180 -160
  30. data/lib/isodoc/gem_tasks.rb +36 -38
  31. data/lib/isodoc/headlesshtml_convert.rb +8 -7
  32. data/lib/isodoc/html_convert.rb +10 -4
  33. data/lib/isodoc/html_function/comments.rb +14 -12
  34. data/lib/isodoc/html_function/footnotes.rb +14 -7
  35. data/lib/isodoc/html_function/form.rb +62 -0
  36. data/lib/isodoc/html_function/html.rb +30 -26
  37. data/lib/isodoc/html_function/postprocess.rb +191 -226
  38. data/lib/isodoc/html_function/postprocess_footnotes.rb +59 -0
  39. data/lib/isodoc/html_function/sectionsplit.rb +230 -0
  40. data/lib/isodoc/i18n.rb +33 -31
  41. data/lib/isodoc/metadata.rb +22 -20
  42. data/lib/isodoc/metadata_contributor.rb +31 -28
  43. data/lib/isodoc/pdf_convert.rb +11 -13
  44. data/lib/isodoc/presentation_function/bibdata.rb +54 -30
  45. data/lib/isodoc/presentation_function/block.rb +17 -8
  46. data/lib/isodoc/presentation_function/inline.rb +72 -120
  47. data/lib/isodoc/presentation_function/math.rb +84 -0
  48. data/lib/isodoc/presentation_function/section.rb +55 -19
  49. data/lib/isodoc/presentation_xml_convert.rb +2 -0
  50. data/lib/isodoc/sassc_importer.rb +1 -1
  51. data/lib/isodoc/version.rb +1 -1
  52. data/lib/isodoc/word_function/body.rb +28 -24
  53. data/lib/isodoc/word_function/footnotes.rb +22 -15
  54. data/lib/isodoc/word_function/postprocess.rb +50 -36
  55. data/lib/isodoc/xref.rb +11 -10
  56. data/lib/isodoc/xref/xref_counter.rb +32 -17
  57. data/lib/isodoc/xref/xref_gen.rb +33 -21
  58. data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
  59. data/lib/isodoc/xref/xref_sect_gen.rb +37 -35
  60. data/spec/assets/scripts_override.html +3 -0
  61. data/spec/isodoc/blocks_spec.rb +2258 -2622
  62. data/spec/isodoc/cleanup_spec.rb +1103 -1107
  63. data/spec/isodoc/form_spec.rb +156 -0
  64. data/spec/isodoc/i18n_spec.rb +802 -917
  65. data/spec/isodoc/inline_spec.rb +1105 -921
  66. data/spec/isodoc/lists_spec.rb +316 -315
  67. data/spec/isodoc/metadata_spec.rb +384 -379
  68. data/spec/isodoc/postproc_spec.rb +1783 -1549
  69. data/spec/isodoc/presentation_xml_spec.rb +355 -278
  70. data/spec/isodoc/ref_spec.rb +718 -723
  71. data/spec/isodoc/section_spec.rb +216 -199
  72. data/spec/isodoc/sectionsplit_spec.rb +190 -0
  73. data/spec/isodoc/table_spec.rb +41 -42
  74. data/spec/isodoc/terms_spec.rb +84 -84
  75. data/spec/isodoc/xref_spec.rb +1024 -930
  76. metadata +33 -7
@@ -1,95 +1,80 @@
1
1
  require "spec_helper"
2
2
 
3
3
  RSpec.describe IsoDoc do
4
- it "droplocs xrefs" do
5
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
6
- <iso-standard xmlns="http://riboseinc.com/isoxml">
7
- <sections>
8
- <clause id="A">
9
- <formula id="B">
10
- </formula>
11
- </clause>
12
- <clause id="C">
13
- <p>This is <xref target="A"/> and <xref target="B"/>.
14
- This is <xref target="A" droploc="true"/> and <xref target="B" droploc="true"/>.</p>
15
- </clause>
16
- </sections>
17
- </iso-standard>
18
- INPUT
19
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
20
- <sections>
21
- <clause id='A'>
22
- <title>1.</title>
23
- <formula id='B'>
24
- <name>1</name>
25
- </formula>
26
- </clause>
27
- <clause id='C'>
28
- <title>2.</title>
29
- <p>
30
- This is
31
- <xref target='A'>kla&#x16D;zo 1</xref>
32
- and
33
- <xref target='B'>kla&#x16D;zo 1, Formula (1)</xref>
34
- . This is
35
- <xref target='A' droploc='true'>1</xref>
36
- and
37
- <xref target='B' droploc='true'>(1)</xref>
38
- .
39
- </p>
40
- </clause>
41
- </sections>
42
- </iso-standard>
43
- OUTPUT
44
- end
45
-
46
- it "processes inline formatting (HTML)" do
47
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
48
- <iso-standard xmlns="http://riboseinc.com/isoxml">
49
- <preface><foreword>
50
- <p>
51
- <em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt>
52
- <strike>F</strike> <smallcap>G</smallcap> <keyword>I</keyword> <br/> <hr/>
53
- <bookmark id="H"/> <pagebreak/> <pagebreak orientation="landscape"/> <underline>J</underline>
54
- </p>
55
- </foreword></preface>
56
- <sections>
57
- </iso-standard>
4
+ it "droplocs xrefs" do
5
+ input = <<~INPUT
6
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
7
+ <sections>
8
+ <clause id="A">
9
+ <formula id="B">
10
+ </formula>
11
+ </clause>
12
+ <clause id="C">
13
+ <p>This is <xref target="A"/> and <xref target="B"/>.
14
+ This is <xref target="A" droploc="true"/> and <xref target="B" droploc="true"/>.</p>
15
+ </clause>
16
+ </sections>
17
+ </iso-standard>
58
18
  INPUT
59
- #{HTML_HDR}
60
- <br/>
61
- <div>
62
- <h1 class="ForewordTitle">Foreword</h1>
63
- <p>
64
- <i>A</i> <b>B</b> <sup>C</sup> <sub>D</sub> <tt>E</tt>
65
- <s>F</s> <span style="font-variant:small-caps;">G</span> <span class="keyword">I</span> <br/> <hr/>
66
- <a id="H"/> <br/> <br/>
67
- <span style='text-decoration: underline;'>J</span>
68
- </p>
69
- </div>
70
- <p class="zzSTDTitle1"/>
71
- </div>
72
- </body>
73
- </html>
19
+ output = <<~OUTPUT
20
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
21
+ <sections>
22
+ <clause id='A' displayorder="1">
23
+ <title>1.</title>
24
+ <formula id='B'>
25
+ <name>1</name>
26
+ </formula>
27
+ </clause>
28
+ <clause id='C' displayorder="2">
29
+ <title>2.</title>
30
+ <p>
31
+ This is
32
+ <xref target='A'>kla&#x16D;zo 1</xref>
33
+ and
34
+ <xref target='B'>kla&#x16D;zo 1, Formula (1)</xref>
35
+ . This is
36
+ <xref target='A' droploc='true'>1</xref>
37
+ and
38
+ <xref target='B' droploc='true'>(1)</xref>
39
+ .
40
+ </p>
41
+ </clause>
42
+ </sections>
43
+ </iso-standard>
74
44
  OUTPUT
45
+ expect(xmlpp(IsoDoc::PresentationXMLConvert
46
+ .new({ i18nyaml: "spec/assets/i18n.yaml" })
47
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
75
48
  end
76
49
 
77
- it "processes inline formatting (Word)" do
78
- expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
79
- <iso-standard xmlns="http://riboseinc.com/isoxml">
80
- <preface/><sections><clause>
81
- <p>
82
- <em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt>
83
- <strike>F</strike> <smallcap>G</smallcap> <keyword>I</keyword> <br/> <hr/>
84
- <bookmark id="H"/> <pagebreak/> <pagebreak orientation="landscape"/> <underline>J</underline>
85
- </p>
86
- </clause></sections>
87
- </iso-standard>
50
+ it "processes inline formatting" do
51
+ input = <<~INPUT
52
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
53
+ <preface><foreword>
54
+ <p>
55
+ <em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt>
56
+ <strike>F</strike> <smallcap>G</smallcap> <keyword>I</keyword> <br/> <hr/>
57
+ <bookmark id="H"/> <pagebreak/> <pagebreak orientation="landscape"/> <underline>J</underline>
58
+ </p>
59
+ </foreword></preface>
60
+ <sections>
61
+ </iso-standard>
88
62
  INPUT
89
- #{WORD_HDR}
90
- <p class='zzSTDTitle1'/>
63
+ html = <<~OUTPUT
64
+ <div>
65
+ <h1 class="ForewordTitle">Foreword</h1>
66
+ <p>
67
+ <i>A</i> <b>B</b> <sup>C</sup> <sub>D</sub> <tt>E</tt>
68
+ <s>F</s> <span style="font-variant:small-caps;">G</span> <span class="keyword">I</span> <br/> <hr/>
69
+ <a id="H"/> <br/> <br/>
70
+ <span style='text-decoration: underline;'>J</span>
71
+ </p>
72
+ </div>
73
+ OUTPUT
74
+
75
+ doc = <<~OUTPUT
91
76
  <div>
92
- <h1/>
77
+ <h1 class='ForewordTitle'>Foreword</h1>
93
78
  <p>
94
79
  <i>A</i>
95
80
  <b>B</b>
@@ -111,684 +96,861 @@ OUTPUT
111
96
  <u>J</u>
112
97
  </p>
113
98
  </div>
114
- </div>
115
- </body>
116
- </html>
117
-
118
99
  OUTPUT
100
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
101
+ .convert("test", input, true))
102
+ .sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
103
+ .to be_equivalent_to xmlpp(html)
104
+ expect(xmlpp(IsoDoc::WordConvert.new({})
105
+ .convert("test", input, true))
106
+ .sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
107
+ .to be_equivalent_to xmlpp(doc)
119
108
  end
120
109
 
121
- it "ignores index entries" do
122
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
123
- <iso-standard xmlns="http://riboseinc.com/isoxml">
124
- <preface><foreword>
125
- <p><index primary="A" secondary="B" tertiary="C"/></p>
126
- </foreword></preface>
127
- <sections/>
128
- <indexsect>
129
- <title>Index</title>
130
- </indexsect>
131
- </iso-standard>
110
+ it "ignores index entries" do
111
+ input = <<~INPUT
112
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
113
+ <preface><foreword>
114
+ <p><index primary="A" secondary="B" tertiary="C"/></p>
115
+ </foreword></preface>
116
+ <sections/>
117
+ <indexsect>
118
+ <title>Index</title>
119
+ </indexsect>
120
+ </iso-standard>
132
121
  INPUT
133
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
134
- <preface>
135
- <foreword>
136
- <p/>
137
- </foreword>
138
- </preface>
139
- <sections> </sections>
140
- </iso-standard>
122
+ output = <<~OUTPUT
123
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
124
+ <preface>
125
+ <foreword displayorder="1">
126
+ <p/>
127
+ </foreword>
128
+ </preface>
129
+ <sections> </sections>
130
+ </iso-standard>
141
131
  OUTPUT
142
- end
132
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
133
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
134
+ end
143
135
 
144
- it "processes concept markup" do
145
- input = <<~INPUT
146
- <iso-standard xmlns="http://riboseinc.com/isoxml">
147
- <preface><foreword>
148
- <p>
149
- <ul>
150
- <li><concept term='term'>
151
- <xref target='clause1'/>
152
- </concept></li>
153
- <li><concept term='term'>
154
- <xref target='clause1'>w[o]rd</xref>
155
- </concept></li>
156
- <li><concept term='term'>
157
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712"/>
158
- </concept></li>
159
- <li><concept term='term'>
160
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712">word</eref>
161
- </concept></li>
162
- <li><concept>
163
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
164
- <locality type='clause'>
165
- <referenceFrom>3.1</referenceFrom>
166
- </locality>
167
- <locality type='figure'>
168
- <referenceFrom>a</referenceFrom>
169
- </locality>
170
- </eref>
171
- </concept></li>
172
- <li><concept>
173
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
174
- <localityStack>
175
- <locality type='clause'>
176
- <referenceFrom>3.1</referenceFrom>
177
- </locality>
178
- </localityStack>
179
- <localityStack>
180
- <locality type='figure'>
181
- <referenceFrom>b</referenceFrom>
182
- </locality>
183
- </localityStack>
184
- </eref>
185
- </concept></li>
186
- <li><concept>
187
- <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
188
- <localityStack>
189
- <locality type='clause'>
190
- <referenceFrom>3.1</referenceFrom>
191
- </locality>
192
- </localityStack>
193
- <localityStack>
194
- <locality type='figure'>
195
- <referenceFrom>b</referenceFrom>
196
- </locality>
197
- </localityStack>
198
- <em>word</em>
199
- </eref>
200
- </concept></li>
201
- <li><concept term='term'>
202
- <termref base='IEV' target='135-13-13'/>
203
- </concept></li>
204
- <li><concept term='term'>
205
- <termref base='IEV' target='135-13-13'><em>word</em> word</termref>
206
- </concept></li>
207
- </ul>
208
- </p>
209
- </foreword></preface>
210
- <sections>
211
- <clause id="clause1"><title>Clause 1</title></clause>
212
- </sections>
213
- <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
214
- <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
215
- <bibitem id="ISO712" type="standard">
216
- <title format="text/plain">Cereals or cereal products</title>
217
- <title type="main" format="text/plain">Cereals and cereal products</title>
218
- <docidentifier type="ISO">ISO 712</docidentifier>
219
- <contributor>
220
- <role type="publisher"/>
221
- <organization>
222
- <name>International Organization for Standardization</name>
223
- </organization>
224
- </contributor>
225
- </bibitem>
226
- </references></bibliography>
227
- </iso-standard>
136
+ it "processes concept markup" do
137
+ input = <<~INPUT
138
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
139
+ <preface><foreword>
140
+ <p>
141
+ <ul>
142
+ <li><concept term='term'>
143
+ <xref target='clause1'/>
144
+ </concept></li>
145
+ <li><concept term='term'>
146
+ <xref target='clause1'>w[o]rd</xref>
147
+ </concept></li>
148
+ <li><concept term='term'>
149
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712"/>
150
+ </concept></li>
151
+ <li><concept term='term'>
152
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">word</eref>
153
+ </concept></li>
154
+ <li><concept>
155
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
156
+ <locality type='clause'>
157
+ <referenceFrom>3.1</referenceFrom>
158
+ </locality>
159
+ <locality type='figure'>
160
+ <referenceFrom>a</referenceFrom>
161
+ </locality>
162
+ </eref>
163
+ </concept></li>
164
+ <li><concept>
165
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
166
+ <localityStack>
167
+ <locality type='clause'>
168
+ <referenceFrom>3.1</referenceFrom>
169
+ </locality>
170
+ </localityStack>
171
+ <localityStack>
172
+ <locality type='figure'>
173
+ <referenceFrom>b</referenceFrom>
174
+ </locality>
175
+ </localityStack>
176
+ </eref>
177
+ </concept></li>
178
+ <li><concept>
179
+ <eref bibitemid="ISO712" type="inline" citeas="ISO 712">
180
+ <localityStack>
181
+ <locality type='clause'>
182
+ <referenceFrom>3.1</referenceFrom>
183
+ </locality>
184
+ </localityStack>
185
+ <localityStack>
186
+ <locality type='figure'>
187
+ <referenceFrom>b</referenceFrom>
188
+ </locality>
189
+ </localityStack>
190
+ <em>word</em>
191
+ </eref>
192
+ </concept></li>
193
+ <li><concept term='term'>
194
+ <termref base='IEV' target='135-13-13'/>
195
+ </concept></li>
196
+ <li><concept term='term'>
197
+ <termref base='IEV' target='135-13-13'><em>word</em> word</termref>
198
+ </concept></li>
199
+ </ul>
200
+ </p>
201
+ </foreword></preface>
202
+ <sections>
203
+ <clause id="clause1"><title>Clause 1</title></clause>
204
+ </sections>
205
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
206
+ <p>The following documents are referred to in the text in such a way that some or all of their content constitutes requirements of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.</p>
207
+ <bibitem id="ISO712" type="standard">
208
+ <title format="text/plain">Cereals or cereal products</title>
209
+ <title type="main" format="text/plain">Cereals and cereal products</title>
210
+ <docidentifier type="ISO">ISO 712</docidentifier>
211
+ <contributor>
212
+ <role type="publisher"/>
213
+ <organization>
214
+ <name>International Organization for Standardization</name>
215
+ </organization>
216
+ </contributor>
217
+ </bibitem>
218
+ </references></bibliography>
219
+ </iso-standard>
228
220
  INPUT
229
221
  presxml = <<~OUTPUT
230
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
231
- <preface>
232
- <foreword>
233
- <p>
234
- <ul>
235
- <li>
236
- <em>
237
- <xref target='clause1'>Clause 2</xref>
238
- </em>
239
- </li>
240
- <li>
241
- <em>
242
- <xref target='clause1'>w[o]rd</xref>
243
- </em>
244
- </li>
245
- <li>
246
- <em>
247
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>ISO 712</eref>
248
- </em>
249
- </li>
250
- <li>
251
- <em>
252
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>word</eref>
253
- </em>
254
- </li>
255
- <li>
256
- <em>
257
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
258
- <locality type='clause'>
259
- <referenceFrom>3.1</referenceFrom>
260
- </locality>
261
- <locality type='figure'>
262
- <referenceFrom>a</referenceFrom>
263
- </locality>
264
- ISO 712, Clause 3.1, Figure a
265
- </eref>
266
- </em>
267
- </li>
268
- <li>
269
- <em>
270
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
271
- <localityStack>
272
- <locality type='clause'>
273
- <referenceFrom>3.1</referenceFrom>
274
- </locality>
275
- </localityStack>
276
- <localityStack>
277
- <locality type='figure'>
278
- <referenceFrom>b</referenceFrom>
279
- </locality>
280
- </localityStack>
281
- ISO 712, Clause 3.1; Figure b
282
- </eref>
283
- </em>
284
- </li>
285
- <li>
286
- <em>
287
- <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
288
- <localityStack>
289
- <locality type='clause'>
290
- <referenceFrom>3.1</referenceFrom>
291
- </locality>
292
- </localityStack>
293
- <localityStack>
294
- <locality type='figure'>
295
- <referenceFrom>b</referenceFrom>
296
- </locality>
297
- </localityStack>
298
- <em>word</em>
299
- </eref>
300
- </em>
301
- </li>
302
- <li>
303
- [term defined in
304
- <termref base='IEV' target='135-13-13'/>
305
- ]
306
- </li>
307
- <li>
308
- <em>
309
- <termref base='IEV' target='135-13-13'>
310
- <em>word</em>
311
- word
312
- </termref>
313
- </em>
314
- </li>
315
- </ul>
316
- </p>
317
- </foreword>
318
- </preface>
319
- <sections>
320
- <clause id='clause1'>
321
- <title depth='1'>
322
- 2.
323
- <tab/>
324
- Clause 1
325
- </title>
326
- </clause>
327
- </sections>
328
- <bibliography>
329
- <references id='_normative_references' obligation='informative' normative='true'>
330
- <title depth='1'>
331
- 1.
332
- <tab/>
333
- Normative References
334
- </title>
335
- <p>
336
- The following documents are referred to in the text in such a way that
337
- some or all of their content constitutes requirements of this document.
338
- For dated references, only the edition cited applies. For undated
339
- references, the latest edition of the referenced document (including any
340
- amendments) applies.
341
- </p>
342
- <bibitem id='ISO712' type='standard'>
343
- <title format='text/plain'>Cereals or cereal products</title>
344
- <title type='main' format='text/plain'>Cereals and cereal products</title>
345
- <docidentifier type='ISO'>ISO 712</docidentifier>
346
- <contributor>
347
- <role type='publisher'/>
348
- <organization>
349
- <name>International Organization for Standardization</name>
350
- </organization>
351
- </contributor>
352
- </bibitem>
353
- </references>
354
- </bibliography>
355
- </iso-standard>
356
- end
222
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
223
+ <preface>
224
+ <foreword displayorder="1">
225
+ <p>
226
+ <ul>
227
+ <li>
228
+ <em>
229
+ <xref target='clause1'>Clause 2</xref>
230
+ </em>
231
+ </li>
232
+ <li>
233
+ <em>
234
+ <xref target='clause1'>w[o]rd</xref>
235
+ </em>
236
+ </li>
237
+ <li>
238
+ <em>
239
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>ISO 712</eref>
240
+ </em>
241
+ </li>
242
+ <li>
243
+ <em>
244
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>word</eref>
245
+ </em>
246
+ </li>
247
+ <li>
248
+ <em>
249
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
250
+ <locality type='clause'>
251
+ <referenceFrom>3.1</referenceFrom>
252
+ </locality>
253
+ <locality type='figure'>
254
+ <referenceFrom>a</referenceFrom>
255
+ </locality>
256
+ ISO 712, Clause 3.1, Figure a
257
+ </eref>
258
+ </em>
259
+ </li>
260
+ <li>
261
+ <em>
262
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
263
+ <localityStack>
264
+ <locality type='clause'>
265
+ <referenceFrom>3.1</referenceFrom>
266
+ </locality>
267
+ </localityStack>
268
+ <localityStack>
269
+ <locality type='figure'>
270
+ <referenceFrom>b</referenceFrom>
271
+ </locality>
272
+ </localityStack>
273
+ ISO 712, Clause 3.1; Figure b
274
+ </eref>
275
+ </em>
276
+ </li>
277
+ <li>
278
+ <em>
279
+ <eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
280
+ <localityStack>
281
+ <locality type='clause'>
282
+ <referenceFrom>3.1</referenceFrom>
283
+ </locality>
284
+ </localityStack>
285
+ <localityStack>
286
+ <locality type='figure'>
287
+ <referenceFrom>b</referenceFrom>
288
+ </locality>
289
+ </localityStack>
290
+ <em>word</em>
291
+ </eref>
292
+ </em>
293
+ </li>
294
+ <li>
295
+ [term defined in
296
+ <termref base='IEV' target='135-13-13'/>
297
+ ]
298
+ </li>
299
+ <li>
300
+ <em>
301
+ <termref base='IEV' target='135-13-13'>
302
+ <em>word</em>
303
+ word
304
+ </termref>
305
+ </em>
306
+ </li>
307
+ </ul>
308
+ </p>
309
+ </foreword>
310
+ </preface>
311
+ <sections>
312
+ <clause id='clause1' displayorder="3">
313
+ <title depth='1'>
314
+ 2.
315
+ <tab/>
316
+ Clause 1
317
+ </title>
318
+ </clause>
319
+ </sections>
320
+ <bibliography>
321
+ <references id='_normative_references' obligation='informative' normative='true' displayorder="2">
322
+ <title depth='1'>
323
+ 1.
324
+ <tab/>
325
+ Normative References
326
+ </title>
327
+ <p>
328
+ The following documents are referred to in the text in such a way that
329
+ some or all of their content constitutes requirements of this document.
330
+ For dated references, only the edition cited applies. For undated
331
+ references, the latest edition of the referenced document (including any
332
+ amendments) applies.
333
+ </p>
334
+ <bibitem id='ISO712' type='standard'>
335
+ <title format='text/plain'>Cereals or cereal products</title>
336
+ <title type='main' format='text/plain'>Cereals and cereal products</title>
337
+ <docidentifier type='ISO'>ISO 712</docidentifier>
338
+ <contributor>
339
+ <role type='publisher'/>
340
+ <organization>
341
+ <name>International Organization for Standardization</name>
342
+ </organization>
343
+ </contributor>
344
+ </bibitem>
345
+ </references>
346
+ </bibliography>
347
+ </iso-standard>
348
+ OUTPUT
349
+ output = <<~OUTPUT
350
+ #{HTML_HDR}
351
+ <br/>
352
+ <div>
353
+ <h1 class='ForewordTitle'>Foreword</h1>
354
+ <p>
355
+ <ul>
356
+ <li>
357
+ <i>
358
+ <a href='#clause1'>Clause 2</a>
359
+ </i>
360
+ </li>
361
+ <li>
362
+ <i>
363
+ <a href='#clause1'>w[o]rd</a>
364
+ </i>
365
+ </li>
366
+ <li>
367
+ <i>
368
+ <a href='#ISO712'>ISO 712</a>
369
+ </i>
370
+ </li>
371
+ <li>
372
+ <i>
373
+ <a href='#ISO712'>word</a>
374
+ </i>
375
+ </li>
376
+ <li>
377
+ <i>
378
+ <a href='#ISO712'> ISO 712, Clause 3.1, Figure a </a>
379
+ </i>
380
+ </li>
381
+ <li>
382
+ <i>
383
+ <a href='#ISO712'> ISO 712, Clause 3.1; Figure b </a>
384
+ </i>
385
+ </li>
386
+ <li>
387
+ <i>
388
+ <a href='#ISO712'>
389
+ <i>word</i>
390
+ </a>
391
+ </i>
392
+ </li>
393
+ <li> [term defined in Termbase IEV, term ID 135-13-13 ] </li>
394
+ <li>
395
+ <i> Termbase IEV, term ID 135-13-13 </i>
396
+ </li>
397
+ </ul>
398
+ </p>
399
+ </div>
400
+ <p class='zzSTDTitle1'/>
401
+ <div>
402
+ <h1> 1. &#160; Normative References </h1>
403
+ <p>
404
+ The following documents are referred to in the text in such a way
405
+ that some or all of their content constitutes requirements of this
406
+ document. For dated references, only the edition cited applies. For
407
+ undated references, the latest edition of the referenced document
408
+ (including any amendments) applies.
409
+ </p>
410
+ <p id='ISO712' class='NormRef'>
411
+ ISO 712,
412
+ <i>Cereals and cereal products</i>
413
+ </p>
414
+ </div>
415
+ <div id='clause1'>
416
+ <h1> 2. &#160; Clause 1 </h1>
417
+ </div>
418
+ </div>
419
+ </body>
420
+ </html>
421
+ OUTPUT
422
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
423
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
424
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
425
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
426
+ end
357
427
 
358
428
  it "processes embedded inline formatting" do
359
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
360
- <iso-standard xmlns="http://riboseinc.com/isoxml">
361
- <preface><foreword>
362
- <p>
363
- <em><strong>&lt;</strong></em> <tt><link target="B"/></tt> <xref target="_http_1_1">Requirement <tt>/req/core/http</tt></xref> <eref type="inline" bibitemid="ISO712" citeas="ISO 712">Requirement <tt>/req/core/http</tt></eref>
364
- </p>
365
- </foreword></preface>
366
- <sections>
367
- </iso-standard>
429
+ input = <<~INPUT
430
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
431
+ <preface><foreword>
432
+ <p>
433
+ <em><strong>&lt;</strong></em> <tt><link target="B"/></tt> <xref target="_http_1_1">Requirement <tt>/req/core/http</tt></xref> <eref type="inline" bibitemid="ISO712" citeas="ISO 712">Requirement <tt>/req/core/http</tt></eref>
434
+ </p>
435
+ </foreword></preface>
436
+ <sections>
437
+ </iso-standard>
368
438
  INPUT
369
- #{HTML_HDR}
370
- <br/>
371
- <div>
372
- <h1 class="ForewordTitle">Foreword</h1>
373
- <p>
374
- <i><b>&lt;</b></i> <tt><a href="B">B</a></tt> <a href="#_http_1_1">Requirement <tt>/req/core/http</tt></a> <a href="#ISO712">Requirement <tt>/req/core/http</tt></a>
375
- </p>
439
+ output = <<~OUTPUT
440
+ #{HTML_HDR}
441
+ <br/>
442
+ <div>
443
+ <h1 class="ForewordTitle">Foreword</h1>
444
+ <p>
445
+ <i><b>&lt;</b></i> <tt><a href="B">B</a></tt> <a href="#_http_1_1">Requirement <tt>/req/core/http</tt></a> <a href="#ISO712">Requirement <tt>/req/core/http</tt></a>
446
+ </p>
447
+ </div>
448
+ <p class="zzSTDTitle1"/>
376
449
  </div>
377
- <p class="zzSTDTitle1"/>
378
- </div>
379
- </body>
380
- </html>
450
+ </body>
451
+ </html>
381
452
  OUTPUT
453
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
454
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
382
455
  end
383
456
 
384
457
  it "processes inline images" do
385
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
386
- <iso-standard xmlns="http://riboseinc.com/isoxml">
387
- <preface><foreword>
388
- <p>
389
- <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
390
- </p>
391
- </foreword></preface>
392
- </iso-standard>
393
- INPUT
394
- #{HTML_HDR}
395
- <br/>
396
- <div>
397
- <h1 class='ForewordTitle'>Foreword</h1>
458
+ input = <<~INPUT
459
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
460
+ <preface><foreword>
398
461
  <p>
399
- <img src='rice_images/rice_image1.png' height='20' width='30' title='titletxt' alt='alttext'/>
400
- </p>
401
- </div>
402
- <p class='zzSTDTitle1'/>
403
- </div>
404
- </body>
405
- </html>
406
- OUTPUT
462
+ <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
463
+ </p>
464
+ </foreword></preface>
465
+ </iso-standard>
466
+ INPUT
467
+ output = <<~OUTPUT
468
+ #{HTML_HDR}
469
+ <br/>
470
+ <div>
471
+ <h1 class='ForewordTitle'>Foreword</h1>
472
+ <p>
473
+ <img src='rice_images/rice_image1.png' height='20' width='30' title='titletxt' alt='alttext'/>
474
+ </p>
475
+ </div>
476
+ <p class='zzSTDTitle1'/>
477
+ </div>
478
+ </body>
479
+ </html>
480
+ OUTPUT
481
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
482
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
407
483
  end
408
484
 
409
485
  it "processes links" do
410
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
411
- <iso-standard xmlns="http://riboseinc.com/isoxml">
412
- <preface><foreword>
413
- <p>
414
- <link target="http://example.com"/>
415
- <link target="http://example.com">example</link>
416
- <link target="http://example.com" alt="tip">example</link>
417
- <link target="mailto:fred@example.com"/>
418
- <link target="mailto:fred@example.com">mailto:fred@example.com</link>
419
- </p>
420
- </foreword></preface>
421
- <sections>
422
- </iso-standard>
486
+ input = <<~INPUT
487
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
488
+ <preface><foreword>
489
+ <p>
490
+ <link target="http://example.com"/>
491
+ <link target="http://example.com">example</link>
492
+ <link target="http://example.com" alt="tip">example</link>
493
+ <link target="mailto:fred@example.com"/>
494
+ <link target="mailto:fred@example.com">mailto:fred@example.com</link>
495
+ </p>
496
+ </foreword></preface>
497
+ <sections>
498
+ </iso-standard>
423
499
  INPUT
424
- #{HTML_HDR}
425
- <br/>
426
- <div>
427
- <h1 class="ForewordTitle">Foreword</h1>
428
- <p>
429
- <a href="http://example.com">http://example.com</a>
430
- <a href="http://example.com">example</a>
431
- <a href="http://example.com" title="tip">example</a>
432
- <a href="mailto:fred@example.com">fred@example.com</a>
433
- <a href="mailto:fred@example.com">mailto:fred@example.com</a>
434
- </p>
500
+ output = <<~OUTPUT
501
+ #{HTML_HDR}
502
+ <br/>
503
+ <div>
504
+ <h1 class="ForewordTitle">Foreword</h1>
505
+ <p>
506
+ <a href="http://example.com">http://example.com</a>
507
+ <a href="http://example.com">example</a>
508
+ <a href="http://example.com" title="tip">example</a>
509
+ <a href="mailto:fred@example.com">fred@example.com</a>
510
+ <a href="mailto:fred@example.com">mailto:fred@example.com</a>
511
+ </p>
512
+ </div>
513
+ <p class="zzSTDTitle1"/>
435
514
  </div>
436
- <p class="zzSTDTitle1"/>
437
- </div>
438
- </body>
439
- </html>
515
+ </body>
516
+ </html>
440
517
  OUTPUT
518
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
519
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
520
+ end
521
+
522
+ it "processes updatetype links" do
523
+ input = <<~INPUT
524
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
525
+ <preface><foreword>
526
+ <p>
527
+ <link updatetype="true" target="http://example.com"/>
528
+ <link updatetype="true" target="list.adoc">example</link>
529
+ <link updatetype="true" target="list" alt="tip">example</link>
530
+ </p>
531
+ </foreword></preface>
532
+ <sections>
533
+ </iso-standard>
534
+ INPUT
535
+ html = <<~OUTPUT
536
+ <div>
537
+ <h1 class="ForewordTitle">Foreword</h1>
538
+ <p>
539
+ <a href="http://example.com">http://example.com</a>
540
+ <a href='list.adoc'>example</a>
541
+ <a href='list.html' title='tip'>example</a>
542
+ </p>
543
+ </div>
544
+ OUTPUT
545
+ doc = <<~OUTPUT
546
+ <div>
547
+ <h1 class="ForewordTitle">Foreword</h1>
548
+ <p>
549
+ <a href="http://example.com">http://example.com</a>
550
+ <a href='list.adoc'>example</a>
551
+ <a href='list.doc' title='tip'>example</a>
552
+ </p>
553
+ </div>
554
+ OUTPUT
555
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
556
+ .convert("test", input, true))
557
+ .sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
558
+ .to be_equivalent_to xmlpp(html)
559
+ expect(xmlpp(IsoDoc::WordConvert.new({})
560
+ .convert("test", input, true))
561
+ .sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
562
+ .to be_equivalent_to xmlpp(doc)
441
563
  end
442
564
 
443
565
  it "processes unrecognised markup" do
444
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
445
- <iso-standard xmlns="http://riboseinc.com/isoxml">
446
- <preface><foreword>
447
- <p>
448
- <barry fred="http://example.com">example</barry>
449
- </p>
450
- </foreword></preface>
451
- <sections>
452
- </iso-standard>
566
+ input = <<~INPUT
567
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
568
+ <preface><foreword>
569
+ <p>
570
+ <barry fred="http://example.com">example</barry>
571
+ </p>
572
+ </foreword></preface>
573
+ <sections>
574
+ </iso-standard>
453
575
  INPUT
454
- #{HTML_HDR}
455
- <br/>
456
- <div>
457
- <h1 class="ForewordTitle">Foreword</h1>
458
- <p>
459
- <para><b role="strong">&lt;barry fred="http://example.com"&gt;example&lt;/barry&gt;</b></para>
460
- </p>
576
+ output = <<~OUTPUT
577
+ #{HTML_HDR}
578
+ <br/>
579
+ <div>
580
+ <h1 class="ForewordTitle">Foreword</h1>
581
+ <p>
582
+ <para><b role="strong">&lt;barry fred="http://example.com"&gt;example&lt;/barry&gt;</b></para>
583
+ </p>
584
+ </div>
585
+ <p class="zzSTDTitle1"/>
461
586
  </div>
462
- <p class="zzSTDTitle1"/>
463
- </div>
464
- </body>
465
- </html>
587
+ </body>
588
+ </html>
466
589
  OUTPUT
590
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
591
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
467
592
  end
468
593
 
469
594
  it "processes AsciiMath and MathML" do
470
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true).sub(/<html/, "<html xmlns:m='m'"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
471
- <iso-standard xmlns="http://riboseinc.com/isoxml">
472
- <preface><foreword>
473
- <p>
474
- <stem type="AsciiMath">&lt;A&gt;</stem>
475
- <stem type="MathML"><m:math><m:row>X</m:row></m:math></stem>
476
- <stem type="None">Latex?</stem>
477
- </p>
478
- </foreword></preface>
479
- <sections>
480
- </iso-standard>
595
+ input = <<~INPUT
596
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
597
+ <preface><foreword>
598
+ <p>
599
+ <stem type="AsciiMath">&lt;A&gt;</stem>
600
+ <stem type="MathML"><m:math><m:row>X</m:row></m:math></stem>
601
+ <stem type="None">Latex?</stem>
602
+ </p>
603
+ </foreword></preface>
604
+ <sections>
605
+ </iso-standard>
481
606
  INPUT
482
- #{HTML_HDR.sub(/<html/, "<html xmlns:m='m'")}
483
- <br/>
484
- <div>
485
- <h1 class="ForewordTitle">Foreword</h1>
486
- <p>
487
- <span class="stem">(#(&lt;A&gt;)#)</span>
488
- <span class="stem"><m:math>
489
- <m:row>X</m:row>
490
- </m:math></span>
491
- <span class="stem">Latex?</span>
492
- </p>
607
+ output = <<~OUTPUT
608
+ #{HTML_HDR.sub(/<html/, "<html xmlns:m='m'")}
609
+ <br/>
610
+ <div>
611
+ <h1 class="ForewordTitle">Foreword</h1>
612
+ <p>
613
+ <span class="stem">(#(&lt;A&gt;)#)</span>
614
+ <span class="stem"><m:math>
615
+ <m:row>X</m:row>
616
+ </m:math></span>
617
+ <span class="stem">Latex?</span>
618
+ </p>
619
+ </div>
620
+ <p class="zzSTDTitle1"/>
493
621
  </div>
494
- <p class="zzSTDTitle1"/>
495
- </div>
496
- </body>
497
- </html>
622
+ </body>
623
+ </html>
498
624
  OUTPUT
625
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
626
+ .convert("test", input, true).sub(/<html/, "<html xmlns:m='m'")))
627
+ .to be_equivalent_to xmlpp(output)
499
628
  end
500
629
 
501
630
  it "overrides AsciiMath delimiters" do
502
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
503
- <iso-standard xmlns="http://riboseinc.com/isoxml">
504
- <preface><foreword>
505
- <p>
506
- <stem type="AsciiMath">A</stem>
507
- (#((Hello))#)
508
- </p>
509
- </foreword></preface>
510
- <sections>
511
- </iso-standard>
631
+ input = <<~INPUT
632
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
633
+ <preface><foreword>
634
+ <p>
635
+ <stem type="AsciiMath">A</stem>
636
+ (#((Hello))#)
637
+ </p>
638
+ </foreword></preface>
639
+ <sections>
640
+ </iso-standard>
512
641
  INPUT
513
- #{HTML_HDR}
514
- <br/>
515
- <div>
516
- <h1 class="ForewordTitle">Foreword</h1>
517
- <p>
518
- <span class="stem">(#(((A)#)))</span>
519
- (#((Hello))#)
520
- </p>
642
+ output = <<~OUTPUT
643
+ #{HTML_HDR}
644
+ <br/>
645
+ <div>
646
+ <h1 class="ForewordTitle">Foreword</h1>
647
+ <p>
648
+ <span class="stem">(#(((A)#)))</span>
649
+ (#((Hello))#)
650
+ </p>
651
+ </div>
652
+ <p class="zzSTDTitle1"/>
521
653
  </div>
522
- <p class="zzSTDTitle1"/>
523
- </div>
524
- </body>
525
- </html>
654
+ </body>
655
+ </html>
526
656
  OUTPUT
657
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
658
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
527
659
  end
528
660
 
529
661
  it "processes eref types" do
530
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
531
- <iso-standard xmlns="http://riboseinc.com/isoxml">
532
- <preface><foreword>
533
- <p>
534
- <eref type="footnote" bibitemid="ISO712" citeas="ISO 712">A</stem>
535
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</stem>
536
- </p>
537
- </foreword></preface>
538
- <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
539
- <bibitem id="ISO712" type="standard">
540
- <title format="text/plain">Cereals and cereal products</title>
541
- <docidentifier>ISO 712</docidentifier>
542
- <contributor>
543
- <role type="publisher"/>
544
- <organization>
545
- <abbreviation>ISO</abbreviation>
546
- </organization>
547
- </contributor>
548
- </bibitem>
549
- </references>
550
- </bibliography>
551
- </iso-standard>
662
+ input = <<~INPUT
663
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
664
+ <preface><foreword>
665
+ <p>
666
+ <eref type="footnote" bibitemid="ISO712" citeas="ISO 712">A</stem>
667
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</stem>
668
+ </p>
669
+ </foreword></preface>
670
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
671
+ <bibitem id="ISO712" type="standard">
672
+ <title format="text/plain">Cereals and cereal products</title>
673
+ <docidentifier>ISO 712</docidentifier>
674
+ <contributor>
675
+ <role type="publisher"/>
676
+ <organization>
677
+ <abbreviation>ISO</abbreviation>
678
+ </organization>
679
+ </contributor>
680
+ </bibitem>
681
+ </references>
682
+ </bibliography>
683
+ </iso-standard>
552
684
  INPUT
553
- #{HTML_HDR}
554
- <br/>
555
- <div>
556
- <h1 class="ForewordTitle">Foreword</h1>
557
- <p>
558
- <sup><a href="#ISO712">A</a></sup>
559
- <a href="#ISO712">A</a>
560
- </p>
561
- </div>
562
- <p class="zzSTDTitle1"/>
563
- <div>
564
- <h1>Normative References</h1>
565
- <p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
685
+ output = <<~OUTPUT
686
+ #{HTML_HDR}
687
+ <br/>
688
+ <div>
689
+ <h1 class="ForewordTitle">Foreword</h1>
690
+ <p>
691
+ <sup><a href="#ISO712">A</a></sup>
692
+ <a href="#ISO712">A</a>
693
+ </p>
694
+ </div>
695
+ <p class="zzSTDTitle1"/>
696
+ <div>
697
+ <h1>Normative References</h1>
698
+ <p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i></p>
699
+ </div>
566
700
  </div>
567
- </div>
568
- </body>
569
- </html>
701
+ </body>
702
+ </html>
570
703
  OUTPUT
704
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
705
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
571
706
  end
572
707
 
573
708
  it "processes eref content" do
574
709
  input = <<~INPUT
575
- <iso-standard xmlns="http://riboseinc.com/isoxml">
576
- <preface><foreword>
577
- <p>
578
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
579
- <eref type="inline" bibitemid="ISO712"/>
580
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
581
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
582
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
583
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
584
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
585
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
586
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
587
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
588
- <eref type="inline" bibitemid="ISO712"><locality type="whole"></locality></eref>
589
- <eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
590
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
591
- <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality></eref>
592
- <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
593
- <eref type="inline" droploc="true" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
594
- <eref type="inline" case="lowercase" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
595
- </p>
596
- </foreword></preface>
597
- <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
598
- <bibitem id="ISO712" type="standard">
599
- <title format="text/plain">Cereals and cereal products</title>
600
- <docidentifier>ISO 712</docidentifier>
601
- <contributor>
602
- <role type="publisher"/>
603
- <organization>
604
- <abbreviation>ISO</abbreviation>
605
- </organization>
606
- </contributor>
607
- </bibitem>
608
- </references>
609
- </bibliography>
610
- </iso-standard>
710
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
711
+ <preface><foreword>
712
+ <p>
713
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
714
+ <eref type="inline" bibitemid="ISO712"/>
715
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
716
+ <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
717
+ <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
718
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
719
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
720
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
721
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
722
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
723
+ <eref type="inline" bibitemid="ISO712"><locality type="whole"></locality></eref>
724
+ <eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
725
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
726
+ <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality></eref>
727
+ <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
728
+ <eref type="inline" droploc="true" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
729
+ <eref type="inline" case="lowercase" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
730
+ </p>
731
+ </foreword></preface>
732
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
733
+ <bibitem id="ISO712" type="standard">
734
+ <title format="text/plain">Cereals and cereal products</title>
735
+ <docidentifier>ISO 712</docidentifier>
736
+ <contributor>
737
+ <role type="publisher"/>
738
+ <organization>
739
+ <abbreviation>ISO</abbreviation>
740
+ </organization>
741
+ </contributor>
742
+ </bibitem>
743
+ </references>
744
+ </bibliography>
745
+ </iso-standard>
611
746
  INPUT
612
747
  presxml = <<~OUTPUT
613
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
614
- <preface><foreword>
615
- <p>
616
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
617
- <eref type="inline" bibitemid="ISO712">ISO 712</eref>
618
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Table 1</eref>
619
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1</eref>
620
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1; Clause 1</eref>
621
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Table 1&#x2013;1</eref>
622
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1, Table 1</eref>
623
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
624
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality>ISO 712, Clause 1.5</eref>
625
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
626
- <eref type="inline" bibitemid="ISO712"><locality type="whole"/>ISO 712, Whole of text</eref>
627
- <eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality>ISO 712, Prelude 7</eref>
628
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
629
- <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality>ISO 712</eref>
630
- <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
631
- <eref type="inline" droploc="true" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, 1</eref>
632
- <eref type="inline" case="lowercase" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, clause 1</eref>
633
- </p>
634
- </foreword></preface>
635
- <bibliography><references id="_normative_references" obligation="informative" normative="true"><title depth='1'>1.<tab/>Normative References</title>
636
- <bibitem id="ISO712" type="standard">
637
- <title format="text/plain">Cereals and cereal products</title>
638
- <docidentifier>ISO 712</docidentifier>
639
- <contributor>
640
- <role type="publisher"/>
641
- <organization>
642
- <abbreviation>ISO</abbreviation>
643
- </organization>
644
- </contributor>
645
- </bibitem>
646
- </references>
647
- </bibliography>
648
- </iso-standard>
649
- OUTPUT
748
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
749
+ <preface><foreword displayorder="1">
750
+ <p>
751
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
752
+ <eref type="inline" bibitemid="ISO712">ISO 712</eref>
753
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Table 1</eref>
754
+ <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1</eref>
755
+ <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1; Clause 1</eref>
756
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Table 1&#x2013;1</eref>
757
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1, Table 1</eref>
758
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
759
+ <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality>ISO 712, Clause 1.5</eref>
760
+ <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
761
+ <eref type="inline" bibitemid="ISO712"><locality type="whole"/>ISO 712, Whole of text</eref>
762
+ <eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality>ISO 712, Prelude 7</eref>
763
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
764
+ <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality>ISO 712</eref>
765
+ <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
766
+ <eref type="inline" droploc="true" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, 1</eref>
767
+ <eref type="inline" case="lowercase" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, clause 1</eref>
768
+ </p>
769
+ </foreword></preface>
770
+ <bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder=
771
+ "2"><title depth='1'>1.<tab/>Normative References</title>
772
+ <bibitem id="ISO712" type="standard">
773
+ <title format="text/plain">Cereals and cereal products</title>
774
+ <docidentifier>ISO 712</docidentifier>
775
+ <contributor>
776
+ <role type="publisher"/>
777
+ <organization>
778
+ <abbreviation>ISO</abbreviation>
779
+ </organization>
780
+ </contributor>
781
+ </bibitem>
782
+ </references>
783
+ </bibliography>
784
+ </iso-standard>
785
+ OUTPUT
650
786
 
651
- html = <<~OUTPUT
652
- #{HTML_HDR}
653
- <br/>
654
- <div>
655
- <h1 class="ForewordTitle">Foreword</h1>
656
- <p>
657
- <a href="#ISO712">ISO 712</a>
658
- <a href="#ISO712">ISO 712</a>
659
- <a href="#ISO712">ISO 712, Table 1</a>
660
- <a href='#ISO712'>ISO 712, Table 1</a>
661
- <a href='#ISO712'>ISO 712, Table 1; Clause 1</a>
662
- <a href="#ISO712">ISO 712, Table 1&#8211;1</a>
663
- <a href="#ISO712">ISO 712, Clause 1, Table 1</a>
664
- <a href="#ISO712">ISO 712, Clause 1</a>
665
- <a href="#ISO712">ISO 712, Clause 1.5</a>
666
- <a href="#ISO712">A</a>
667
- <a href="#ISO712">ISO 712, Whole of text</a>
668
- <a href="#ISO712">ISO 712, Prelude 7</a>
669
- <a href="#ISO712">A</a>
670
- <a href='#ISO712'>ISO 712</a>
671
- <a href='#ISO712'>ISO 712, Clause 1</a>
672
- <a href='#ISO712'>ISO 712, 1</a>
673
- <a href='#ISO712'>ISO 712, clause 1</a>
674
- </p>
675
- </div>
676
- <p class="zzSTDTitle1"/>
677
- <div>
678
- <h1>1.&#160; Normative References</h1>
679
- <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
680
- </div>
681
- </div>
682
- </body>
683
- </html>
787
+ html = <<~OUTPUT
788
+ #{HTML_HDR}
789
+ <br/>
790
+ <div>
791
+ <h1 class="ForewordTitle">Foreword</h1>
792
+ <p>
793
+ <a href="#ISO712">ISO 712</a>
794
+ <a href="#ISO712">ISO 712</a>
795
+ <a href="#ISO712">ISO 712, Table 1</a>
796
+ <a href='#ISO712'>ISO 712, Table 1</a>
797
+ <a href='#ISO712'>ISO 712, Table 1; Clause 1</a>
798
+ <a href="#ISO712">ISO 712, Table 1&#8211;1</a>
799
+ <a href="#ISO712">ISO 712, Clause 1, Table 1</a>
800
+ <a href="#ISO712">ISO 712, Clause 1</a>
801
+ <a href="#ISO712">ISO 712, Clause 1.5</a>
802
+ <a href="#ISO712">A</a>
803
+ <a href="#ISO712">ISO 712, Whole of text</a>
804
+ <a href="#ISO712">ISO 712, Prelude 7</a>
805
+ <a href="#ISO712">A</a>
806
+ <a href='#ISO712'>ISO 712</a>
807
+ <a href='#ISO712'>ISO 712, Clause 1</a>
808
+ <a href='#ISO712'>ISO 712, 1</a>
809
+ <a href='#ISO712'>ISO 712, clause 1</a>
810
+ </p>
811
+ </div>
812
+ <p class="zzSTDTitle1"/>
813
+ <div>
814
+ <h1>1.&#160; Normative References</h1>
815
+ <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
816
+ </div>
817
+ </div>
818
+ </body>
819
+ </html>
684
820
  OUTPUT
685
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
686
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
821
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
822
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
823
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
824
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
687
825
  end
688
826
 
689
- it "processes eref content pointing to reference with citation URL" do
690
- input = <<~INPUT
691
- <iso-standard xmlns="http://riboseinc.com/isoxml">
692
- <preface><foreword>
693
- <p>
694
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
695
- <eref type="inline" bibitemid="ISO712"/>
696
- <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
697
- <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
698
- <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
699
- <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
700
- <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
701
- <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
702
- <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
703
- <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
704
- <eref type="inline" bibitemid="ISO713"><locality type="whole"></locality></eref>
705
- <eref type="inline" bibitemid="ISO713"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
706
- <eref type="inline" bibitemid="ISO713" citeas="ISO 713">A</eref>
707
- <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality></eref>
708
- <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
709
- </p>
710
- </foreword></preface>
711
- <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
712
- <bibitem id="ISO712" type="standard">
713
- <title format="text/plain">Cereals and cereal products</title>
714
- <uri type="citation">http://www.example.com</uri>
715
- <docidentifier>ISO 712</docidentifier>
716
- <contributor>
717
- <role type="publisher"/>
718
- <organization>
719
- <abbreviation>ISO</abbreviation>
720
- </organization>
721
- </contributor>
722
- </bibitem>
723
- <bibitem id="ISO713" type="standard">
724
- <title format="text/plain">Cereals and cereal products</title>
725
- <uri type="citation">spec/assets/iso713</uri>
726
- <docidentifier>ISO 713</docidentifier>
727
- <contributor>
728
- <role type="publisher"/>
729
- <organization>
730
- <abbreviation>ISO</abbreviation>
731
- </organization>
732
- </contributor>
733
- </bibitem>
734
- </references>
735
- </bibliography>
736
- </iso-standard>
827
+ it "processes eref content pointing to reference with citation URL" do
828
+ input = <<~INPUT
829
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
830
+ <preface><foreword>
831
+ <p>
832
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
833
+ <eref type="inline" bibitemid="ISO712"/>
834
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
835
+ <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
836
+ <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
837
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
838
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
839
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
840
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
841
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
842
+ <eref type="inline" bibitemid="ISO713"><locality type="whole"></locality></eref>
843
+ <eref type="inline" bibitemid="ISO713"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
844
+ <eref type="inline" bibitemid="ISO713" citeas="ISO 713">A</eref>
845
+ <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality></eref>
846
+ <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
847
+ <eref type="inline" bibitemid="ISO714"/>
848
+ </p>
849
+ </foreword></preface>
850
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
851
+ <bibitem id="ISO712" type="standard">
852
+ <title format="text/plain">Cereals and cereal products</title>
853
+ <uri type="citation">http://www.example.com</uri>
854
+ <docidentifier>ISO 712</docidentifier>
855
+ <contributor>
856
+ <role type="publisher"/>
857
+ <organization>
858
+ <abbreviation>ISO</abbreviation>
859
+ </organization>
860
+ </contributor>
861
+ </bibitem>
862
+ <bibitem id="ISO713" type="standard">
863
+ <title format="text/plain">Cereals and cereal products</title>
864
+ <uri type="citation">spec/assets/iso713</uri>
865
+ <docidentifier>ISO 713</docidentifier>
866
+ <contributor>
867
+ <role type="publisher"/>
868
+ <organization>
869
+ <abbreviation>ISO</abbreviation>
870
+ </organization>
871
+ </contributor>
872
+ </bibitem>
873
+ <bibitem id="ISO714" type="standard">
874
+ <title format="text/plain">Cereals and cereal products</title>
875
+ <uri type="citation">spec/assets/iso714.svg</uri>
876
+ <docidentifier>ISO 714</docidentifier>
877
+ <contributor>
878
+ <role type="publisher"/>
879
+ <organization>
880
+ <abbreviation>ISO</abbreviation>
881
+ </organization>
882
+ </contributor>
883
+ </bibitem>
884
+ </references>
885
+ </bibliography>
886
+ </iso-standard>
737
887
  INPUT
738
888
  presxml = <<~OUTPUT
739
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
740
- <preface>
741
- <foreword>
742
- <p>
743
- <eref type='inline' bibitemid='ISO712' citeas='ISO 712'>ISO 712</eref>
744
- <eref type='inline' bibitemid='ISO712'>ISO 712</eref>
745
- <eref type='inline' bibitemid='ISO713'><locality type='table'>
746
- <referenceFrom>1</referenceFrom>
747
- </locality>ISO 713, Table 1</eref>
748
- <eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1</eref>
749
- <eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type='clause'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1; Clause 1</eref>
750
- <eref type='inline' bibitemid='ISO713'><locality type='table'>
751
- <referenceFrom>1</referenceFrom>
752
- <referenceTo>1</referenceTo>
753
- </locality>ISO 713, Table 1&#x2013;1</eref>
754
- <eref type='inline' bibitemid='ISO713'><locality type='clause'><referenceFrom>1</referenceFrom></locality><locality type='table'><referenceFrom>1</referenceFrom></locality>ISO 713, Clause 1, Table 1</eref>
755
- <eref type='inline' bibitemid='ISO713'><locality type='clause'>
756
- <referenceFrom>1</referenceFrom>
757
- </locality>ISO 713, Clause 1</eref>
758
- <eref type='inline' bibitemid='ISO713'><locality type='clause'>
759
- <referenceFrom>1.5</referenceFrom>
760
- </locality>ISO 713, Clause 1.5</eref>
761
- <eref type='inline' bibitemid='ISO713'><locality type='table'>
762
- <referenceFrom>1</referenceFrom>
763
- </locality>A</eref>
764
- <eref type='inline' bibitemid='ISO713'><locality type='whole'/>ISO 713, Whole of text</eref>
765
- <eref type='inline' bibitemid='ISO713'><locality type='locality:prelude'>
766
- <referenceFrom>7</referenceFrom>
767
- </locality>ISO 713, Prelude 7</eref>
768
- <eref type='inline' bibitemid='ISO713' citeas='ISO 713'>A</eref>
769
- <eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality>ISO 713</eref>
770
- <eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality><locality type='clause'><referenceFrom>1</referenceFrom></locality>ISO 713, Clause 1</eref>
771
- </p>
772
- </foreword>
773
- </preface>
774
- <bibliography>
775
- <references id='_normative_references' obligation='informative' normative='true'>
776
- <title depth='1'>1.<tab/>Normative References</title>
777
- <bibitem id='ISO712' type='standard'>
778
- <title format='text/plain'>Cereals and cereal products</title>
779
- <uri type='citation'>http://www.example.com</uri>
780
- <docidentifier>ISO 712</docidentifier>
781
- <contributor>
782
- <role type='publisher'/>
783
- <organization>
784
- <abbreviation>ISO</abbreviation>
785
- </organization>
786
- </contributor>
787
- </bibitem>
788
- <bibitem id='ISO713' type='standard'>
889
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
890
+ <preface>
891
+ <foreword displayorder="1">
892
+ <p>
893
+ <eref type='inline' bibitemid='ISO712' citeas='ISO 712'>ISO 712</eref>
894
+ <eref type='inline' bibitemid='ISO712'>ISO 712</eref>
895
+ <eref type='inline' bibitemid='ISO713'><locality type='table'>
896
+ <referenceFrom>1</referenceFrom>
897
+ </locality>ISO 713, Table 1</eref>
898
+ <eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1</eref>
899
+ <eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type='clause'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1; Clause 1</eref>
900
+ <eref type='inline' bibitemid='ISO713'><locality type='table'>
901
+ <referenceFrom>1</referenceFrom>
902
+ <referenceTo>1</referenceTo>
903
+ </locality>ISO 713, Table 1&#x2013;1</eref>
904
+ <eref type='inline' bibitemid='ISO713'><locality type='clause'><referenceFrom>1</referenceFrom></locality><locality type='table'><referenceFrom>1</referenceFrom></locality>ISO 713, Clause 1, Table 1</eref>
905
+ <eref type='inline' bibitemid='ISO713'><locality type='clause'>
906
+ <referenceFrom>1</referenceFrom>
907
+ </locality>ISO 713, Clause 1</eref>
908
+ <eref type='inline' bibitemid='ISO713'><locality type='clause'>
909
+ <referenceFrom>1.5</referenceFrom>
910
+ </locality>ISO 713, Clause 1.5</eref>
911
+ <eref type='inline' bibitemid='ISO713'><locality type='table'>
912
+ <referenceFrom>1</referenceFrom>
913
+ </locality>A</eref>
914
+ <eref type='inline' bibitemid='ISO713'><locality type='whole'/>ISO 713, Whole of text</eref>
915
+ <eref type='inline' bibitemid='ISO713'><locality type='locality:prelude'>
916
+ <referenceFrom>7</referenceFrom>
917
+ </locality>ISO 713, Prelude 7</eref>
918
+ <eref type='inline' bibitemid='ISO713' citeas='ISO 713'>A</eref>
919
+ <eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality>ISO 713</eref>
920
+ <eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality><locality type='clause'><referenceFrom>1</referenceFrom></locality>ISO 713, Clause 1</eref>
921
+ <eref type='inline' bibitemid='ISO714'>ISO 714</eref>
922
+ </p>
923
+ </foreword>
924
+ </preface>
925
+ <bibliography>
926
+ <references id='_normative_references' obligation='informative' normative='true' displayorder="2">
927
+ <title depth='1'>1.<tab/>Normative References</title>
928
+ <bibitem id='ISO712' type='standard'>
929
+ <title format='text/plain'>Cereals and cereal products</title>
930
+ <uri type='citation'>http://www.example.com</uri>
931
+ <docidentifier>ISO 712</docidentifier>
932
+ <contributor>
933
+ <role type='publisher'/>
934
+ <organization>
935
+ <abbreviation>ISO</abbreviation>
936
+ </organization>
937
+ </contributor>
938
+ </bibitem>
939
+ <bibitem id='ISO713' type='standard'>
940
+ <title format='text/plain'>Cereals and cereal products</title>
941
+ <uri type='citation'>spec/assets/iso713</uri>
942
+ <docidentifier>ISO 713</docidentifier>
943
+ <contributor>
944
+ <role type='publisher'/>
945
+ <organization>
946
+ <abbreviation>ISO</abbreviation>
947
+ </organization>
948
+ </contributor>
949
+ </bibitem>
950
+ <bibitem id='ISO714' type='standard'>
789
951
  <title format='text/plain'>Cereals and cereal products</title>
790
- <uri type='citation'>spec/assets/iso713</uri>
791
- <docidentifier>ISO 713</docidentifier>
952
+ <uri type='citation'>spec/assets/iso714.svg</uri>
953
+ <docidentifier>ISO 714</docidentifier>
792
954
  <contributor>
793
955
  <role type='publisher'/>
794
956
  <organization>
@@ -796,241 +958,263 @@ html = <<~OUTPUT
796
958
  </organization>
797
959
  </contributor>
798
960
  </bibitem>
799
- </references>
800
- </bibliography>
801
- </iso-standard>
802
- OUTPUT
961
+ </references>
962
+ </bibliography>
963
+ </iso-standard>
964
+ OUTPUT
803
965
 
804
966
  html = <<~OUTPUT
805
- #{HTML_HDR}
806
- <br/>
807
- <div>
808
- <h1 class='ForewordTitle'>Foreword</h1>
809
- <p>
810
- <a href='http://www.example.com'>ISO 712</a>
811
- <a href='http://www.example.com'>ISO 712</a>
812
- <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
813
- <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
814
- <a href='spec/assets/iso713.html'>ISO 713, Table 1; Clause 1</a>
815
- <a href='spec/assets/iso713.html'>ISO 713, Table 1&#8211;1</a>
816
- <a href='spec/assets/iso713.html'>ISO 713, Clause 1, Table 1</a>
817
- <a href='spec/assets/iso713.html'>ISO 713, Clause 1</a>
818
- <a href='spec/assets/iso713.html'>ISO 713, Clause 1.5</a>
819
- <a href='spec/assets/iso713.html'>A</a>
820
- <a href='spec/assets/iso713.html'>ISO 713, Whole of text</a>
821
- <a href='spec/assets/iso713.html'>ISO 713, Prelude 7</a>
822
- <a href='spec/assets/iso713.html'>A</a>
823
- <a href='spec/assets/iso713.html#xyz'>ISO 713</a>
824
- <a href='spec/assets/iso713.html#xyz'>ISO 713, Clause 1</a>
825
- </p>
826
- </div>
827
- <p class='zzSTDTitle1'/>
828
- <div>
829
- <h1>1.&#160; Normative References</h1>
830
- <p id='ISO712' class='NormRef'>
831
- ISO 712,
832
- <i>Cereals and cereal products</i>
833
- </p>
834
- <p id='ISO713' class='NormRef'>
835
- ISO 713,
836
- <i>Cereals and cereal products</i>
837
- </p>
838
- </div>
839
- </div>
840
- </body>
841
- </html>
842
- OUTPUT
843
-
844
- word = <<~OUTPUT
845
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
846
- <head>
847
- <style>
848
- </style>
849
- </head>
850
- <body lang='EN-US' link='blue' vlink='#954F72'>
851
- <div class='WordSection1'>
852
- <p>&#160;</p>
853
- </div>
854
- <p>
855
- <br clear='all' class='section'/>
856
- </p>
857
- <div class='WordSection2'>
858
- <p>
859
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
967
+ #{HTML_HDR}
968
+ <br/>
969
+ <div>
970
+ <h1 class='ForewordTitle'>Foreword</h1>
971
+ <p>
972
+ <a href='http://www.example.com'>ISO 712</a>
973
+ <a href='http://www.example.com'>ISO 712</a>
974
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
975
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
976
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1; Clause 1</a>
977
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1&#8211;1</a>
978
+ <a href='spec/assets/iso713.html'>ISO 713, Clause 1, Table 1</a>
979
+ <a href='spec/assets/iso713.html'>ISO 713, Clause 1</a>
980
+ <a href='spec/assets/iso713.html'>ISO 713, Clause 1.5</a>
981
+ <a href='spec/assets/iso713.html'>A</a>
982
+ <a href='spec/assets/iso713.html'>ISO 713, Whole of text</a>
983
+ <a href='spec/assets/iso713.html'>ISO 713, Prelude 7</a>
984
+ <a href='spec/assets/iso713.html'>A</a>
985
+ <a href='spec/assets/iso713.html#xyz'>ISO 713</a>
986
+ <a href='spec/assets/iso713.html#xyz'>ISO 713, Clause 1</a>
987
+ <a href='spec/assets/iso714.svg'>ISO 714</a>
988
+ </p>
989
+ </div>
990
+ <p class='zzSTDTitle1'/>
991
+ <div>
992
+ <h1>1.&#160; Normative References</h1>
993
+ <p id='ISO712' class='NormRef'>
994
+ ISO 712,
995
+ <i>Cereals and cereal products</i>
996
+ </p>
997
+ <p id='ISO713' class='NormRef'>
998
+ ISO 713,
999
+ <i>Cereals and cereal products</i>
860
1000
  </p>
861
- <div>
862
- <h1 class='ForewordTitle'>Foreword</h1>
863
- <p>
864
- <a href='http://www.example.com'>ISO 712</a>
865
- <a href='http://www.example.com'>ISO 712</a>
866
- <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
867
- <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
868
- <a href='spec/assets/iso713.doc'>ISO 713, Table 1; Clause 1</a>
869
- <a href='spec/assets/iso713.doc'>ISO 713, Table 1&#8211;1</a>
870
- <a href='spec/assets/iso713.doc'>ISO 713, Clause 1, Table 1</a>
871
- <a href='spec/assets/iso713.doc'>ISO 713, Clause 1</a>
872
- <a href='spec/assets/iso713.doc'>ISO 713, Clause 1.5</a>
873
- <a href='spec/assets/iso713.doc'>A</a>
874
- <a href='spec/assets/iso713.doc'>ISO 713, Whole of text</a>
875
- <a href='spec/assets/iso713.doc'>ISO 713, Prelude 7</a>
876
- <a href='spec/assets/iso713.doc'>A</a>
877
- <a href='spec/assets/iso713.doc#xyz'>ISO 713</a>
878
- <a href='spec/assets/iso713.doc#xyz'>ISO 713, Clause 1</a>
1001
+ <p id='ISO714' class='NormRef'>
1002
+ ISO 714,
1003
+ <i>Cereals and cereal products</i>
879
1004
  </p>
880
- </div>
881
- <p>&#160;</p>
882
- </div>
883
- <p>
884
- <br clear='all' class='section'/>
885
- </p>
886
- <div class='WordSection3'>
887
- <p class='zzSTDTitle1'/>
888
- <div>
889
- <h1>
890
- 1.
891
- <span style='mso-tab-count:1'>&#160; </span>
892
- Normative References
893
- </h1>
894
- <p id='ISO712' class='NormRef'>
895
- ISO 712,
896
- <i>Cereals and cereal products</i>
897
- </p>
898
- <p id='ISO713' class='NormRef'>
899
- ISO 713,
900
- <i>Cereals and cereal products</i>
901
- </p>
902
- </div>
903
- </div>
904
- </body>
905
- </html>
1005
+ </div>
1006
+ </div>
1007
+ </body>
1008
+ </html>
1009
+ OUTPUT
906
1010
 
907
- OUTPUT
908
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
909
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
910
- expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
911
- end
1011
+ word = <<~OUTPUT
1012
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
1013
+ <head>
1014
+ <style>
1015
+ </style>
1016
+ </head>
1017
+ <body lang='EN-US' link='blue' vlink='#954F72'>
1018
+ <div class='WordSection1'>
1019
+ <p>&#160;</p>
1020
+ </div>
1021
+ <p>
1022
+ <br clear='all' class='section'/>
1023
+ </p>
1024
+ <div class='WordSection2'>
1025
+ <p>
1026
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
1027
+ </p>
1028
+ <div>
1029
+ <h1 class='ForewordTitle'>Foreword</h1>
1030
+ <p>
1031
+ <a href='http://www.example.com'>ISO 712</a>
1032
+ <a href='http://www.example.com'>ISO 712</a>
1033
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
1034
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
1035
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1; Clause 1</a>
1036
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1&#8211;1</a>
1037
+ <a href='spec/assets/iso713.doc'>ISO 713, Clause 1, Table 1</a>
1038
+ <a href='spec/assets/iso713.doc'>ISO 713, Clause 1</a>
1039
+ <a href='spec/assets/iso713.doc'>ISO 713, Clause 1.5</a>
1040
+ <a href='spec/assets/iso713.doc'>A</a>
1041
+ <a href='spec/assets/iso713.doc'>ISO 713, Whole of text</a>
1042
+ <a href='spec/assets/iso713.doc'>ISO 713, Prelude 7</a>
1043
+ <a href='spec/assets/iso713.doc'>A</a>
1044
+ <a href='spec/assets/iso713.doc#xyz'>ISO 713</a>
1045
+ <a href='spec/assets/iso713.doc#xyz'>ISO 713, Clause 1</a>
1046
+ <a href='spec/assets/iso714.svg'>ISO 714</a>
1047
+ </p>
1048
+ </div>
1049
+ <p>&#160;</p>
1050
+ </div>
1051
+ <p>
1052
+ <br clear='all' class='section'/>
1053
+ </p>
1054
+ <div class='WordSection3'>
1055
+ <p class='zzSTDTitle1'/>
1056
+ <div>
1057
+ <h1>
1058
+ 1.
1059
+ <span style='mso-tab-count:1'>&#160; </span>
1060
+ Normative References
1061
+ </h1>
1062
+ <p id='ISO712' class='NormRef'>
1063
+ ISO 712,
1064
+ <i>Cereals and cereal products</i>
1065
+ </p>
1066
+ <p id='ISO713' class='NormRef'>
1067
+ ISO 713,
1068
+ <i>Cereals and cereal products</i>
1069
+ </p>
1070
+ <p id='ISO714' class='NormRef'>
1071
+ ISO 714,
1072
+ <i>Cereals and cereal products</i>
1073
+ </p>
1074
+ </div>
1075
+ </div>
1076
+ </body>
1077
+ </html>
1078
+ OUTPUT
1079
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1080
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1081
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1082
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1083
+ expect(xmlpp(IsoDoc::WordConvert.new({})
1084
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
1085
+ end
912
1086
 
913
- it "processes variant" do
914
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
915
- <iso-standard xmlns="http://riboseinc.com/isoxml">
916
- <bibdata>
917
- <language>en</language>
918
- <script>Latn</script>
919
- </bibdata>
920
- <preface>
921
- <clause id="A"><title><variant lang="en" script="Latn">ABC</variant><variant lang="fr" script="Latn">DEF</variant></title></clause>
922
- <clause id="A1"><title><variant lang="en" script="Grek">ABC</variant><variant lang="fr" script="Grek">DEF</variant></title></clause>
923
- <clause id="A2"><title><variant lang="en">ABC</variant><variant lang="fr">DEF</variant></title></clause>
924
- <clause id="B"><title><variant lang="de" script="Latn">GHI</variant><variant lang="es" script="Latn">JKL</variant></title></clause>
925
- <clause id="C"><title><variant lang="fr" script="Latn">ABC</variant><variant lang="en" script="Latn">DEF</variant></title></clause>
926
- <clause id="C1"><title><variant lang="fr" script="Grek">ABC</variant><variant lang="en" script="Grek">DEF</variant></title></clause>
927
- <clause id="C2"><title><variant lang="fr">ABC</variant><variant lang="en">DEF</variant></title></clause>
928
- <p>A <variant><variant lang="en">B</variant><variant lang="fr">C</variant></variant> D <variant><variant lang="en" script="Latn">E</variant><variant lang="fr" script="Latn">F</variant></variant></p>
929
- </preface>
930
- </iso-standard>
1087
+ it "processes variant" do
1088
+ input = <<~INPUT
1089
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1090
+ <bibdata>
1091
+ <language>en</language>
1092
+ <script>Latn</script>
1093
+ </bibdata>
1094
+ <preface>
1095
+ <clause id="A"><title><variant lang="en" script="Latn">ABC</variant><variant lang="fr" script="Latn">DEF</variant></title></clause>
1096
+ <clause id="A1"><title><variant lang="en" script="Grek">ABC</variant><variant lang="fr" script="Grek">DEF</variant></title></clause>
1097
+ <clause id="A2"><title><variant lang="en">ABC</variant><variant lang="fr">DEF</variant></title></clause>
1098
+ <clause id="B"><title><variant lang="de" script="Latn">GHI</variant><variant lang="es" script="Latn">JKL</variant></title></clause>
1099
+ <clause id="C"><title><variant lang="fr" script="Latn">ABC</variant><variant lang="en" script="Latn">DEF</variant></title></clause>
1100
+ <clause id="C1"><title><variant lang="fr" script="Grek">ABC</variant><variant lang="en" script="Grek">DEF</variant></title></clause>
1101
+ <clause id="C2"><title><variant lang="fr">ABC</variant><variant lang="en">DEF</variant></title></clause>
1102
+ <p>A <variant><variant lang="en">B</variant><variant lang="fr">C</variant></variant> D <variant><variant lang="en" script="Latn">E</variant><variant lang="fr" script="Latn">F</variant></variant></p>
1103
+ </preface>
1104
+ </iso-standard>
931
1105
  INPUT
932
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
933
- <bibdata>
934
- <language current='true'>en</language>
935
- <script current='true'>Latn</script>
936
- </bibdata>
937
- <preface>
938
- <clause id='A'>
939
- <title depth='1'>ABC</title>
940
- </clause>
941
- <clause id='A1'>
942
- <title depth='1'>ABC/DEF</title>
943
- </clause>
944
- <clause id='A2'>
945
- <title depth='1'>ABC</title>
946
- </clause>
947
- <clause id='B'>
948
- <title depth='1'>GHI/JKL</title>
949
- </clause>
950
- <clause id='C'>
951
- <title depth='1'>DEF</title>
952
- </clause>
953
- <clause id='C1'>
954
- <title depth='1'>ABC/DEF</title>
955
- </clause>
956
- <clause id='C2'>
957
- <title depth='1'>DEF</title>
958
- </clause>
959
- <p>A B D E</p>
960
- </preface>
961
- </iso-standard>
1106
+ output = <<~OUTPUT
1107
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1108
+ <bibdata>
1109
+ <language current='true'>en</language>
1110
+ <script current='true'>Latn</script>
1111
+ </bibdata>
1112
+ <preface>
1113
+ <clause id='A' displayorder='1'>
1114
+ <title depth='1'>ABC</title>
1115
+ </clause>
1116
+ <clause id='A1' displayorder='2'>
1117
+ <title depth='1'>ABC/DEF</title>
1118
+ </clause>
1119
+ <clause id='A2' displayorder='3'>
1120
+ <title depth='1'>ABC</title>
1121
+ </clause>
1122
+ <clause id='B' displayorder='4'>
1123
+ <title depth='1'>GHI/JKL</title>
1124
+ </clause>
1125
+ <clause id='C' displayorder='5'>
1126
+ <title depth='1'>DEF</title>
1127
+ </clause>
1128
+ <clause id='C1' displayorder='6'>
1129
+ <title depth='1'>ABC/DEF</title>
1130
+ </clause>
1131
+ <clause id='C2' displayorder='7'>
1132
+ <title depth='1'>DEF</title>
1133
+ </clause>
1134
+ <p displayorder='8'>A B D E</p>
1135
+ </preface>
1136
+ </iso-standard>
962
1137
  OUTPUT
963
- end
1138
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1139
+ .convert("test", input, true)
1140
+ .sub(%r{<localized-strings>.*</localized-strings>}m, "")))
1141
+ .to be_equivalent_to xmlpp(output)
1142
+ end
964
1143
 
965
- it "cases xrefs" do
966
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
967
- <iso-standard xmlns="http://riboseinc.com/isoxml">
968
- <sections>
969
- <clause id="A">
970
- <table id="B">
971
- </table>
972
- </clause>
973
- <clause id="C">
974
- <p>This is <xref target="A"/> and <xref target="B"/>.
975
- This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
976
- This is <xref target="A" case="lowercase"/> and <xref target="B" case="capital"/>.
977
- <xref target="A"/> is clause <em>initial.</em><br/>
978
- <xref target="A"/> is too. </p>
979
- <p><xref target="A"/> is also.</p>
980
- </clause>
981
- </sections>
982
- </iso-standard>
983
- INPUT
984
- <?xml version='1.0'?>
985
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
986
- <sections>
987
- <clause id='A'>
988
- <title>1.</title>
989
- <table id='B'>
990
- <name>Tabelo 1</name>
991
- </table>
992
- </clause>
993
- <clause id='C'>
994
- <title>2.</title>
995
- <p>
996
- This is
997
- <xref target='A'>kla&#x16D;zo 1</xref>
998
- and
999
- <xref target='B'>tabelo 1</xref>
1000
- . This is
1001
- <xref target='A' case='capital'>Kla&#x16D;zo 1</xref>
1002
- and
1003
- <xref target='B' case='lowercase'>tabelo 1</xref>
1004
- . This is
1005
- <xref target='A' case='lowercase'>kla&#x16D;zo 1</xref>
1006
- and
1007
- <xref target='B' case='capital'>Tabelo 1</xref>
1008
- .
1009
- <xref target='A'>Kla&#x16D;zo 1</xref>
1010
- is clause
1011
- <em>initial.</em>
1012
- <br/>
1013
- <xref target='A'>Kla&#x16D;zo 1</xref>
1014
- is too.
1015
- </p>
1016
- <p>
1017
- <xref target='A'>Kla&#x16D;zo 1</xref>
1018
- is also.
1019
- </p>
1020
- </clause>
1021
- </sections>
1022
- </iso-standard>
1023
- OUTPUT
1024
- end
1144
+ it "cases xrefs" do
1145
+ input = <<~INPUT
1146
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1147
+ <sections>
1148
+ <clause id="A">
1149
+ <table id="B">
1150
+ </table>
1151
+ </clause>
1152
+ <clause id="C">
1153
+ <p>This is <xref target="A"/> and <xref target="B"/>.
1154
+ This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
1155
+ This is <xref target="A" case="lowercase"/> and <xref target="B" case="capital"/>.
1156
+ <xref target="A"/> is clause <em>initial.</em><br/>
1157
+ <xref target="A"/> is too. </p>
1158
+ <p><xref target="A"/> is also.</p>
1159
+ </clause>
1160
+ </sections>
1161
+ </iso-standard>
1162
+ INPUT
1163
+ output = <<~OUTPUT
1164
+ <?xml version='1.0'?>
1165
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1166
+ <sections>
1167
+ <clause id='A' displayorder="1">
1168
+ <title>1.</title>
1169
+ <table id='B'>
1170
+ <name>Tabelo 1</name>
1171
+ </table>
1172
+ </clause>
1173
+ <clause id='C' displayorder="2">
1174
+ <title>2.</title>
1175
+ <p>
1176
+ This is
1177
+ <xref target='A'>kla&#x16D;zo 1</xref>
1178
+ and
1179
+ <xref target='B'>tabelo 1</xref>
1180
+ . This is
1181
+ <xref target='A' case='capital'>Kla&#x16D;zo 1</xref>
1182
+ and
1183
+ <xref target='B' case='lowercase'>tabelo 1</xref>
1184
+ . This is
1185
+ <xref target='A' case='lowercase'>kla&#x16D;zo 1</xref>
1186
+ and
1187
+ <xref target='B' case='capital'>Tabelo 1</xref>
1188
+ .
1189
+ <xref target='A'>Kla&#x16D;zo 1</xref>
1190
+ is clause
1191
+ <em>initial.</em>
1192
+ <br/>
1193
+ <xref target='A'>Kla&#x16D;zo 1</xref>
1194
+ is too.
1195
+ </p>
1196
+ <p>
1197
+ <xref target='A'>Kla&#x16D;zo 1</xref>
1198
+ is also.
1199
+ </p>
1200
+ </clause>
1201
+ </sections>
1202
+ </iso-standard>
1203
+ OUTPUT
1204
+ expect(xmlpp(IsoDoc::PresentationXMLConvert
1205
+ .new({ i18nyaml: "spec/assets/i18n.yaml" })
1206
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1207
+ end
1025
1208
 
1026
1209
  it "processes add, del" do
1027
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
1210
+ input = <<~INPUT
1028
1211
  <itu-standard xmlns="https://www.calconnect.org/standards/itu">
1029
1212
  <preface><foreword id="A">
1030
1213
  <add>ABC <xref target="A"></add> <del><strong>B</strong></del>
1031
1214
  </foreword></preface>
1032
1215
  </itu-standard>
1033
1216
  INPUT
1217
+ output = <<~OUTPUT
1034
1218
  #{HTML_HDR}
1035
1219
  <br/>
1036
1220
  <div id='A'>
@@ -1048,7 +1232,7 @@ end
1048
1232
  </body>
1049
1233
  </html>
1050
1234
  OUTPUT
1235
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1236
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1051
1237
  end
1052
-
1053
-
1054
1238
  end