isodoc 1.5.5 → 1.6.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) 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 +3 -7
  5. data/Gemfile +2 -2
  6. data/Rakefile +2 -2
  7. data/bin/rspec +1 -2
  8. data/isodoc.gemspec +11 -11
  9. data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
  10. data/lib/isodoc-yaml/i18n-de.yaml +149 -0
  11. data/lib/isodoc-yaml/i18n-es.yaml +151 -0
  12. data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
  13. data/lib/isodoc.rb +0 -2
  14. data/lib/isodoc/base_style/all.css +7 -0
  15. data/lib/isodoc/base_style/metanorma_word.css +7 -0
  16. data/lib/isodoc/base_style/metanorma_word.scss +8 -0
  17. data/lib/isodoc/base_style/reset.css +7 -0
  18. data/lib/isodoc/base_style/reset.scss +9 -0
  19. data/lib/isodoc/base_style/scripts.html +187 -0
  20. data/lib/isodoc/class_utils.rb +6 -5
  21. data/lib/isodoc/common.rb +2 -0
  22. data/lib/isodoc/convert.rb +30 -17
  23. data/lib/isodoc/css.rb +43 -34
  24. data/lib/isodoc/function/blocks.rb +21 -4
  25. data/lib/isodoc/function/blocks_example_note.rb +2 -2
  26. data/lib/isodoc/function/cleanup.rb +53 -45
  27. data/lib/isodoc/function/form.rb +51 -0
  28. data/lib/isodoc/function/inline.rb +37 -15
  29. data/lib/isodoc/function/references.rb +55 -42
  30. data/lib/isodoc/function/section.rb +29 -16
  31. data/lib/isodoc/function/table.rb +1 -0
  32. data/lib/isodoc/function/to_word_html.rb +33 -29
  33. data/lib/isodoc/function/utils.rb +180 -159
  34. data/lib/isodoc/gem_tasks.rb +30 -31
  35. data/lib/isodoc/headlesshtml_convert.rb +8 -7
  36. data/lib/isodoc/html_convert.rb +6 -4
  37. data/lib/isodoc/html_function/comments.rb +2 -0
  38. data/lib/isodoc/html_function/footnotes.rb +14 -7
  39. data/lib/isodoc/html_function/form.rb +62 -0
  40. data/lib/isodoc/html_function/html.rb +30 -26
  41. data/lib/isodoc/html_function/postprocess.rb +41 -82
  42. data/lib/isodoc/html_function/postprocess_footnotes.rb +59 -0
  43. data/lib/isodoc/i18n.rb +33 -31
  44. data/lib/isodoc/pdf_convert.rb +12 -16
  45. data/lib/isodoc/presentation_function/bibdata.rb +54 -30
  46. data/lib/isodoc/presentation_function/block.rb +17 -8
  47. data/lib/isodoc/presentation_function/inline.rb +84 -120
  48. data/lib/isodoc/presentation_function/math.rb +84 -0
  49. data/lib/isodoc/presentation_function/section.rb +20 -22
  50. data/lib/isodoc/presentation_xml_convert.rb +2 -1
  51. data/lib/isodoc/sassc_importer.rb +1 -1
  52. data/lib/isodoc/version.rb +1 -1
  53. data/lib/isodoc/word_function/body.rb +28 -24
  54. data/lib/isodoc/word_function/footnotes.rb +22 -15
  55. data/lib/isodoc/word_function/postprocess.rb +50 -36
  56. data/lib/isodoc/xref.rb +9 -10
  57. data/lib/isodoc/xref/xref_counter.rb +32 -17
  58. data/lib/isodoc/xref/xref_gen.rb +33 -21
  59. data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
  60. data/lib/isodoc/xref/xref_sect_gen.rb +37 -35
  61. data/lib/isodoc/xslfo_convert.rb +36 -27
  62. data/spec/assets/scripts_override.html +3 -0
  63. data/spec/isodoc/blocks_spec.rb +2490 -2591
  64. data/spec/isodoc/cleanup_spec.rb +1107 -1109
  65. data/spec/isodoc/footnotes_spec.rb +1 -16
  66. data/spec/isodoc/form_spec.rb +156 -0
  67. data/spec/isodoc/i18n_spec.rb +984 -972
  68. data/spec/isodoc/inline_spec.rb +1129 -912
  69. data/spec/isodoc/lists_spec.rb +316 -315
  70. data/spec/isodoc/postproc_spec.rb +1751 -1540
  71. data/spec/isodoc/presentation_xml_spec.rb +403 -323
  72. data/spec/isodoc/ref_spec.rb +718 -723
  73. data/spec/isodoc/section_spec.rb +910 -902
  74. data/spec/isodoc/table_spec.rb +566 -556
  75. data/spec/isodoc/terms_spec.rb +251 -255
  76. data/spec/isodoc/xref_spec.rb +3041 -2992
  77. data/spec/isodoc/xslfo_convert_spec.rb +39 -0
  78. data/spec/spec_helper.rb +30 -29
  79. metadata +77 -65
@@ -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'>
23
+ <title>1.</title>
24
+ <formula id='B'>
25
+ <name>1</name>
26
+ </formula>
27
+ </clause>
28
+ <clause id='C'>
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,667 +96,860 @@ 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>
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>
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'>
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'>
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>
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>
440
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
- </p>
594
- </foreword></preface>
595
- <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
596
- <bibitem id="ISO712" type="standard">
597
- <title format="text/plain">Cereals and cereal products</title>
598
- <docidentifier>ISO 712</docidentifier>
599
- <contributor>
600
- <role type="publisher"/>
601
- <organization>
602
- <abbreviation>ISO</abbreviation>
603
- </organization>
604
- </contributor>
605
- </bibitem>
606
- </references>
607
- </bibliography>
608
- </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>
609
746
  INPUT
610
747
  presxml = <<~OUTPUT
611
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
612
- <preface><foreword>
613
- <p>
614
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
615
- <eref type="inline" bibitemid="ISO712">ISO 712</eref>
616
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Table 1</eref>
617
- <eref type="inline" bibitemid="ISO712"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1</eref>
618
- <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>
619
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Table 1&#x2013;1</eref>
620
- <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>
621
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
622
- <eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality>ISO 712, Clause 1.5</eref>
623
- <eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
624
- <eref type="inline" bibitemid="ISO712"><locality type="whole"/>ISO 712, Whole of text</eref>
625
- <eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality>ISO 712, Prelude 7</eref>
626
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
627
- <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality>ISO 712</eref>
628
- <eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
629
- </p>
630
- </foreword></preface>
631
- <bibliography><references id="_normative_references" obligation="informative" normative="true"><title depth='1'>1.<tab/>Normative References</title>
632
- <bibitem id="ISO712" type="standard">
633
- <title format="text/plain">Cereals and cereal products</title>
634
- <docidentifier>ISO 712</docidentifier>
635
- <contributor>
636
- <role type="publisher"/>
637
- <organization>
638
- <abbreviation>ISO</abbreviation>
639
- </organization>
640
- </contributor>
641
- </bibitem>
642
- </references>
643
- </bibliography>
644
- </iso-standard>
645
- OUTPUT
748
+ <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
749
+ <preface><foreword>
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"><title depth='1'>1.<tab/>Normative References</title>
771
+ <bibitem id="ISO712" type="standard">
772
+ <title format="text/plain">Cereals and cereal products</title>
773
+ <docidentifier>ISO 712</docidentifier>
774
+ <contributor>
775
+ <role type="publisher"/>
776
+ <organization>
777
+ <abbreviation>ISO</abbreviation>
778
+ </organization>
779
+ </contributor>
780
+ </bibitem>
781
+ </references>
782
+ </bibliography>
783
+ </iso-standard>
784
+ OUTPUT
646
785
 
647
- html = <<~OUTPUT
648
- #{HTML_HDR}
649
- <br/>
650
- <div>
651
- <h1 class="ForewordTitle">Foreword</h1>
652
- <p>
653
- <a href="#ISO712">ISO 712</a>
654
- <a href="#ISO712">ISO 712</a>
655
- <a href="#ISO712">ISO 712, Table 1</a>
656
- <a href='#ISO712'>ISO 712, Table 1</a>
657
- <a href='#ISO712'>ISO 712, Table 1; Clause 1</a>
658
- <a href="#ISO712">ISO 712, Table 1&#8211;1</a>
659
- <a href="#ISO712">ISO 712, Clause 1, Table 1</a>
660
- <a href="#ISO712">ISO 712, Clause 1</a>
661
- <a href="#ISO712">ISO 712, Clause 1.5</a>
662
- <a href="#ISO712">A</a>
663
- <a href="#ISO712">ISO 712, Whole of text</a>
664
- <a href="#ISO712">ISO 712, Prelude 7</a>
665
- <a href="#ISO712">A</a>
666
- <a href='#ISO712'>ISO 712</a>
667
- <a href='#ISO712'>ISO 712, Clause 1</a>
668
- </p>
669
- </div>
670
- <p class="zzSTDTitle1"/>
671
- <div>
672
- <h1>1.&#160; Normative References</h1>
673
- <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
674
- </div>
675
- </div>
676
- </body>
677
- </html>
786
+ html = <<~OUTPUT
787
+ #{HTML_HDR}
788
+ <br/>
789
+ <div>
790
+ <h1 class="ForewordTitle">Foreword</h1>
791
+ <p>
792
+ <a href="#ISO712">ISO 712</a>
793
+ <a href="#ISO712">ISO 712</a>
794
+ <a href="#ISO712">ISO 712, Table 1</a>
795
+ <a href='#ISO712'>ISO 712, Table 1</a>
796
+ <a href='#ISO712'>ISO 712, Table 1; Clause 1</a>
797
+ <a href="#ISO712">ISO 712, Table 1&#8211;1</a>
798
+ <a href="#ISO712">ISO 712, Clause 1, Table 1</a>
799
+ <a href="#ISO712">ISO 712, Clause 1</a>
800
+ <a href="#ISO712">ISO 712, Clause 1.5</a>
801
+ <a href="#ISO712">A</a>
802
+ <a href="#ISO712">ISO 712, Whole of text</a>
803
+ <a href="#ISO712">ISO 712, Prelude 7</a>
804
+ <a href="#ISO712">A</a>
805
+ <a href='#ISO712'>ISO 712</a>
806
+ <a href='#ISO712'>ISO 712, Clause 1</a>
807
+ <a href='#ISO712'>ISO 712, 1</a>
808
+ <a href='#ISO712'>ISO 712, clause 1</a>
809
+ </p>
810
+ </div>
811
+ <p class="zzSTDTitle1"/>
812
+ <div>
813
+ <h1>1.&#160; Normative References</h1>
814
+ <p id="ISO712" class="NormRef">ISO 712, <i> Cereals and cereal products</i></p>
815
+ </div>
816
+ </div>
817
+ </body>
818
+ </html>
678
819
  OUTPUT
679
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
680
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
820
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
821
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
822
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
823
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
681
824
  end
682
825
 
683
- it "processes eref content pointing to reference with citation URL" do
684
- input = <<~INPUT
685
- <iso-standard xmlns="http://riboseinc.com/isoxml">
686
- <preface><foreword>
687
- <p>
688
- <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
689
- <eref type="inline" bibitemid="ISO712"/>
690
- <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
691
- <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
692
- <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
693
- <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
694
- <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
695
- <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
696
- <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
697
- <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
698
- <eref type="inline" bibitemid="ISO713"><locality type="whole"></locality></eref>
699
- <eref type="inline" bibitemid="ISO713"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
700
- <eref type="inline" bibitemid="ISO713" citeas="ISO 713">A</eref>
701
- <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality></eref>
702
- <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
703
- </p>
704
- </foreword></preface>
705
- <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
706
- <bibitem id="ISO712" type="standard">
707
- <title format="text/plain">Cereals and cereal products</title>
708
- <uri type="citation">http://www.example.com</uri>
709
- <docidentifier>ISO 712</docidentifier>
710
- <contributor>
711
- <role type="publisher"/>
712
- <organization>
713
- <abbreviation>ISO</abbreviation>
714
- </organization>
715
- </contributor>
716
- </bibitem>
717
- <bibitem id="ISO713" type="standard">
718
- <title format="text/plain">Cereals and cereal products</title>
719
- <uri type="citation">spec/assets/iso713</uri>
720
- <docidentifier>ISO 713</docidentifier>
721
- <contributor>
722
- <role type="publisher"/>
723
- <organization>
724
- <abbreviation>ISO</abbreviation>
725
- </organization>
726
- </contributor>
727
- </bibitem>
728
- </references>
729
- </bibliography>
730
- </iso-standard>
826
+ it "processes eref content pointing to reference with citation URL" do
827
+ input = <<~INPUT
828
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
829
+ <preface><foreword>
830
+ <p>
831
+ <eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
832
+ <eref type="inline" bibitemid="ISO712"/>
833
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
834
+ <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
835
+ <eref type="inline" bibitemid="ISO713"><localityStack><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
836
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
837
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
838
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
839
+ <eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
840
+ <eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
841
+ <eref type="inline" bibitemid="ISO713"><locality type="whole"></locality></eref>
842
+ <eref type="inline" bibitemid="ISO713"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
843
+ <eref type="inline" bibitemid="ISO713" citeas="ISO 713">A</eref>
844
+ <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality></eref>
845
+ <eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
846
+ <eref type="inline" bibitemid="ISO714"/>
847
+ </p>
848
+ </foreword></preface>
849
+ <bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
850
+ <bibitem id="ISO712" type="standard">
851
+ <title format="text/plain">Cereals and cereal products</title>
852
+ <uri type="citation">http://www.example.com</uri>
853
+ <docidentifier>ISO 712</docidentifier>
854
+ <contributor>
855
+ <role type="publisher"/>
856
+ <organization>
857
+ <abbreviation>ISO</abbreviation>
858
+ </organization>
859
+ </contributor>
860
+ </bibitem>
861
+ <bibitem id="ISO713" type="standard">
862
+ <title format="text/plain">Cereals and cereal products</title>
863
+ <uri type="citation">spec/assets/iso713</uri>
864
+ <docidentifier>ISO 713</docidentifier>
865
+ <contributor>
866
+ <role type="publisher"/>
867
+ <organization>
868
+ <abbreviation>ISO</abbreviation>
869
+ </organization>
870
+ </contributor>
871
+ </bibitem>
872
+ <bibitem id="ISO714" type="standard">
873
+ <title format="text/plain">Cereals and cereal products</title>
874
+ <uri type="citation">spec/assets/iso714.svg</uri>
875
+ <docidentifier>ISO 714</docidentifier>
876
+ <contributor>
877
+ <role type="publisher"/>
878
+ <organization>
879
+ <abbreviation>ISO</abbreviation>
880
+ </organization>
881
+ </contributor>
882
+ </bibitem>
883
+ </references>
884
+ </bibliography>
885
+ </iso-standard>
731
886
  INPUT
732
887
  presxml = <<~OUTPUT
733
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
734
- <preface>
735
- <foreword>
736
- <p>
737
- <eref type='inline' bibitemid='ISO712' citeas='ISO 712'>ISO 712</eref>
738
- <eref type='inline' bibitemid='ISO712'>ISO 712</eref>
739
- <eref type='inline' bibitemid='ISO713'><locality type='table'>
740
- <referenceFrom>1</referenceFrom>
741
- </locality>ISO 713, Table 1</eref>
742
- <eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1</eref>
743
- <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>
744
- <eref type='inline' bibitemid='ISO713'><locality type='table'>
745
- <referenceFrom>1</referenceFrom>
746
- <referenceTo>1</referenceTo>
747
- </locality>ISO 713, Table 1&#x2013;1</eref>
748
- <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>
749
- <eref type='inline' bibitemid='ISO713'><locality type='clause'>
750
- <referenceFrom>1</referenceFrom>
751
- </locality>ISO 713, Clause 1</eref>
752
- <eref type='inline' bibitemid='ISO713'><locality type='clause'>
753
- <referenceFrom>1.5</referenceFrom>
754
- </locality>ISO 713, Clause 1.5</eref>
755
- <eref type='inline' bibitemid='ISO713'><locality type='table'>
756
- <referenceFrom>1</referenceFrom>
757
- </locality>A</eref>
758
- <eref type='inline' bibitemid='ISO713'><locality type='whole'/>ISO 713, Whole of text</eref>
759
- <eref type='inline' bibitemid='ISO713'><locality type='locality:prelude'>
760
- <referenceFrom>7</referenceFrom>
761
- </locality>ISO 713, Prelude 7</eref>
762
- <eref type='inline' bibitemid='ISO713' citeas='ISO 713'>A</eref>
763
- <eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality>ISO 713</eref>
764
- <eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality><locality type='clause'><referenceFrom>1</referenceFrom></locality>ISO 713, Clause 1</eref>
765
- </p>
766
- </foreword>
767
- </preface>
768
- <bibliography>
769
- <references id='_normative_references' obligation='informative' normative='true'>
770
- <title depth='1'>1.<tab/>Normative References</title>
771
- <bibitem id='ISO712' type='standard'>
888
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
889
+ <preface>
890
+ <foreword>
891
+ <p>
892
+ <eref type='inline' bibitemid='ISO712' citeas='ISO 712'>ISO 712</eref>
893
+ <eref type='inline' bibitemid='ISO712'>ISO 712</eref>
894
+ <eref type='inline' bibitemid='ISO713'><locality type='table'>
895
+ <referenceFrom>1</referenceFrom>
896
+ </locality>ISO 713, Table 1</eref>
897
+ <eref type='inline' bibitemid='ISO713'><localityStack><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1</eref>
898
+ <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>
899
+ <eref type='inline' bibitemid='ISO713'><locality type='table'>
900
+ <referenceFrom>1</referenceFrom>
901
+ <referenceTo>1</referenceTo>
902
+ </locality>ISO 713, Table 1&#x2013;1</eref>
903
+ <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>
904
+ <eref type='inline' bibitemid='ISO713'><locality type='clause'>
905
+ <referenceFrom>1</referenceFrom>
906
+ </locality>ISO 713, Clause 1</eref>
907
+ <eref type='inline' bibitemid='ISO713'><locality type='clause'>
908
+ <referenceFrom>1.5</referenceFrom>
909
+ </locality>ISO 713, Clause 1.5</eref>
910
+ <eref type='inline' bibitemid='ISO713'><locality type='table'>
911
+ <referenceFrom>1</referenceFrom>
912
+ </locality>A</eref>
913
+ <eref type='inline' bibitemid='ISO713'><locality type='whole'/>ISO 713, Whole of text</eref>
914
+ <eref type='inline' bibitemid='ISO713'><locality type='locality:prelude'>
915
+ <referenceFrom>7</referenceFrom>
916
+ </locality>ISO 713, Prelude 7</eref>
917
+ <eref type='inline' bibitemid='ISO713' citeas='ISO 713'>A</eref>
918
+ <eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality>ISO 713</eref>
919
+ <eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality><locality type='clause'><referenceFrom>1</referenceFrom></locality>ISO 713, Clause 1</eref>
920
+ <eref type='inline' bibitemid='ISO714'>ISO 714</eref>
921
+ </p>
922
+ </foreword>
923
+ </preface>
924
+ <bibliography>
925
+ <references id='_normative_references' obligation='informative' normative='true'>
926
+ <title depth='1'>1.<tab/>Normative References</title>
927
+ <bibitem id='ISO712' type='standard'>
928
+ <title format='text/plain'>Cereals and cereal products</title>
929
+ <uri type='citation'>http://www.example.com</uri>
930
+ <docidentifier>ISO 712</docidentifier>
931
+ <contributor>
932
+ <role type='publisher'/>
933
+ <organization>
934
+ <abbreviation>ISO</abbreviation>
935
+ </organization>
936
+ </contributor>
937
+ </bibitem>
938
+ <bibitem id='ISO713' type='standard'>
939
+ <title format='text/plain'>Cereals and cereal products</title>
940
+ <uri type='citation'>spec/assets/iso713</uri>
941
+ <docidentifier>ISO 713</docidentifier>
942
+ <contributor>
943
+ <role type='publisher'/>
944
+ <organization>
945
+ <abbreviation>ISO</abbreviation>
946
+ </organization>
947
+ </contributor>
948
+ </bibitem>
949
+ <bibitem id='ISO714' type='standard'>
772
950
  <title format='text/plain'>Cereals and cereal products</title>
773
- <uri type='citation'>http://www.example.com</uri>
774
- <docidentifier>ISO 712</docidentifier>
951
+ <uri type='citation'>spec/assets/iso714.svg</uri>
952
+ <docidentifier>ISO 714</docidentifier>
775
953
  <contributor>
776
954
  <role type='publisher'/>
777
955
  <organization>
@@ -779,242 +957,281 @@ html = <<~OUTPUT
779
957
  </organization>
780
958
  </contributor>
781
959
  </bibitem>
782
- <bibitem id='ISO713' type='standard'>
783
- <title format='text/plain'>Cereals and cereal products</title>
784
- <uri type='citation'>spec/assets/iso713</uri>
785
- <docidentifier>ISO 713</docidentifier>
786
- <contributor>
787
- <role type='publisher'/>
788
- <organization>
789
- <abbreviation>ISO</abbreviation>
790
- </organization>
791
- </contributor>
792
- </bibitem>
793
- </references>
794
- </bibliography>
795
- </iso-standard>
796
- OUTPUT
960
+ </references>
961
+ </bibliography>
962
+ </iso-standard>
963
+ OUTPUT
797
964
 
798
965
  html = <<~OUTPUT
799
- #{HTML_HDR}
800
- <br/>
801
- <div>
802
- <h1 class='ForewordTitle'>Foreword</h1>
803
- <p>
804
- <a href='http://www.example.com'>ISO 712</a>
805
- <a href='http://www.example.com'>ISO 712</a>
806
- <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
807
- <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
808
- <a href='spec/assets/iso713.html'>ISO 713, Table 1; Clause 1</a>
809
- <a href='spec/assets/iso713.html'>ISO 713, Table 1&#8211;1</a>
810
- <a href='spec/assets/iso713.html'>ISO 713, Clause 1, Table 1</a>
811
- <a href='spec/assets/iso713.html'>ISO 713, Clause 1</a>
812
- <a href='spec/assets/iso713.html'>ISO 713, Clause 1.5</a>
813
- <a href='spec/assets/iso713.html'>A</a>
814
- <a href='spec/assets/iso713.html'>ISO 713, Whole of text</a>
815
- <a href='spec/assets/iso713.html'>ISO 713, Prelude 7</a>
816
- <a href='spec/assets/iso713.html'>A</a>
817
- <a href='spec/assets/iso713.html#xyz'>ISO 713</a>
818
- <a href='spec/assets/iso713.html#xyz'>ISO 713, Clause 1</a>
819
- </p>
820
- </div>
821
- <p class='zzSTDTitle1'/>
822
- <div>
823
- <h1>1.&#160; Normative References</h1>
824
- <p id='ISO712' class='NormRef'>
825
- ISO 712,
826
- <i>Cereals and cereal products</i>
827
- </p>
828
- <p id='ISO713' class='NormRef'>
829
- ISO 713,
830
- <i>Cereals and cereal products</i>
831
- </p>
832
- </div>
833
- </div>
834
- </body>
835
- </html>
836
- OUTPUT
837
-
838
- word = <<~OUTPUT
839
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
840
- <head>
841
- <style>
842
- </style>
843
- </head>
844
- <body lang='EN-US' link='blue' vlink='#954F72'>
845
- <div class='WordSection1'>
846
- <p>&#160;</p>
847
- </div>
848
- <p>
849
- <br clear='all' class='section'/>
850
- </p>
851
- <div class='WordSection2'>
852
- <p>
853
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
966
+ #{HTML_HDR}
967
+ <br/>
968
+ <div>
969
+ <h1 class='ForewordTitle'>Foreword</h1>
970
+ <p>
971
+ <a href='http://www.example.com'>ISO 712</a>
972
+ <a href='http://www.example.com'>ISO 712</a>
973
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
974
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
975
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1; Clause 1</a>
976
+ <a href='spec/assets/iso713.html'>ISO 713, Table 1&#8211;1</a>
977
+ <a href='spec/assets/iso713.html'>ISO 713, Clause 1, Table 1</a>
978
+ <a href='spec/assets/iso713.html'>ISO 713, Clause 1</a>
979
+ <a href='spec/assets/iso713.html'>ISO 713, Clause 1.5</a>
980
+ <a href='spec/assets/iso713.html'>A</a>
981
+ <a href='spec/assets/iso713.html'>ISO 713, Whole of text</a>
982
+ <a href='spec/assets/iso713.html'>ISO 713, Prelude 7</a>
983
+ <a href='spec/assets/iso713.html'>A</a>
984
+ <a href='spec/assets/iso713.html#xyz'>ISO 713</a>
985
+ <a href='spec/assets/iso713.html#xyz'>ISO 713, Clause 1</a>
986
+ <a href='spec/assets/iso714.svg'>ISO 714</a>
987
+ </p>
988
+ </div>
989
+ <p class='zzSTDTitle1'/>
990
+ <div>
991
+ <h1>1.&#160; Normative References</h1>
992
+ <p id='ISO712' class='NormRef'>
993
+ ISO 712,
994
+ <i>Cereals and cereal products</i>
995
+ </p>
996
+ <p id='ISO713' class='NormRef'>
997
+ ISO 713,
998
+ <i>Cereals and cereal products</i>
854
999
  </p>
855
- <div>
856
- <h1 class='ForewordTitle'>Foreword</h1>
857
- <p>
858
- <a href='http://www.example.com'>ISO 712</a>
859
- <a href='http://www.example.com'>ISO 712</a>
860
- <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
861
- <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
862
- <a href='spec/assets/iso713.doc'>ISO 713, Table 1; Clause 1</a>
863
- <a href='spec/assets/iso713.doc'>ISO 713, Table 1&#8211;1</a>
864
- <a href='spec/assets/iso713.doc'>ISO 713, Clause 1, Table 1</a>
865
- <a href='spec/assets/iso713.doc'>ISO 713, Clause 1</a>
866
- <a href='spec/assets/iso713.doc'>ISO 713, Clause 1.5</a>
867
- <a href='spec/assets/iso713.doc'>A</a>
868
- <a href='spec/assets/iso713.doc'>ISO 713, Whole of text</a>
869
- <a href='spec/assets/iso713.doc'>ISO 713, Prelude 7</a>
870
- <a href='spec/assets/iso713.doc'>A</a>
871
- <a href='spec/assets/iso713.doc#xyz'>ISO 713</a>
872
- <a href='spec/assets/iso713.doc#xyz'>ISO 713, Clause 1</a>
1000
+ <p id='ISO714' class='NormRef'>
1001
+ ISO 714,
1002
+ <i>Cereals and cereal products</i>
873
1003
  </p>
874
- </div>
875
- <p>&#160;</p>
876
- </div>
877
- <p>
878
- <br clear='all' class='section'/>
879
- </p>
880
- <div class='WordSection3'>
881
- <p class='zzSTDTitle1'/>
882
- <div>
883
- <h1>
884
- 1.
885
- <span style='mso-tab-count:1'>&#160; </span>
886
- Normative References
887
- </h1>
888
- <p id='ISO712' class='NormRef'>
889
- ISO 712,
890
- <i>Cereals and cereal products</i>
891
- </p>
892
- <p id='ISO713' class='NormRef'>
893
- ISO 713,
894
- <i>Cereals and cereal products</i>
895
- </p>
896
- </div>
897
- </div>
898
- </body>
899
- </html>
1004
+ </div>
1005
+ </div>
1006
+ </body>
1007
+ </html>
1008
+ OUTPUT
900
1009
 
901
- OUTPUT
902
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
903
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
904
- expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
905
- end
1010
+ word = <<~OUTPUT
1011
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
1012
+ <head>
1013
+ <style>
1014
+ </style>
1015
+ </head>
1016
+ <body lang='EN-US' link='blue' vlink='#954F72'>
1017
+ <div class='WordSection1'>
1018
+ <p>&#160;</p>
1019
+ </div>
1020
+ <p>
1021
+ <br clear='all' class='section'/>
1022
+ </p>
1023
+ <div class='WordSection2'>
1024
+ <p>
1025
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
1026
+ </p>
1027
+ <div>
1028
+ <h1 class='ForewordTitle'>Foreword</h1>
1029
+ <p>
1030
+ <a href='http://www.example.com'>ISO 712</a>
1031
+ <a href='http://www.example.com'>ISO 712</a>
1032
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
1033
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
1034
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1; Clause 1</a>
1035
+ <a href='spec/assets/iso713.doc'>ISO 713, Table 1&#8211;1</a>
1036
+ <a href='spec/assets/iso713.doc'>ISO 713, Clause 1, Table 1</a>
1037
+ <a href='spec/assets/iso713.doc'>ISO 713, Clause 1</a>
1038
+ <a href='spec/assets/iso713.doc'>ISO 713, Clause 1.5</a>
1039
+ <a href='spec/assets/iso713.doc'>A</a>
1040
+ <a href='spec/assets/iso713.doc'>ISO 713, Whole of text</a>
1041
+ <a href='spec/assets/iso713.doc'>ISO 713, Prelude 7</a>
1042
+ <a href='spec/assets/iso713.doc'>A</a>
1043
+ <a href='spec/assets/iso713.doc#xyz'>ISO 713</a>
1044
+ <a href='spec/assets/iso713.doc#xyz'>ISO 713, Clause 1</a>
1045
+ <a href='spec/assets/iso714.svg'>ISO 714</a>
1046
+ </p>
1047
+ </div>
1048
+ <p>&#160;</p>
1049
+ </div>
1050
+ <p>
1051
+ <br clear='all' class='section'/>
1052
+ </p>
1053
+ <div class='WordSection3'>
1054
+ <p class='zzSTDTitle1'/>
1055
+ <div>
1056
+ <h1>
1057
+ 1.
1058
+ <span style='mso-tab-count:1'>&#160; </span>
1059
+ Normative References
1060
+ </h1>
1061
+ <p id='ISO712' class='NormRef'>
1062
+ ISO 712,
1063
+ <i>Cereals and cereal products</i>
1064
+ </p>
1065
+ <p id='ISO713' class='NormRef'>
1066
+ ISO 713,
1067
+ <i>Cereals and cereal products</i>
1068
+ </p>
1069
+ <p id='ISO714' class='NormRef'>
1070
+ ISO 714,
1071
+ <i>Cereals and cereal products</i>
1072
+ </p>
1073
+ </div>
1074
+ </div>
1075
+ </body>
1076
+ </html>
1077
+ OUTPUT
1078
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1079
+ .convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
1080
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1081
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
1082
+ expect(xmlpp(IsoDoc::WordConvert.new({})
1083
+ .convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
1084
+ end
906
1085
 
907
- it "processes variant" do
908
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~"INPUT", true).sub(%r{<localized-strings>.*</localized-strings>}m, ""))).to be_equivalent_to xmlpp(<<~"OUTPUT")
909
- <iso-standard xmlns="http://riboseinc.com/isoxml">
910
- <bibdata>
911
- <language>en</language>
912
- <script>Latn</script>
913
- </bibdata>
914
- <preface>
915
- <clause id="A"><title><variant lang="en" script="Latn">ABC</variant><variant lang="fr" script="Latn">DEF</variant></title></clause>
916
- <clause id="A1"><title><variant lang="en" script="Grek">ABC</variant><variant lang="fr" script="Grek">DEF</variant></title></clause>
917
- <clause id="A2"><title><variant lang="en">ABC</variant><variant lang="fr">DEF</variant></title></clause>
918
- <clause id="B"><title><variant lang="de" script="Latn">GHI</variant><variant lang="es" script="Latn">JKL</variant></title></clause>
919
- <clause id="C"><title><variant lang="fr" script="Latn">ABC</variant><variant lang="en" script="Latn">DEF</variant></title></clause>
920
- <clause id="C1"><title><variant lang="fr" script="Grek">ABC</variant><variant lang="en" script="Grek">DEF</variant></title></clause>
921
- <clause id="C2"><title><variant lang="fr">ABC</variant><variant lang="en">DEF</variant></title></clause>
922
- <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>
923
- </preface>
924
- </iso-standard>
1086
+ it "processes variant" do
1087
+ input = <<~INPUT
1088
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1089
+ <bibdata>
1090
+ <language>en</language>
1091
+ <script>Latn</script>
1092
+ </bibdata>
1093
+ <preface>
1094
+ <clause id="A"><title><variant lang="en" script="Latn">ABC</variant><variant lang="fr" script="Latn">DEF</variant></title></clause>
1095
+ <clause id="A1"><title><variant lang="en" script="Grek">ABC</variant><variant lang="fr" script="Grek">DEF</variant></title></clause>
1096
+ <clause id="A2"><title><variant lang="en">ABC</variant><variant lang="fr">DEF</variant></title></clause>
1097
+ <clause id="B"><title><variant lang="de" script="Latn">GHI</variant><variant lang="es" script="Latn">JKL</variant></title></clause>
1098
+ <clause id="C"><title><variant lang="fr" script="Latn">ABC</variant><variant lang="en" script="Latn">DEF</variant></title></clause>
1099
+ <clause id="C1"><title><variant lang="fr" script="Grek">ABC</variant><variant lang="en" script="Grek">DEF</variant></title></clause>
1100
+ <clause id="C2"><title><variant lang="fr">ABC</variant><variant lang="en">DEF</variant></title></clause>
1101
+ <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>
1102
+ </preface>
1103
+ </iso-standard>
925
1104
  INPUT
926
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
927
- <bibdata>
928
- <language current='true'>en</language>
929
- <script current='true'>Latn</script>
930
- </bibdata>
931
- <preface>
932
- <clause id='A'>
933
- <title depth='1'>ABC</title>
934
- </clause>
935
- <clause id='A1'>
936
- <title depth='1'>ABC/DEF</title>
937
- </clause>
938
- <clause id='A2'>
939
- <title depth='1'>ABC</title>
940
- </clause>
941
- <clause id='B'>
942
- <title depth='1'>GHI/JKL</title>
943
- </clause>
944
- <clause id='C'>
945
- <title depth='1'>DEF</title>
946
- </clause>
947
- <clause id='C1'>
948
- <title depth='1'>ABC/DEF</title>
949
- </clause>
950
- <clause id='C2'>
951
- <title depth='1'>DEF</title>
952
- </clause>
953
- <p>A B D E</p>
954
- </preface>
955
- </iso-standard>
1105
+ output = <<~OUTPUT
1106
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1107
+ <bibdata>
1108
+ <language current='true'>en</language>
1109
+ <script current='true'>Latn</script>
1110
+ </bibdata>
1111
+ <preface>
1112
+ <clause id='A'>
1113
+ <title depth='1'>ABC</title>
1114
+ </clause>
1115
+ <clause id='A1'>
1116
+ <title depth='1'>ABC/DEF</title>
1117
+ </clause>
1118
+ <clause id='A2'>
1119
+ <title depth='1'>ABC</title>
1120
+ </clause>
1121
+ <clause id='B'>
1122
+ <title depth='1'>GHI/JKL</title>
1123
+ </clause>
1124
+ <clause id='C'>
1125
+ <title depth='1'>DEF</title>
1126
+ </clause>
1127
+ <clause id='C1'>
1128
+ <title depth='1'>ABC/DEF</title>
1129
+ </clause>
1130
+ <clause id='C2'>
1131
+ <title depth='1'>DEF</title>
1132
+ </clause>
1133
+ <p>A B D E</p>
1134
+ </preface>
1135
+ </iso-standard>
956
1136
  OUTPUT
957
- end
1137
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1138
+ .convert("test", input, true)
1139
+ .sub(%r{<localized-strings>.*</localized-strings>}m, "")))
1140
+ .to be_equivalent_to xmlpp(output)
1141
+ end
958
1142
 
959
- it "cases xrefs" do
960
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({i18nyaml: "spec/assets/i18n.yaml"}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
961
- <iso-standard xmlns="http://riboseinc.com/isoxml">
962
- <sections>
963
- <clause id="A">
964
- <table id="B">
965
- </table>
966
- </clause>
967
- <clause id="C">
968
- <p>This is <xref target="A"/> and <xref target="B"/>.
969
- This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
970
- This is <xref target="A" case="lowercase"/> and <xref target="B" case="capital"/>.
971
- <xref target="A"/> is clause <em>initial.</em><br/>
972
- <xref target="A"/> is too. </p>
973
- <p><xref target="A"/> is also.</p>
974
- </clause>
975
- </sections>
976
- </iso-standard>
977
- INPUT
978
- <?xml version='1.0'?>
979
- <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
980
- <sections>
981
- <clause id='A'>
982
- <title>1.</title>
983
- <table id='B'>
984
- <name>Tabelo 1</name>
985
- </table>
986
- </clause>
987
- <clause id='C'>
988
- <title>2.</title>
989
- <p>
990
- This is
991
- <xref target='A'>kla&#x16D;zo 1</xref>
992
- and
993
- <xref target='B'>tabelo 1</xref>
994
- . This is
995
- <xref target='A' case='capital'>Kla&#x16D;zo 1</xref>
996
- and
997
- <xref target='B' case='lowercase'>tabelo 1</xref>
998
- . This is
999
- <xref target='A' case='lowercase'>kla&#x16D;zo 1</xref>
1000
- and
1001
- <xref target='B' case='capital'>Tabelo 1</xref>
1002
- .
1003
- <xref target='A'>Kla&#x16D;zo 1</xref>
1004
- is clause
1005
- <em>initial.</em>
1006
- <br/>
1007
- <xref target='A'>Kla&#x16D;zo 1</xref>
1008
- is too.
1009
- </p>
1010
- <p>
1011
- <xref target='A'>Kla&#x16D;zo 1</xref>
1012
- is also.
1013
- </p>
1014
- </clause>
1015
- </sections>
1016
- </iso-standard>
1017
- OUTPUT
1018
- end
1143
+ it "cases xrefs" do
1144
+ input = <<~INPUT
1145
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
1146
+ <sections>
1147
+ <clause id="A">
1148
+ <table id="B">
1149
+ </table>
1150
+ </clause>
1151
+ <clause id="C">
1152
+ <p>This is <xref target="A"/> and <xref target="B"/>.
1153
+ This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
1154
+ This is <xref target="A" case="lowercase"/> and <xref target="B" case="capital"/>.
1155
+ <xref target="A"/> is clause <em>initial.</em><br/>
1156
+ <xref target="A"/> is too. </p>
1157
+ <p><xref target="A"/> is also.</p>
1158
+ </clause>
1159
+ </sections>
1160
+ </iso-standard>
1161
+ INPUT
1162
+ output = <<~OUTPUT
1163
+ <?xml version='1.0'?>
1164
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
1165
+ <sections>
1166
+ <clause id='A'>
1167
+ <title>1.</title>
1168
+ <table id='B'>
1169
+ <name>Tabelo 1</name>
1170
+ </table>
1171
+ </clause>
1172
+ <clause id='C'>
1173
+ <title>2.</title>
1174
+ <p>
1175
+ This is
1176
+ <xref target='A'>kla&#x16D;zo 1</xref>
1177
+ and
1178
+ <xref target='B'>tabelo 1</xref>
1179
+ . This is
1180
+ <xref target='A' case='capital'>Kla&#x16D;zo 1</xref>
1181
+ and
1182
+ <xref target='B' case='lowercase'>tabelo 1</xref>
1183
+ . This is
1184
+ <xref target='A' case='lowercase'>kla&#x16D;zo 1</xref>
1185
+ and
1186
+ <xref target='B' case='capital'>Tabelo 1</xref>
1187
+ .
1188
+ <xref target='A'>Kla&#x16D;zo 1</xref>
1189
+ is clause
1190
+ <em>initial.</em>
1191
+ <br/>
1192
+ <xref target='A'>Kla&#x16D;zo 1</xref>
1193
+ is too.
1194
+ </p>
1195
+ <p>
1196
+ <xref target='A'>Kla&#x16D;zo 1</xref>
1197
+ is also.
1198
+ </p>
1199
+ </clause>
1200
+ </sections>
1201
+ </iso-standard>
1202
+ OUTPUT
1203
+ expect(xmlpp(IsoDoc::PresentationXMLConvert
1204
+ .new({ i18nyaml: "spec/assets/i18n.yaml" })
1205
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1206
+ end
1019
1207
 
1208
+ it "processes add, del" do
1209
+ input = <<~INPUT
1210
+ <itu-standard xmlns="https://www.calconnect.org/standards/itu">
1211
+ <preface><foreword id="A">
1212
+ <add>ABC <xref target="A"></add> <del><strong>B</strong></del>
1213
+ </foreword></preface>
1214
+ </itu-standard>
1215
+ INPUT
1216
+ output = <<~OUTPUT
1217
+ #{HTML_HDR}
1218
+ <br/>
1219
+ <div id='A'>
1220
+ <h1 class='ForewordTitle'>Foreword</h1>
1221
+ <span class='addition'>
1222
+ ABC
1223
+ <a href='#A'/>
1224
+ <span class='deletion'>
1225
+ <b>B</b>
1226
+ </span>
1227
+ </span>
1228
+ </div>
1229
+ <p class='zzSTDTitle1'/>
1230
+ </div>
1231
+ </body>
1232
+ </html>
1233
+ OUTPUT
1234
+ expect(xmlpp(IsoDoc::HtmlConvert.new({})
1235
+ .convert("test", input, true))).to be_equivalent_to xmlpp(output)
1236
+ end
1020
1237
  end