isodoc 2.1.0.2 → 2.1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/isodoc.gemspec +6 -3
- data/lib/isodoc/base_style/all.css +227 -0
- data/lib/isodoc/base_style/blocks.css +0 -0
- data/lib/isodoc/base_style/blocks.scss +7 -0
- data/lib/isodoc/base_style/coverpage.css +0 -0
- data/lib/isodoc/base_style/defaults.css +0 -0
- data/lib/isodoc/base_style/metanorma_word.css +47 -0
- data/lib/isodoc/base_style/nav.css +0 -0
- data/lib/isodoc/base_style/reset.css +125 -0
- data/lib/isodoc/base_style/typography.css +0 -0
- data/lib/isodoc/class_utils.rb +1 -1
- data/lib/isodoc/function/blocks.rb +1 -1
- data/lib/isodoc/function/cleanup.rb +1 -1
- data/lib/isodoc/function/inline.rb +4 -2
- data/lib/isodoc/function/lists.rb +24 -9
- data/lib/isodoc/function/table.rb +1 -1
- data/lib/isodoc/function/to_word_html.rb +3 -2
- data/lib/isodoc/function/utils.rb +18 -8
- data/lib/isodoc/gem_tasks.rb +19 -10
- data/lib/isodoc/html_function/html.rb +2 -2
- data/lib/isodoc/i18n.rb +19 -0
- data/lib/isodoc/metadata.rb +2 -2
- data/lib/isodoc/presentation_function/block.rb +3 -3
- data/lib/isodoc/presentation_function/image.rb +1 -1
- data/lib/isodoc/presentation_function/inline.rb +13 -6
- data/lib/isodoc/presentation_function/section.rb +3 -1
- data/lib/isodoc/presentation_function/xrefs.rb +22 -6
- data/lib/isodoc/presentation_xml_convert.rb +1 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +9 -6
- data/lib/isodoc/word_function/postprocess.rb +1 -1
- data/lib/isodoc/word_function/postprocess_cover.rb +5 -5
- data/lib/isodoc/xref/xref_gen.rb +6 -6
- metadata +16 -69
- data/.github/workflows/rake.yml +0 -15
- data/.github/workflows/release.yml +0 -24
- data/.hound.yml +0 -5
- data/.oss-guides.rubocop.yml +0 -1077
- data/.rubocop.yml +0 -10
- data/Rakefile +0 -8
- data/bin/rspec +0 -17
- data/spec/assets/header.html +0 -7
- data/spec/assets/html.scss +0 -20
- data/spec/assets/html_override.css +0 -1
- data/spec/assets/htmlcover.html +0 -4
- data/spec/assets/htmlintro.html +0 -5
- data/spec/assets/i18n.yaml +0 -41
- data/spec/assets/iso.xml +0 -8
- data/spec/assets/odf.emf +0 -0
- data/spec/assets/odf.svg +0 -1
- data/spec/assets/odf1.svg +0 -4
- data/spec/assets/outputtest/a.xml +0 -66
- data/spec/assets/outputtest/iso.international-standard.xsl +0 -3011
- data/spec/assets/rice_image1 +0 -0
- data/spec/assets/rice_image1.png +0 -0
- data/spec/assets/scripts.html +0 -3
- data/spec/assets/scripts_override.html +0 -3
- data/spec/assets/std.css +0 -2
- data/spec/assets/word.css +0 -2
- data/spec/assets/word_override.css +0 -1
- data/spec/assets/wordcover.html +0 -3
- data/spec/assets/wordintro.html +0 -4
- data/spec/isodoc/blocks_spec.rb +0 -2934
- data/spec/isodoc/cleanup_spec.rb +0 -1056
- data/spec/isodoc/footnotes_spec.rb +0 -264
- data/spec/isodoc/form_spec.rb +0 -160
- data/spec/isodoc/i18n_spec.rb +0 -1201
- data/spec/isodoc/inline_spec.rb +0 -2301
- data/spec/isodoc/lists_spec.rb +0 -469
- data/spec/isodoc/metadata_spec.rb +0 -401
- data/spec/isodoc/postproc_spec.rb +0 -2941
- data/spec/isodoc/presentation_xml_spec.rb +0 -1476
- data/spec/isodoc/ref_spec.rb +0 -955
- data/spec/isodoc/section_spec.rb +0 -2123
- data/spec/isodoc/table_spec.rb +0 -588
- data/spec/isodoc/terms_spec.rb +0 -712
- data/spec/isodoc/utils_spec.rb +0 -57
- data/spec/isodoc/xref_numbering_spec.rb +0 -378
- data/spec/isodoc/xref_spec.rb +0 -1837
- data/spec/isodoc/xslfo_convert_spec.rb +0 -103
- data/spec/spec_helper.rb +0 -81
data/spec/isodoc/inline_spec.rb
DELETED
@@ -1,2301 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
|
3
|
-
RSpec.describe IsoDoc do
|
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>
|
18
|
-
INPUT
|
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ŭzo 1</xref>
|
33
|
-
and
|
34
|
-
<xref target='B'>klaŭ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>
|
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)
|
48
|
-
end
|
49
|
-
|
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
|
-
<span class="A"><em>A</em> <strong>B</strong> <sup>C</sup> <sub>D</sub> <tt>E</tt> F</span>
|
59
|
-
</p>
|
60
|
-
</foreword></preface>
|
61
|
-
<sections>
|
62
|
-
</iso-standard>
|
63
|
-
INPUT
|
64
|
-
html = <<~OUTPUT
|
65
|
-
<div><h1 class='ForewordTitle'>Foreword</h1>
|
66
|
-
<p>
|
67
|
-
<i>A</i>
|
68
|
-
<b>B</b>
|
69
|
-
<sup>C</sup>
|
70
|
-
<sub>D</sub>
|
71
|
-
<tt>E</tt>
|
72
|
-
<s>F</s>
|
73
|
-
<span style='font-variant:small-caps;'>G</span>
|
74
|
-
<span class='keyword'>I</span>
|
75
|
-
<br/>
|
76
|
-
<hr/>
|
77
|
-
<a id='H'/>
|
78
|
-
<br/>
|
79
|
-
<br/>
|
80
|
-
<span style='text-decoration: underline;'>J</span>
|
81
|
-
<i>A</i>
|
82
|
-
<b>B</b>
|
83
|
-
<sup>C</sup>
|
84
|
-
<sub>D</sub>
|
85
|
-
<tt>E</tt>
|
86
|
-
F
|
87
|
-
</p>
|
88
|
-
</div>
|
89
|
-
OUTPUT
|
90
|
-
|
91
|
-
doc = <<~OUTPUT
|
92
|
-
<div><h1 class='ForewordTitle'>Foreword</h1>
|
93
|
-
<p>
|
94
|
-
<i>A</i>
|
95
|
-
<b>B</b>
|
96
|
-
<sup>C</sup>
|
97
|
-
<sub>D</sub>
|
98
|
-
<tt>E</tt>
|
99
|
-
<s>F</s>
|
100
|
-
<span style='font-variant:small-caps;'>G</span>
|
101
|
-
<span class='keyword'>I</span>
|
102
|
-
<br/>
|
103
|
-
<hr/>
|
104
|
-
<a id='H'/>
|
105
|
-
<p>
|
106
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
107
|
-
</p>
|
108
|
-
<p>
|
109
|
-
<br clear='all' class='section' orientation='landscape'/>
|
110
|
-
</p>
|
111
|
-
<u>J</u>
|
112
|
-
<i>A</i>
|
113
|
-
<b>B</b>
|
114
|
-
<sup>C</sup>
|
115
|
-
<sub>D</sub>
|
116
|
-
<tt>E</tt>
|
117
|
-
F
|
118
|
-
</p>
|
119
|
-
</div>
|
120
|
-
OUTPUT
|
121
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
122
|
-
.convert("test", input, true))
|
123
|
-
.sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
|
124
|
-
.to be_equivalent_to xmlpp(html)
|
125
|
-
expect(xmlpp(IsoDoc::WordConvert.new({})
|
126
|
-
.convert("test", input, true))
|
127
|
-
.sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
|
128
|
-
.to be_equivalent_to xmlpp(doc)
|
129
|
-
end
|
130
|
-
|
131
|
-
it "ignores index entries" do
|
132
|
-
input = <<~INPUT
|
133
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
134
|
-
<preface><foreword>
|
135
|
-
<p><index primary="A" secondary="B" tertiary="C"/></p>
|
136
|
-
</foreword></preface>
|
137
|
-
<sections/>
|
138
|
-
<indexsect>
|
139
|
-
<title>Index</title>
|
140
|
-
</indexsect>
|
141
|
-
</iso-standard>
|
142
|
-
INPUT
|
143
|
-
output = <<~OUTPUT
|
144
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
145
|
-
<preface>
|
146
|
-
<foreword displayorder="1">
|
147
|
-
<p/>
|
148
|
-
</foreword>
|
149
|
-
</preface>
|
150
|
-
<sections> </sections>
|
151
|
-
</iso-standard>
|
152
|
-
OUTPUT
|
153
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
154
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
155
|
-
end
|
156
|
-
|
157
|
-
it "processes concept markup" do
|
158
|
-
input = <<~INPUT
|
159
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
160
|
-
<preface><foreword>
|
161
|
-
<p>
|
162
|
-
<ul>
|
163
|
-
<li>
|
164
|
-
<concept><refterm>term</refterm>
|
165
|
-
<xref target='clause1'/>
|
166
|
-
</concept></li>
|
167
|
-
<li><concept><refterm>term</refterm>
|
168
|
-
<renderterm>term</renderterm>
|
169
|
-
<xref target='clause1'/>
|
170
|
-
</concept></li>
|
171
|
-
<li><concept><refterm>term</refterm>
|
172
|
-
<renderterm>w[o]rd</renderterm>
|
173
|
-
<xref target='clause1'>Clause #1</xref>
|
174
|
-
</concept></li>
|
175
|
-
<li><concept><refterm>term</refterm>
|
176
|
-
<renderterm>term</renderterm>
|
177
|
-
<eref bibitemid="ISO712" type="inline" citeas="ISO 712"/>
|
178
|
-
</concept></li>
|
179
|
-
<li><concept><refterm>term</refterm>
|
180
|
-
<renderterm>word</renderterm>
|
181
|
-
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">The Aforementioned Citation</eref>
|
182
|
-
</concept></li>
|
183
|
-
<li><concept><refterm>term</refterm>
|
184
|
-
<renderterm>word</renderterm>
|
185
|
-
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
186
|
-
<locality type='clause'>
|
187
|
-
<referenceFrom>3.1</referenceFrom>
|
188
|
-
</locality>
|
189
|
-
<locality type='figure'>
|
190
|
-
<referenceFrom>a</referenceFrom>
|
191
|
-
</locality>
|
192
|
-
</eref>
|
193
|
-
</concept></li>
|
194
|
-
<li><concept><refterm>term</refterm>
|
195
|
-
<renderterm>word</renderterm>
|
196
|
-
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
197
|
-
<localityStack connective="and">
|
198
|
-
<locality type='clause'>
|
199
|
-
<referenceFrom>3.1</referenceFrom>
|
200
|
-
</locality>
|
201
|
-
</localityStack>
|
202
|
-
<localityStack connective="and">
|
203
|
-
<locality type='figure'>
|
204
|
-
<referenceFrom>b</referenceFrom>
|
205
|
-
</locality>
|
206
|
-
</localityStack>
|
207
|
-
</eref>
|
208
|
-
</concept></li>
|
209
|
-
<li><concept><refterm>term</refterm>
|
210
|
-
<renderterm>word</renderterm>
|
211
|
-
<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
212
|
-
<localityStack connective="and">
|
213
|
-
<locality type='clause'>
|
214
|
-
<referenceFrom>3.1</referenceFrom>
|
215
|
-
</locality>
|
216
|
-
</localityStack>
|
217
|
-
<localityStack connective="and">
|
218
|
-
<locality type='figure'>
|
219
|
-
<referenceFrom>b</referenceFrom>
|
220
|
-
</locality>
|
221
|
-
</localityStack>
|
222
|
-
The Aforementioned Citation
|
223
|
-
</eref>
|
224
|
-
</concept></li>
|
225
|
-
<li><concept><refterm>term</refterm>
|
226
|
-
<renderterm>word</renderterm>
|
227
|
-
<termref base='IEV' target='135-13-13'/>
|
228
|
-
</concept></li>
|
229
|
-
<li><concept><refterm>term</refterm>
|
230
|
-
<renderterm>word</renderterm>
|
231
|
-
<termref base='IEV' target='135-13-13'>The IEV database</termref>
|
232
|
-
</concept></li>
|
233
|
-
<li><concept>
|
234
|
-
<strong>error!</strong>
|
235
|
-
</concept>
|
236
|
-
</li>
|
237
|
-
</ul>
|
238
|
-
</p>
|
239
|
-
</foreword></preface>
|
240
|
-
<sections>
|
241
|
-
<clause id="clause1"><title>Clause 1</title></clause>
|
242
|
-
</sections>
|
243
|
-
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
|
244
|
-
<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>
|
245
|
-
<bibitem id="ISO712" type="standard">
|
246
|
-
<title format="text/plain">Cereals or cereal products</title>
|
247
|
-
<title type="main" format="text/plain">Cereals and cereal products</title>
|
248
|
-
<docidentifier type="ISO">ISO 712</docidentifier>
|
249
|
-
<contributor>
|
250
|
-
<role type="publisher"/>
|
251
|
-
<organization>
|
252
|
-
<name>International Organization for Standardization</name>
|
253
|
-
</organization>
|
254
|
-
</contributor>
|
255
|
-
</bibitem>
|
256
|
-
</references></bibliography>
|
257
|
-
</iso-standard>
|
258
|
-
INPUT
|
259
|
-
presxml = <<~OUTPUT
|
260
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
261
|
-
<preface><foreword displayorder="1">
|
262
|
-
<p>
|
263
|
-
<ul>
|
264
|
-
<li>
|
265
|
-
[term defined in <xref target="clause1">Clause 2</xref>]
|
266
|
-
</li>
|
267
|
-
<li>
|
268
|
-
<em>term</em> [term defined in <xref target="clause1">Clause 2</xref>]
|
269
|
-
</li>
|
270
|
-
<li>
|
271
|
-
<em>w[o]rd</em> [<xref target="clause1">Clause #1</xref>]
|
272
|
-
</li>
|
273
|
-
<li>
|
274
|
-
<em>term</em> [term defined in <eref bibitemid="ISO712" type="inline" citeas="ISO 712">ISO 712</eref>]
|
275
|
-
</li>
|
276
|
-
<li>
|
277
|
-
<em>word</em> [<eref bibitemid="ISO712" type="inline" citeas="ISO 712">The Aforementioned Citation</eref>]
|
278
|
-
</li>
|
279
|
-
<li>
|
280
|
-
<em>word</em> [term defined in <eref bibitemid="ISO712" type="inline" citeas="ISO 712"><locality type="clause">
|
281
|
-
<referenceFrom>3.1</referenceFrom>
|
282
|
-
</locality><locality type="figure">
|
283
|
-
<referenceFrom>a</referenceFrom>
|
284
|
-
</locality>ISO 712, Clause 3.1, Figure a</eref>]
|
285
|
-
</li>
|
286
|
-
<li>
|
287
|
-
<em>word</em> [term defined in <eref bibitemid="ISO712" type="inline" citeas="ISO 712"><localityStack connective="and">
|
288
|
-
<locality type="clause">
|
289
|
-
<referenceFrom>3.1</referenceFrom>
|
290
|
-
</locality>
|
291
|
-
</localityStack><localityStack connective="and">
|
292
|
-
<locality type="figure">
|
293
|
-
<referenceFrom>b</referenceFrom>
|
294
|
-
</locality>
|
295
|
-
</localityStack>ISO 712, Clause 3.1 and Figure b</eref>]
|
296
|
-
</li>
|
297
|
-
<li>
|
298
|
-
<em>word</em> [<eref bibitemid="ISO712" type="inline" citeas="ISO 712">
|
299
|
-
<localityStack connective="and">
|
300
|
-
<locality type="clause">
|
301
|
-
<referenceFrom>3.1</referenceFrom>
|
302
|
-
</locality>
|
303
|
-
</localityStack>
|
304
|
-
<localityStack connective="and">
|
305
|
-
<locality type="figure">
|
306
|
-
<referenceFrom>b</referenceFrom>
|
307
|
-
</locality>
|
308
|
-
</localityStack>
|
309
|
-
The Aforementioned Citation
|
310
|
-
</eref>]
|
311
|
-
</li>
|
312
|
-
<li>
|
313
|
-
<em>word</em> [term defined in <termref base="IEV" target="135-13-13"/>]
|
314
|
-
</li>
|
315
|
-
<li>
|
316
|
-
<em>word</em> [<termref base="IEV" target="135-13-13">The IEV database</termref>]
|
317
|
-
</li>
|
318
|
-
<li> <strong>error!</strong> </li>
|
319
|
-
</ul>
|
320
|
-
</p>
|
321
|
-
</foreword></preface>
|
322
|
-
<sections>
|
323
|
-
<clause id="clause1" displayorder="3"><title depth="1">2.<tab/>Clause 1</title></clause>
|
324
|
-
</sections>
|
325
|
-
<bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder="2"><title depth="1">1.<tab/>Normative References</title>
|
326
|
-
<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>
|
327
|
-
<bibitem id="ISO712" type="standard">
|
328
|
-
<formattedref>International Organization for Standardization. <em>Cereals and cereal products</em>.</formattedref>
|
329
|
-
<docidentifier type="ISO">ISO 712</docidentifier>
|
330
|
-
</bibitem>
|
331
|
-
</references></bibliography>
|
332
|
-
</iso-standard>
|
333
|
-
OUTPUT
|
334
|
-
output = <<~OUTPUT
|
335
|
-
#{HTML_HDR}
|
336
|
-
<br/>
|
337
|
-
<div>
|
338
|
-
<h1 class='ForewordTitle'>Foreword</h1>
|
339
|
-
<p>
|
340
|
-
<ul>
|
341
|
-
<li>
|
342
|
-
[term defined in
|
343
|
-
<a href='#clause1'>Clause 2</a>
|
344
|
-
]
|
345
|
-
</li>
|
346
|
-
<li>
|
347
|
-
<i>term</i>
|
348
|
-
[term defined in
|
349
|
-
<a href='#clause1'>Clause 2</a>
|
350
|
-
]
|
351
|
-
</li>
|
352
|
-
<li>
|
353
|
-
<i>w[o]rd</i>
|
354
|
-
[
|
355
|
-
<a href='#clause1'>Clause #1</a>
|
356
|
-
]
|
357
|
-
</li>
|
358
|
-
<li>
|
359
|
-
<i>term</i>
|
360
|
-
[term defined in
|
361
|
-
<a href='#ISO712'>ISO 712</a>
|
362
|
-
]
|
363
|
-
</li>
|
364
|
-
<li>
|
365
|
-
<i>word</i>
|
366
|
-
[
|
367
|
-
<a href='#ISO712'>The Aforementioned Citation</a>
|
368
|
-
]
|
369
|
-
</li>
|
370
|
-
<li>
|
371
|
-
<i>word</i>
|
372
|
-
[term defined in
|
373
|
-
<a href='#ISO712'>ISO 712, Clause 3.1, Figure a</a>
|
374
|
-
]
|
375
|
-
</li>
|
376
|
-
<li>
|
377
|
-
<i>word</i>
|
378
|
-
[term defined in
|
379
|
-
<a href='#ISO712'>ISO 712, Clause 3.1 and Figure b</a>
|
380
|
-
]
|
381
|
-
</li>
|
382
|
-
<li>
|
383
|
-
<i>word</i>
|
384
|
-
[
|
385
|
-
<a href='#ISO712'> The Aforementioned Citation </a>
|
386
|
-
]
|
387
|
-
</li>
|
388
|
-
<li>
|
389
|
-
<i>word</i>
|
390
|
-
[term defined in Termbase IEV, term ID 135-13-13]
|
391
|
-
</li>
|
392
|
-
<li>
|
393
|
-
<i>word</i>
|
394
|
-
[The IEV database]
|
395
|
-
</li>
|
396
|
-
<li> <b>error!</b> </li>
|
397
|
-
</ul>
|
398
|
-
</p>
|
399
|
-
</div>
|
400
|
-
<p class='zzSTDTitle1'/>
|
401
|
-
<div>
|
402
|
-
<h1>1.  Normative References</h1>
|
403
|
-
<p>
|
404
|
-
The following documents are referred to in the text in such a way that
|
405
|
-
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, International Organization for Standardization.
|
412
|
-
<i>Cereals and cereal products</i>.
|
413
|
-
</p>
|
414
|
-
</div>
|
415
|
-
<div id='clause1'>
|
416
|
-
<h1>2.  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
|
427
|
-
|
428
|
-
it "processes concept attributes" do
|
429
|
-
input = <<~INPUT
|
430
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
431
|
-
<preface><foreword>
|
432
|
-
<p>
|
433
|
-
<ul>
|
434
|
-
<li><concept ital="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
435
|
-
<li><concept ref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
436
|
-
<li><concept ital="true" ref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
437
|
-
<li><concept ital="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
438
|
-
<li><concept ref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
439
|
-
<li><concept ital="false" ref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
440
|
-
<li><concept ital="true" ref="true" linkmention="true" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
441
|
-
<li><concept ital="true" ref="true" linkmention="true" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
442
|
-
<li><concept ital="true" ref="true" linkmention="false" linkref="true"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
443
|
-
<li><concept ital="true" ref="true" linkmention="false" linkref="false"><refterm>term</refterm><renderterm>term</renderterm><xref target='clause1'/></concept>,</li>
|
444
|
-
<li><concept ital="true" ref="true" linkmention="true" linkref="true"><strong>error!</strong></concept></li>
|
445
|
-
<li><concept ital="false" ref="false" linkmention="true">
|
446
|
-
<refterm>CV_DiscreteCoverage</refterm>
|
447
|
-
<renderterm>CV_DiscreteCoverage</renderterm>
|
448
|
-
<xref target="term-cv_discretecoverage"/>
|
449
|
-
</concept></li>
|
450
|
-
</ul></p>
|
451
|
-
</foreword></preface>
|
452
|
-
<sections>
|
453
|
-
<clause id="clause1"><title>Clause 1</title></clause>
|
454
|
-
</sections>
|
455
|
-
</iso-standard>
|
456
|
-
INPUT
|
457
|
-
presxml = <<~OUTPUT
|
458
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
459
|
-
<preface><foreword displayorder="1">
|
460
|
-
<p>
|
461
|
-
<ul>
|
462
|
-
<li><em>term</em> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
463
|
-
<li><em>term</em> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
464
|
-
<li><em>term</em> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
465
|
-
<li>term [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
466
|
-
<li><em>term</em>,</li>
|
467
|
-
<li>term,</li>
|
468
|
-
<li><xref target="clause1"><em>term</em></xref> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
469
|
-
<li><xref target="clause1"><em>term</em></xref> [term defined in Clause 1],</li>
|
470
|
-
<li><em>term</em> [term defined in <xref target="clause1">Clause 1</xref>],</li>
|
471
|
-
<li><em>term</em> [term defined in Clause 1],</li>
|
472
|
-
<li><strong>error!</strong></li>
|
473
|
-
<li><xref target='term-cv_discretecoverage'>CV_DiscreteCoverage</xref></li>
|
474
|
-
</ul></p>
|
475
|
-
</foreword></preface>
|
476
|
-
<sections>
|
477
|
-
<clause id="clause1" displayorder="2"><title depth="1">1.<tab/>Clause 1</title></clause>
|
478
|
-
</sections>
|
479
|
-
</iso-standard>
|
480
|
-
OUTPUT
|
481
|
-
output = <<~OUTPUT
|
482
|
-
#{HTML_HDR}
|
483
|
-
<br/>
|
484
|
-
<div>
|
485
|
-
<h1 class='ForewordTitle'>Foreword</h1>
|
486
|
-
<p>
|
487
|
-
<ul>
|
488
|
-
<li>
|
489
|
-
<i>term</i>
|
490
|
-
[term defined in
|
491
|
-
<a href='#clause1'>Clause 1</a>
|
492
|
-
],
|
493
|
-
</li>
|
494
|
-
<li>
|
495
|
-
<i>term</i>
|
496
|
-
[term defined in
|
497
|
-
<a href='#clause1'>Clause 1</a>
|
498
|
-
],
|
499
|
-
</li>
|
500
|
-
<li>
|
501
|
-
<i>term</i>
|
502
|
-
[term defined in
|
503
|
-
<a href='#clause1'>Clause 1</a>
|
504
|
-
],
|
505
|
-
</li>
|
506
|
-
<li>
|
507
|
-
term [term defined in
|
508
|
-
<a href='#clause1'>Clause 1</a>
|
509
|
-
],
|
510
|
-
</li>
|
511
|
-
<li>
|
512
|
-
<i>term</i>,
|
513
|
-
</li>
|
514
|
-
<li>term,</li>
|
515
|
-
<li>
|
516
|
-
<a href='#clause1'>
|
517
|
-
<i>term</i>
|
518
|
-
</a>
|
519
|
-
[term defined in
|
520
|
-
<a href='#clause1'>Clause 1</a>
|
521
|
-
],
|
522
|
-
</li>
|
523
|
-
<li>
|
524
|
-
<a href='#clause1'>
|
525
|
-
<i>term</i>
|
526
|
-
</a>
|
527
|
-
[term defined in Clause 1],
|
528
|
-
</li>
|
529
|
-
<li>
|
530
|
-
<i>term</i>
|
531
|
-
[term defined in
|
532
|
-
<a href='#clause1'>Clause 1</a>
|
533
|
-
],
|
534
|
-
</li>
|
535
|
-
<li>
|
536
|
-
<i>term</i>
|
537
|
-
[term defined in Clause 1],
|
538
|
-
</li>
|
539
|
-
<li> <b>error!</b> </li>
|
540
|
-
<li> <a href='#term-cv_discretecoverage'>CV_DiscreteCoverage</a> </li>
|
541
|
-
</ul>
|
542
|
-
</p>
|
543
|
-
</div>
|
544
|
-
<p class='zzSTDTitle1'/>
|
545
|
-
<div id='clause1'>
|
546
|
-
<h1>1.  Clause 1</h1>
|
547
|
-
</div>
|
548
|
-
</div>
|
549
|
-
</body>
|
550
|
-
</html>
|
551
|
-
OUTPUT
|
552
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
553
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
554
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
555
|
-
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
556
|
-
end
|
557
|
-
|
558
|
-
it "processes concept markup for symbols" do
|
559
|
-
input = <<~INPUT
|
560
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
561
|
-
<preface><foreword>
|
562
|
-
<p>
|
563
|
-
<ul>
|
564
|
-
<li><concept>
|
565
|
-
<refterm>term</refterm>
|
566
|
-
<renderterm>ISO</renderterm>
|
567
|
-
<xref target='d1'/>
|
568
|
-
</concept></li>
|
569
|
-
</ul>
|
570
|
-
</p>
|
571
|
-
</foreword>
|
572
|
-
</preface>
|
573
|
-
<sections>
|
574
|
-
<definitions id="d">
|
575
|
-
<dl>
|
576
|
-
<dt id="d1">ISO</dt> <dd>xyz</xyz>
|
577
|
-
<dt id="d2">IEC</dt> <dd>abc</xyz>
|
578
|
-
</dl>
|
579
|
-
</definitions>
|
580
|
-
</sections>
|
581
|
-
</iso-standard>
|
582
|
-
INPUT
|
583
|
-
presxml = <<~OUTPUT
|
584
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
585
|
-
<preface>
|
586
|
-
<foreword displayorder='1'>
|
587
|
-
<p>
|
588
|
-
<ul>
|
589
|
-
<li>ISO</li>
|
590
|
-
</ul>
|
591
|
-
</p>
|
592
|
-
</foreword>
|
593
|
-
</preface>
|
594
|
-
<sections>
|
595
|
-
<definitions id='d' displayorder='2'>
|
596
|
-
<title>1.</title>
|
597
|
-
<dl>
|
598
|
-
<dt id='d1'>ISO</dt>
|
599
|
-
<dd>xyz</dd>
|
600
|
-
<dt id='d2'>IEC</dt>
|
601
|
-
<dd>abc</dd>
|
602
|
-
</dl>
|
603
|
-
</definitions>
|
604
|
-
</sections>
|
605
|
-
</iso-standard>
|
606
|
-
OUTPUT
|
607
|
-
output = <<~OUTPUT
|
608
|
-
#{HTML_HDR}
|
609
|
-
<br/>
|
610
|
-
<div>
|
611
|
-
<h1 class='ForewordTitle'>Foreword</h1>
|
612
|
-
<p>
|
613
|
-
<ul>
|
614
|
-
<li>ISO</li>
|
615
|
-
</ul>
|
616
|
-
</p>
|
617
|
-
</div>
|
618
|
-
<p class='zzSTDTitle1'/>
|
619
|
-
<div id='d' class='Symbols'>
|
620
|
-
<h1>1.</h1>
|
621
|
-
<dl>
|
622
|
-
<dt id='d1'>
|
623
|
-
<p>ISO</p>
|
624
|
-
</dt>
|
625
|
-
<dd>xyz</dd>
|
626
|
-
<dt id='d2'>
|
627
|
-
<p>IEC</p>
|
628
|
-
</dt>
|
629
|
-
<dd>abc</dd>
|
630
|
-
</dl>
|
631
|
-
</div>
|
632
|
-
</div>
|
633
|
-
</body>
|
634
|
-
</html>
|
635
|
-
OUTPUT
|
636
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
637
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
638
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
639
|
-
.convert("test", presxml, true))).to be_equivalent_to xmlpp(output)
|
640
|
-
end
|
641
|
-
|
642
|
-
it "processes related terms" do
|
643
|
-
input = <<~INPUT
|
644
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
645
|
-
<sections>
|
646
|
-
<terms id='A' obligation='normative'>
|
647
|
-
<title>Terms and definitions</title>
|
648
|
-
<term id='second'>
|
649
|
-
<preferred>
|
650
|
-
<expression>
|
651
|
-
<name>Second Term</name>
|
652
|
-
</expression>
|
653
|
-
<field-of-application>Field</field-of-application>
|
654
|
-
<usage-info>Usage Info 1</usage-info>
|
655
|
-
</preferred>
|
656
|
-
<definition><verbal-definition>Definition 1</verbal-definition></definition>
|
657
|
-
</term>
|
658
|
-
<term id="C">
|
659
|
-
<preferred language='fr' script='Latn' type='prefix'>
|
660
|
-
<expression>
|
661
|
-
<name>First Designation</name>
|
662
|
-
</expression></preferred>
|
663
|
-
<related type='contrast'>
|
664
|
-
<preferred>
|
665
|
-
<expression>
|
666
|
-
<name>Fifth Designation</name>
|
667
|
-
<grammar>
|
668
|
-
<gender>neuter</gender>
|
669
|
-
</grammar>
|
670
|
-
</expression>
|
671
|
-
</preferred>
|
672
|
-
<xref target='second'/>
|
673
|
-
</related>
|
674
|
-
<definition><verbal-definition>Definition 2</verbal-definition></definition>
|
675
|
-
</term>
|
676
|
-
</terms>
|
677
|
-
</sections>
|
678
|
-
</iso-standard>
|
679
|
-
INPUT
|
680
|
-
output = <<~OUTPUT
|
681
|
-
<?xml version='1.0'?>
|
682
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
683
|
-
<sections>
|
684
|
-
<terms id='A' obligation='normative' displayorder='1'>
|
685
|
-
<title depth='1'>1.<tab/>Terms and definitions</title>
|
686
|
-
<term id='second'>
|
687
|
-
<name>1.1.</name>
|
688
|
-
<preferred><strong>Second Term</strong>, <Field, Usage Info 1></preferred>
|
689
|
-
<definition>Definition 1</definition>
|
690
|
-
</term>
|
691
|
-
<term id='C'>
|
692
|
-
<name>1.2.</name>
|
693
|
-
<preferred language='fr' script='Latn' type='prefix'><strong>First Designation</strong></preferred>
|
694
|
-
<p>
|
695
|
-
<strong>CONTRAST:</strong>
|
696
|
-
<em>
|
697
|
-
<preferred><strong>Fifth Designation</strong>, n</preferred>
|
698
|
-
</em> (<xref target='second'>Clause 1.1</xref>)
|
699
|
-
</p>
|
700
|
-
<definition>Definition 2</definition>
|
701
|
-
</term>
|
702
|
-
</terms>
|
703
|
-
</sections>
|
704
|
-
</iso-standard>
|
705
|
-
OUTPUT
|
706
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
707
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
708
|
-
end
|
709
|
-
|
710
|
-
it "processes embedded inline formatting" do
|
711
|
-
input = <<~INPUT
|
712
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
713
|
-
<preface><foreword>
|
714
|
-
<p>
|
715
|
-
<em><strong><</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>
|
716
|
-
</p>
|
717
|
-
</foreword></preface>
|
718
|
-
<sections>
|
719
|
-
</iso-standard>
|
720
|
-
INPUT
|
721
|
-
output = <<~OUTPUT
|
722
|
-
#{HTML_HDR}
|
723
|
-
<br/>
|
724
|
-
<div>
|
725
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
726
|
-
<p>
|
727
|
-
<i><b><</b></i> <tt><a href="B">B</a></tt> <a href="#_http_1_1">Requirement <tt>/req/core/http</tt></a> Requirement <tt>/req/core/http</tt>
|
728
|
-
</p>
|
729
|
-
</div>
|
730
|
-
<p class="zzSTDTitle1"/>
|
731
|
-
</div>
|
732
|
-
</body>
|
733
|
-
</html>
|
734
|
-
OUTPUT
|
735
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
736
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
737
|
-
end
|
738
|
-
|
739
|
-
it "processes inline images" do
|
740
|
-
input = <<~INPUT
|
741
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
742
|
-
<preface><foreword>
|
743
|
-
<p>
|
744
|
-
<image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
|
745
|
-
</p>
|
746
|
-
</foreword></preface>
|
747
|
-
</iso-standard>
|
748
|
-
INPUT
|
749
|
-
output = <<~OUTPUT
|
750
|
-
#{HTML_HDR}
|
751
|
-
<br/>
|
752
|
-
<div>
|
753
|
-
<h1 class='ForewordTitle'>Foreword</h1>
|
754
|
-
<p>
|
755
|
-
<img src='rice_images/rice_image1.png' height='20' width='30' title='titletxt' alt='alttext'/>
|
756
|
-
</p>
|
757
|
-
</div>
|
758
|
-
<p class='zzSTDTitle1'/>
|
759
|
-
</div>
|
760
|
-
</body>
|
761
|
-
</html>
|
762
|
-
OUTPUT
|
763
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
764
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
765
|
-
end
|
766
|
-
|
767
|
-
it "processes links" do
|
768
|
-
input = <<~INPUT
|
769
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
770
|
-
<preface><foreword>
|
771
|
-
<p>
|
772
|
-
<link target="http://example.com"/>
|
773
|
-
<link target="http://example.com">example</link>
|
774
|
-
<link target="http://example.com" alt="tip">example</link>
|
775
|
-
<link target="mailto:fred@example.com"/>
|
776
|
-
<link target="mailto:fred@example.com">mailto:fred@example.com</link>
|
777
|
-
</p>
|
778
|
-
</foreword></preface>
|
779
|
-
<sections>
|
780
|
-
</iso-standard>
|
781
|
-
INPUT
|
782
|
-
output = <<~OUTPUT
|
783
|
-
#{HTML_HDR}
|
784
|
-
<br/>
|
785
|
-
<div>
|
786
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
787
|
-
<p>
|
788
|
-
<a href="http://example.com">http://example.com</a>
|
789
|
-
<a href="http://example.com">example</a>
|
790
|
-
<a href="http://example.com" title="tip">example</a>
|
791
|
-
<a href="mailto:fred@example.com">fred@example.com</a>
|
792
|
-
<a href="mailto:fred@example.com">mailto:fred@example.com</a>
|
793
|
-
</p>
|
794
|
-
</div>
|
795
|
-
<p class="zzSTDTitle1"/>
|
796
|
-
</div>
|
797
|
-
</body>
|
798
|
-
</html>
|
799
|
-
OUTPUT
|
800
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
801
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
802
|
-
end
|
803
|
-
|
804
|
-
it "processes updatetype links" do
|
805
|
-
input = <<~INPUT
|
806
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
807
|
-
<preface><foreword>
|
808
|
-
<p>
|
809
|
-
<link update-type="true" target="http://example.com"/>
|
810
|
-
<link update-type="true" target="list.adoc">example</link>
|
811
|
-
<link update-type="true" target="list" alt="tip">example</link>
|
812
|
-
</p>
|
813
|
-
</foreword></preface>
|
814
|
-
<sections>
|
815
|
-
</iso-standard>
|
816
|
-
INPUT
|
817
|
-
html = <<~OUTPUT
|
818
|
-
<div>
|
819
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
820
|
-
<p>
|
821
|
-
<a href="http://example.com">http://example.com</a>
|
822
|
-
<a href='list.adoc'>example</a>
|
823
|
-
<a href='list.html' title='tip'>example</a>
|
824
|
-
</p>
|
825
|
-
</div>
|
826
|
-
OUTPUT
|
827
|
-
doc = <<~OUTPUT
|
828
|
-
<div>
|
829
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
830
|
-
<p>
|
831
|
-
<a href="http://example.com">http://example.com</a>
|
832
|
-
<a href='list.adoc'>example</a>
|
833
|
-
<a href='list.doc' title='tip'>example</a>
|
834
|
-
</p>
|
835
|
-
</div>
|
836
|
-
OUTPUT
|
837
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
838
|
-
.convert("test", input, true))
|
839
|
-
.sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
|
840
|
-
.to be_equivalent_to xmlpp(html)
|
841
|
-
expect(xmlpp(IsoDoc::WordConvert.new({})
|
842
|
-
.convert("test", input, true))
|
843
|
-
.sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
|
844
|
-
.to be_equivalent_to xmlpp(doc)
|
845
|
-
end
|
846
|
-
|
847
|
-
it "processes unrecognised markup" do
|
848
|
-
input = <<~INPUT
|
849
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
850
|
-
<preface><foreword>
|
851
|
-
<p>
|
852
|
-
<barry fred="http://example.com">example</barry>
|
853
|
-
</p>
|
854
|
-
</foreword></preface>
|
855
|
-
<sections>
|
856
|
-
</iso-standard>
|
857
|
-
INPUT
|
858
|
-
output = <<~OUTPUT
|
859
|
-
#{HTML_HDR}
|
860
|
-
<br/>
|
861
|
-
<div>
|
862
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
863
|
-
<p>
|
864
|
-
<para><b role="strong"><barry fred="http://example.com">example</barry></b></para>
|
865
|
-
</p>
|
866
|
-
</div>
|
867
|
-
<p class="zzSTDTitle1"/>
|
868
|
-
</div>
|
869
|
-
</body>
|
870
|
-
</html>
|
871
|
-
OUTPUT
|
872
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
873
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
874
|
-
end
|
875
|
-
|
876
|
-
it "processes AsciiMath and MathML" do
|
877
|
-
input = <<~INPUT
|
878
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
879
|
-
<preface><foreword>
|
880
|
-
<p>
|
881
|
-
<stem type="AsciiMath"><A></stem>
|
882
|
-
<stem type="MathML"><m:math><m:row>X</m:row></m:math></stem>
|
883
|
-
<stem type="None">Latex?</stem>
|
884
|
-
</p>
|
885
|
-
</foreword></preface>
|
886
|
-
<sections>
|
887
|
-
</iso-standard>
|
888
|
-
INPUT
|
889
|
-
output = <<~OUTPUT
|
890
|
-
#{HTML_HDR.sub(/<html/, "<html xmlns:m='m'")}
|
891
|
-
<br/>
|
892
|
-
<div>
|
893
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
894
|
-
<p>
|
895
|
-
<span class="stem">(#(<A>)#)</span>
|
896
|
-
<span class="stem"><m:math>
|
897
|
-
<m:row>X</m:row>
|
898
|
-
</m:math></span>
|
899
|
-
<span class="stem">Latex?</span>
|
900
|
-
</p>
|
901
|
-
</div>
|
902
|
-
<p class="zzSTDTitle1"/>
|
903
|
-
</div>
|
904
|
-
</body>
|
905
|
-
</html>
|
906
|
-
OUTPUT
|
907
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
908
|
-
.convert("test", input, true).sub(/<html/, "<html xmlns:m='m'")))
|
909
|
-
.to be_equivalent_to xmlpp(output)
|
910
|
-
end
|
911
|
-
|
912
|
-
it "overrides AsciiMath delimiters" do
|
913
|
-
input = <<~INPUT
|
914
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
915
|
-
<preface><foreword>
|
916
|
-
<p>
|
917
|
-
<stem type="AsciiMath">A</stem>
|
918
|
-
(#((Hello))#)
|
919
|
-
</p>
|
920
|
-
</foreword></preface>
|
921
|
-
<sections>
|
922
|
-
</iso-standard>
|
923
|
-
INPUT
|
924
|
-
output = <<~OUTPUT
|
925
|
-
#{HTML_HDR}
|
926
|
-
<br/>
|
927
|
-
<div>
|
928
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
929
|
-
<p>
|
930
|
-
<span class="stem">(#(((A)#)))</span>
|
931
|
-
(#((Hello))#)
|
932
|
-
</p>
|
933
|
-
</div>
|
934
|
-
<p class="zzSTDTitle1"/>
|
935
|
-
</div>
|
936
|
-
</body>
|
937
|
-
</html>
|
938
|
-
OUTPUT
|
939
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
940
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
941
|
-
end
|
942
|
-
|
943
|
-
it "duplicates MathML with AsciiMath" do
|
944
|
-
input = <<~INPUT
|
945
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml" xmlns:m='http://www.w3.org/1998/Math/MathML'>
|
946
|
-
<preface><foreword>
|
947
|
-
<p>
|
948
|
-
<stem type="MathML"><m:math>
|
949
|
-
<m:msup> <m:mrow> <m:mo>(</m:mo> <m:mrow> <m:mi>x</m:mi> <m:mo>+</m:mo> <m:mi>y</m:mi> </m:mrow> <m:mo>)</m:mo> </m:mrow> <m:mn>2</m:mn> </m:msup>
|
950
|
-
</m:math></stem>
|
951
|
-
</p>
|
952
|
-
</foreword></preface>
|
953
|
-
<sections>
|
954
|
-
</iso-standard>
|
955
|
-
INPUT
|
956
|
-
output = <<~OUTPUT
|
957
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' xmlns:m='http://www.w3.org/1998/Math/MathML' type='presentation'>
|
958
|
-
<preface>
|
959
|
-
<foreword displayorder='1'>
|
960
|
-
<p>
|
961
|
-
<stem type='MathML'>
|
962
|
-
<m:math>
|
963
|
-
<m:msup>
|
964
|
-
<m:mrow>
|
965
|
-
<m:mo>(</m:mo>
|
966
|
-
<m:mrow>
|
967
|
-
<m:mi>x</m:mi>
|
968
|
-
<m:mo>+</m:mo>
|
969
|
-
<m:mi>y</m:mi>
|
970
|
-
</m:mrow>
|
971
|
-
<m:mo>)</m:mo>
|
972
|
-
</m:mrow>
|
973
|
-
<m:mn>2</m:mn>
|
974
|
-
</m:msup>
|
975
|
-
</m:math>
|
976
|
-
<comment> ( x + y )^2 </comment>
|
977
|
-
</stem>
|
978
|
-
</p>
|
979
|
-
</foreword>
|
980
|
-
</preface>
|
981
|
-
<sections> </sections>
|
982
|
-
</iso-standard>
|
983
|
-
OUTPUT
|
984
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
985
|
-
.convert("test", input, true)
|
986
|
-
.gsub("<!--", "<comment>")
|
987
|
-
.gsub("-->", "</comment>")))
|
988
|
-
.to be_equivalent_to xmlpp(output)
|
989
|
-
end
|
990
|
-
|
991
|
-
it "overrides duplication of MathML with AsciiMath" do
|
992
|
-
input = <<~INPUT
|
993
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml" xmlns:m='http://www.w3.org/1998/Math/MathML'>
|
994
|
-
<preface><foreword>
|
995
|
-
<p>
|
996
|
-
<stem type="MathML"><m:math>
|
997
|
-
<m:msup> <m:mrow> <m:mo>(</m:mo> <m:mrow> <m:mi>x</m:mi> <m:mo>+</m:mo> <m:mi>y</m:mi> </m:mrow> <m:mo>)</m:mo> </m:mrow> <m:mn>2</m:mn> </m:msup>
|
998
|
-
</m:math></stem>
|
999
|
-
</p>
|
1000
|
-
</foreword></preface>
|
1001
|
-
<sections>
|
1002
|
-
</iso-standard>
|
1003
|
-
INPUT
|
1004
|
-
output = <<~OUTPUT
|
1005
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' xmlns:m='http://www.w3.org/1998/Math/MathML' type='presentation'>
|
1006
|
-
<preface>
|
1007
|
-
<foreword displayorder='1'>
|
1008
|
-
<p>
|
1009
|
-
<stem type='MathML'>
|
1010
|
-
<m:math>
|
1011
|
-
<m:msup>
|
1012
|
-
<m:mrow>
|
1013
|
-
<m:mo>(</m:mo>
|
1014
|
-
<m:mrow>
|
1015
|
-
<m:mi>x</m:mi>
|
1016
|
-
<m:mo>+</m:mo>
|
1017
|
-
<m:mi>y</m:mi>
|
1018
|
-
</m:mrow>
|
1019
|
-
<m:mo>)</m:mo>
|
1020
|
-
</m:mrow>
|
1021
|
-
<m:mn>2</m:mn>
|
1022
|
-
</m:msup>
|
1023
|
-
</m:math>
|
1024
|
-
</stem>
|
1025
|
-
</p>
|
1026
|
-
</foreword>
|
1027
|
-
</preface>
|
1028
|
-
<sections> </sections>
|
1029
|
-
</iso-standard>
|
1030
|
-
OUTPUT
|
1031
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
1032
|
-
.new({ suppressasciimathdup: "true" })
|
1033
|
-
.convert("test", input, true)
|
1034
|
-
.gsub("<!--", "<comment>")
|
1035
|
-
.gsub("-->", "</comment>")))
|
1036
|
-
.to be_equivalent_to xmlpp(output)
|
1037
|
-
end
|
1038
|
-
|
1039
|
-
it "processes eref types" do
|
1040
|
-
input = <<~INPUT
|
1041
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1042
|
-
<preface><foreword>
|
1043
|
-
<p>
|
1044
|
-
<eref type="footnote" bibitemid="ISO712" citeas="ISO 712">A</stem>
|
1045
|
-
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</stem>
|
1046
|
-
</p>
|
1047
|
-
</foreword></preface>
|
1048
|
-
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
|
1049
|
-
<bibitem id="ISO712" type="standard">
|
1050
|
-
<formattedref format="text/plain"><em>Cereals and cereal products</em></formattedref>
|
1051
|
-
<docidentifier>ISO 712</docidentifier>
|
1052
|
-
<contributor>
|
1053
|
-
<role type="publisher"/>
|
1054
|
-
<organization>
|
1055
|
-
<abbreviation>ISO</abbreviation>
|
1056
|
-
</organization>
|
1057
|
-
</contributor>
|
1058
|
-
</bibitem>
|
1059
|
-
</references>
|
1060
|
-
</bibliography>
|
1061
|
-
</iso-standard>
|
1062
|
-
INPUT
|
1063
|
-
output = <<~OUTPUT
|
1064
|
-
#{HTML_HDR}
|
1065
|
-
<br/>
|
1066
|
-
<div>
|
1067
|
-
<h1 class='ForewordTitle'>Foreword</h1>
|
1068
|
-
<p>
|
1069
|
-
<sup>
|
1070
|
-
<a href='#ISO712'>A</a>
|
1071
|
-
</sup>
|
1072
|
-
<a href='#ISO712'>A</a>
|
1073
|
-
</p>
|
1074
|
-
</div>
|
1075
|
-
<p class='zzSTDTitle1'/>
|
1076
|
-
<div>
|
1077
|
-
<h1>Normative References</h1>
|
1078
|
-
<p id='ISO712' class='NormRef'>
|
1079
|
-
ISO 712,
|
1080
|
-
<i>Cereals and cereal products</i>
|
1081
|
-
</p>
|
1082
|
-
</div>
|
1083
|
-
</div>
|
1084
|
-
</body>
|
1085
|
-
</html>
|
1086
|
-
OUTPUT
|
1087
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
1088
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1089
|
-
end
|
1090
|
-
|
1091
|
-
it "processes eref content" do
|
1092
|
-
input = <<~INPUT
|
1093
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1094
|
-
<preface><foreword>
|
1095
|
-
<p>
|
1096
|
-
<eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
|
1097
|
-
<eref type="inline" bibitemid="ISO712"/>
|
1098
|
-
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
|
1099
|
-
<eref type="inline" bibitemid="ISO712"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
|
1100
|
-
<eref type="inline" bibitemid="ISO712"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack connective="and"><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
|
1101
|
-
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
|
1102
|
-
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
|
1103
|
-
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
1104
|
-
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
|
1105
|
-
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
|
1106
|
-
<eref type="inline" bibitemid="ISO712"><locality type="whole"></locality></eref>
|
1107
|
-
<eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
|
1108
|
-
<eref type="inline" bibitemid="ISO712"><locality type="locality:URI"><referenceFrom>7</referenceFrom></locality></eref>
|
1109
|
-
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
|
1110
|
-
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality></eref>
|
1111
|
-
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
1112
|
-
<eref type="inline" droploc="true" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
1113
|
-
<eref type="inline" case="lowercase" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
1114
|
-
</p>
|
1115
|
-
</foreword></preface>
|
1116
|
-
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
|
1117
|
-
<bibitem id="ISO712" type="standard">
|
1118
|
-
<title format="text/plain">Cereals and cereal products</title>
|
1119
|
-
<docidentifier>ISO 712</docidentifier>
|
1120
|
-
<contributor>
|
1121
|
-
<role type="publisher"/>
|
1122
|
-
<organization>
|
1123
|
-
<abbreviation>ISO</abbreviation>
|
1124
|
-
</organization>
|
1125
|
-
</contributor>
|
1126
|
-
</bibitem>
|
1127
|
-
</references>
|
1128
|
-
</bibliography>
|
1129
|
-
</iso-standard>
|
1130
|
-
INPUT
|
1131
|
-
presxml = <<~OUTPUT
|
1132
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
1133
|
-
<preface><foreword displayorder="1">
|
1134
|
-
<p>
|
1135
|
-
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
|
1136
|
-
<eref type="inline" bibitemid="ISO712">ISO 712</eref>
|
1137
|
-
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>ISO 712, Table 1</eref>
|
1138
|
-
<eref type="inline" bibitemid="ISO712"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1</eref>
|
1139
|
-
<eref type="inline" bibitemid="ISO712"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack connective="and"><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack>ISO 712, Table 1 and Clause 1</eref>
|
1140
|
-
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality>ISO 712, Table 1–1</eref>
|
1141
|
-
<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>
|
1142
|
-
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
|
1143
|
-
<eref type="inline" bibitemid="ISO712"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality>ISO 712, Clause 1.5</eref>
|
1144
|
-
<eref type="inline" bibitemid="ISO712"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
|
1145
|
-
<eref type="inline" bibitemid="ISO712"><locality type="whole"/>ISO 712, Whole of text</eref>
|
1146
|
-
<eref type="inline" bibitemid="ISO712"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality>ISO 712, Prelude 7</eref>
|
1147
|
-
<eref type="inline" bibitemid="ISO712"><locality type="locality:URI"><referenceFrom>7</referenceFrom></locality>ISO 712, URI 7</eref>
|
1148
|
-
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">A</eref>
|
1149
|
-
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality>ISO 712</eref>
|
1150
|
-
<eref type="inline" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, Clause 1</eref>
|
1151
|
-
<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>
|
1152
|
-
<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>
|
1153
|
-
</p>
|
1154
|
-
</foreword></preface>
|
1155
|
-
<bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder=
|
1156
|
-
"2"><title depth='1'>1.<tab/>Normative References</title>
|
1157
|
-
<bibitem id="ISO712" type="standard">
|
1158
|
-
<formattedref><em>Cereals and cereal products</em>.</formattedref>
|
1159
|
-
<docidentifier>ISO 712</docidentifier>
|
1160
|
-
</bibitem>
|
1161
|
-
</references>
|
1162
|
-
</bibliography>
|
1163
|
-
</iso-standard>
|
1164
|
-
OUTPUT
|
1165
|
-
|
1166
|
-
html = <<~OUTPUT
|
1167
|
-
#{HTML_HDR}
|
1168
|
-
<br/>
|
1169
|
-
<div>
|
1170
|
-
<h1 class="ForewordTitle">Foreword</h1>
|
1171
|
-
<p>
|
1172
|
-
<a href="#ISO712">ISO 712</a>
|
1173
|
-
<a href="#ISO712">ISO 712</a>
|
1174
|
-
<a href="#ISO712">ISO 712, Table 1</a>
|
1175
|
-
<a href='#ISO712'>ISO 712, Table 1</a>
|
1176
|
-
<a href='#ISO712'>ISO 712, Table 1 and Clause 1</a>
|
1177
|
-
<a href="#ISO712">ISO 712, Table 1–1</a>
|
1178
|
-
<a href="#ISO712">ISO 712, Clause 1, Table 1</a>
|
1179
|
-
<a href="#ISO712">ISO 712, Clause 1</a>
|
1180
|
-
<a href="#ISO712">ISO 712, Clause 1.5</a>
|
1181
|
-
<a href="#ISO712">A</a>
|
1182
|
-
<a href="#ISO712">ISO 712, Whole of text</a>
|
1183
|
-
<a href="#ISO712">ISO 712, Prelude 7</a>
|
1184
|
-
<a href="#ISO712">ISO 712, URI 7</a>
|
1185
|
-
<a href="#ISO712">A</a>
|
1186
|
-
<a href='#ISO712'>ISO 712</a>
|
1187
|
-
<a href='#ISO712'>ISO 712, Clause 1</a>
|
1188
|
-
<a href='#ISO712'>ISO 712, 1</a>
|
1189
|
-
<a href='#ISO712'>ISO 712, clause 1</a>
|
1190
|
-
</p>
|
1191
|
-
</div>
|
1192
|
-
<p class="zzSTDTitle1"/>
|
1193
|
-
<div>
|
1194
|
-
<h1>1.  Normative References</h1>
|
1195
|
-
<p id="ISO712" class="NormRef">ISO 712, <i>Cereals and cereal products</i>.</p>
|
1196
|
-
</div>
|
1197
|
-
</div>
|
1198
|
-
</body>
|
1199
|
-
</html>
|
1200
|
-
OUTPUT
|
1201
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1202
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
1203
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
1204
|
-
.convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
1205
|
-
end
|
1206
|
-
|
1207
|
-
it "processes eref content pointing to reference with citation URL" do
|
1208
|
-
input = <<~INPUT
|
1209
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1210
|
-
<preface><foreword>
|
1211
|
-
<p>
|
1212
|
-
<eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
|
1213
|
-
<eref type="inline" bibitemid="ISO712"/>
|
1214
|
-
<eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
|
1215
|
-
<eref type="inline" bibitemid="ISO713"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
|
1216
|
-
<eref type="inline" bibitemid="ISO713"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack connective="and"><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
|
1217
|
-
<eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
|
1218
|
-
<eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
|
1219
|
-
<eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
1220
|
-
<eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
|
1221
|
-
<eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
|
1222
|
-
<eref type="inline" bibitemid="ISO713"><locality type="whole"></locality></eref>
|
1223
|
-
<eref type="inline" bibitemid="ISO713"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
|
1224
|
-
<eref type="inline" bibitemid="ISO713" citeas="ISO 713">A</eref>
|
1225
|
-
<eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality></eref>
|
1226
|
-
<eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
1227
|
-
<eref type="inline" bibitemid="ISO714"/>
|
1228
|
-
</p>
|
1229
|
-
</foreword></preface>
|
1230
|
-
<bibliography><references id="_normative_references" obligation="informative" normative="true"><title>Normative References</title>
|
1231
|
-
<bibitem id="ISO712" type="standard">
|
1232
|
-
<title format="text/plain">Cereals and cereal products</title>
|
1233
|
-
<uri type="citation">http://www.example.com</uri>
|
1234
|
-
<docidentifier>ISO 712</docidentifier>
|
1235
|
-
<contributor>
|
1236
|
-
<role type="publisher"/>
|
1237
|
-
<organization>
|
1238
|
-
<abbreviation>ISO</abbreviation>
|
1239
|
-
</organization>
|
1240
|
-
</contributor>
|
1241
|
-
</bibitem>
|
1242
|
-
<bibitem id="ISO713" type="standard">
|
1243
|
-
<title format="text/plain">Cereals and cereal products</title>
|
1244
|
-
<uri type="citation">spec/assets/iso713</uri>
|
1245
|
-
<docidentifier>ISO 713</docidentifier>
|
1246
|
-
<contributor>
|
1247
|
-
<role type="publisher"/>
|
1248
|
-
<organization>
|
1249
|
-
<abbreviation>ISO</abbreviation>
|
1250
|
-
</organization>
|
1251
|
-
</contributor>
|
1252
|
-
</bibitem>
|
1253
|
-
<bibitem id="ISO714" type="standard">
|
1254
|
-
<title format="text/plain">Cereals and cereal products</title>
|
1255
|
-
<uri type="citation">spec/assets/iso714.svg</uri>
|
1256
|
-
<docidentifier>ISO 714</docidentifier>
|
1257
|
-
<contributor>
|
1258
|
-
<role type="publisher"/>
|
1259
|
-
<organization>
|
1260
|
-
<abbreviation>ISO</abbreviation>
|
1261
|
-
</organization>
|
1262
|
-
</contributor>
|
1263
|
-
</bibitem>
|
1264
|
-
</references>
|
1265
|
-
</bibliography>
|
1266
|
-
</iso-standard>
|
1267
|
-
INPUT
|
1268
|
-
presxml = <<~OUTPUT
|
1269
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
1270
|
-
<preface>
|
1271
|
-
<foreword displayorder="1">
|
1272
|
-
<p>
|
1273
|
-
<eref type='inline' bibitemid='ISO712' citeas='ISO 712'>ISO 712</eref>
|
1274
|
-
<eref type='inline' bibitemid='ISO712'>ISO 712</eref>
|
1275
|
-
<eref type='inline' bibitemid='ISO713'><locality type='table'>
|
1276
|
-
<referenceFrom>1</referenceFrom>
|
1277
|
-
</locality>ISO 713, Table 1</eref>
|
1278
|
-
<eref type='inline' bibitemid='ISO713'><localityStack connective="and"><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1</eref>
|
1279
|
-
<eref type='inline' bibitemid='ISO713'><localityStack connective="and"><locality type='table'><referenceFrom>1</referenceFrom></locality></localityStack><localityStack connective="and"><locality type='clause'><referenceFrom>1</referenceFrom></locality></localityStack>ISO 713, Table 1 and Clause 1</eref>
|
1280
|
-
<eref type='inline' bibitemid='ISO713'><locality type='table'>
|
1281
|
-
<referenceFrom>1</referenceFrom>
|
1282
|
-
<referenceTo>1</referenceTo>
|
1283
|
-
</locality>ISO 713, Table 1–1</eref>
|
1284
|
-
<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>
|
1285
|
-
<eref type='inline' bibitemid='ISO713'><locality type='clause'>
|
1286
|
-
<referenceFrom>1</referenceFrom>
|
1287
|
-
</locality>ISO 713, Clause 1</eref>
|
1288
|
-
<eref type='inline' bibitemid='ISO713'><locality type='clause'>
|
1289
|
-
<referenceFrom>1.5</referenceFrom>
|
1290
|
-
</locality>ISO 713, Clause 1.5</eref>
|
1291
|
-
<eref type='inline' bibitemid='ISO713'><locality type='table'>
|
1292
|
-
<referenceFrom>1</referenceFrom>
|
1293
|
-
</locality>A</eref>
|
1294
|
-
<eref type='inline' bibitemid='ISO713'><locality type='whole'/>ISO 713, Whole of text</eref>
|
1295
|
-
<eref type='inline' bibitemid='ISO713'><locality type='locality:prelude'>
|
1296
|
-
<referenceFrom>7</referenceFrom>
|
1297
|
-
</locality>ISO 713, Prelude 7</eref>
|
1298
|
-
<eref type='inline' bibitemid='ISO713' citeas='ISO 713'>A</eref>
|
1299
|
-
<eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality>ISO 713</eref>
|
1300
|
-
<eref type='inline' bibitemid='ISO713'><locality type='anchor'><referenceFrom>xyz</referenceFrom></locality><locality type='clause'><referenceFrom>1</referenceFrom></locality>ISO 713, Clause 1</eref>
|
1301
|
-
<eref type='inline' bibitemid='ISO714'>ISO 714</eref>
|
1302
|
-
</p>
|
1303
|
-
</foreword>
|
1304
|
-
</preface>
|
1305
|
-
<bibliography>
|
1306
|
-
<references id='_normative_references' obligation='informative' normative='true' displayorder="2">
|
1307
|
-
<title depth='1'>1.<tab/>Normative References</title>
|
1308
|
-
<bibitem id='ISO712' type='standard'>
|
1309
|
-
<formattedref><em>Cereals and cereal products</em>. <link target="http://www.example.com">http://www.example.com</link>.</formattedref>
|
1310
|
-
<uri type='citation'>http://www.example.com</uri>
|
1311
|
-
<docidentifier>ISO 712</docidentifier>
|
1312
|
-
</bibitem>
|
1313
|
-
<bibitem id='ISO713' type='standard'>
|
1314
|
-
<formattedref><em>Cereals and cereal products</em>. <link target="spec/assets/iso713">spec/assets/iso713</link>.</formattedref>
|
1315
|
-
<uri type='citation'>spec/assets/iso713</uri>
|
1316
|
-
<docidentifier>ISO 713</docidentifier>
|
1317
|
-
</bibitem>
|
1318
|
-
<bibitem id='ISO714' type='standard'>
|
1319
|
-
<formattedref><em>Cereals and cereal products</em>. <link target="spec/assets/iso714.svg">spec/assets/iso714.svg</link>.</formattedref>
|
1320
|
-
<uri type='citation'>spec/assets/iso714.svg</uri>
|
1321
|
-
<docidentifier>ISO 714</docidentifier>
|
1322
|
-
</bibitem>
|
1323
|
-
</references>
|
1324
|
-
</bibliography>
|
1325
|
-
</iso-standard>
|
1326
|
-
OUTPUT
|
1327
|
-
|
1328
|
-
html = <<~OUTPUT
|
1329
|
-
#{HTML_HDR}
|
1330
|
-
<br/>
|
1331
|
-
<div>
|
1332
|
-
<h1 class='ForewordTitle'>Foreword</h1>
|
1333
|
-
<p>
|
1334
|
-
<a href='http://www.example.com'>ISO 712</a>
|
1335
|
-
<a href='http://www.example.com'>ISO 712</a>
|
1336
|
-
<a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
|
1337
|
-
<a href='spec/assets/iso713.html'>ISO 713, Table 1</a>
|
1338
|
-
<a href='spec/assets/iso713.html'>ISO 713, Table 1 and Clause 1</a>
|
1339
|
-
<a href='spec/assets/iso713.html'>ISO 713, Table 1–1</a>
|
1340
|
-
<a href='spec/assets/iso713.html'>ISO 713, Clause 1, Table 1</a>
|
1341
|
-
<a href='spec/assets/iso713.html'>ISO 713, Clause 1</a>
|
1342
|
-
<a href='spec/assets/iso713.html'>ISO 713, Clause 1.5</a>
|
1343
|
-
<a href='spec/assets/iso713.html'>A</a>
|
1344
|
-
<a href='spec/assets/iso713.html'>ISO 713, Whole of text</a>
|
1345
|
-
<a href='spec/assets/iso713.html'>ISO 713, Prelude 7</a>
|
1346
|
-
<a href='spec/assets/iso713.html'>A</a>
|
1347
|
-
<a href='spec/assets/iso713.html#xyz'>ISO 713</a>
|
1348
|
-
<a href='spec/assets/iso713.html#xyz'>ISO 713, Clause 1</a>
|
1349
|
-
<a href='spec/assets/iso714.svg'>ISO 714</a>
|
1350
|
-
</p>
|
1351
|
-
</div>
|
1352
|
-
<p class='zzSTDTitle1'/>
|
1353
|
-
<div>
|
1354
|
-
<h1>1.  Normative References</h1>
|
1355
|
-
<p id='ISO712' class='NormRef'>
|
1356
|
-
ISO 712,
|
1357
|
-
<i>Cereals and cereal products</i>.
|
1358
|
-
<a href='http://www.example.com'>http://www.example.com</a>.
|
1359
|
-
</p>
|
1360
|
-
<p id='ISO713' class='NormRef'>
|
1361
|
-
ISO 713,
|
1362
|
-
<i>Cereals and cereal products</i>.
|
1363
|
-
<a href='spec/assets/iso713'>spec/assets/iso713</a>.
|
1364
|
-
</p>
|
1365
|
-
<p id='ISO714' class='NormRef'>
|
1366
|
-
ISO 714,
|
1367
|
-
<i>Cereals and cereal products</i>.
|
1368
|
-
<a href='spec/assets/iso714.svg'>spec/assets/iso714.svg</a>.
|
1369
|
-
</p>
|
1370
|
-
</div>
|
1371
|
-
</div>
|
1372
|
-
</body>
|
1373
|
-
</html>
|
1374
|
-
OUTPUT
|
1375
|
-
|
1376
|
-
word = <<~OUTPUT
|
1377
|
-
<html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
|
1378
|
-
<head>
|
1379
|
-
<style>
|
1380
|
-
</style>
|
1381
|
-
</head>
|
1382
|
-
<body lang='EN-US' link='blue' vlink='#954F72'>
|
1383
|
-
<div class='WordSection1'>
|
1384
|
-
<p> </p>
|
1385
|
-
</div>
|
1386
|
-
<p>
|
1387
|
-
<br clear='all' class='section'/>
|
1388
|
-
</p>
|
1389
|
-
<div class='WordSection2'>
|
1390
|
-
<p>
|
1391
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1392
|
-
</p>
|
1393
|
-
<div>
|
1394
|
-
<h1 class='ForewordTitle'>Foreword</h1>
|
1395
|
-
<p>
|
1396
|
-
<a href='http://www.example.com'>ISO 712</a>
|
1397
|
-
<a href='http://www.example.com'>ISO 712</a>
|
1398
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
|
1399
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
|
1400
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Table 1 and Clause 1</a>
|
1401
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Table 1–1</a>
|
1402
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Clause 1, Table 1</a>
|
1403
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Clause 1</a>
|
1404
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Clause 1.5</a>
|
1405
|
-
<a href='spec/assets/iso713.doc'>A</a>
|
1406
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Whole of text</a>
|
1407
|
-
<a href='spec/assets/iso713.doc'>ISO 713, Prelude 7</a>
|
1408
|
-
<a href='spec/assets/iso713.doc'>A</a>
|
1409
|
-
<a href='spec/assets/iso713.doc#xyz'>ISO 713</a>
|
1410
|
-
<a href='spec/assets/iso713.doc#xyz'>ISO 713, Clause 1</a>
|
1411
|
-
<a href='spec/assets/iso714.svg'>ISO 714</a>
|
1412
|
-
</p>
|
1413
|
-
</div>
|
1414
|
-
<p> </p>
|
1415
|
-
</div>
|
1416
|
-
<p>
|
1417
|
-
<br clear='all' class='section'/>
|
1418
|
-
</p>
|
1419
|
-
<div class='WordSection3'>
|
1420
|
-
<p class='zzSTDTitle1'/>
|
1421
|
-
<div>
|
1422
|
-
<h1>
|
1423
|
-
1.
|
1424
|
-
<span style='mso-tab-count:1'>  </span>
|
1425
|
-
Normative References
|
1426
|
-
</h1>
|
1427
|
-
<p id='ISO712' class='NormRef'>
|
1428
|
-
ISO 712,
|
1429
|
-
<i>Cereals and cereal products</i>.
|
1430
|
-
<a href='http://www.example.com'>http://www.example.com</a>.
|
1431
|
-
</p>
|
1432
|
-
<p id='ISO713' class='NormRef'>
|
1433
|
-
ISO 713,
|
1434
|
-
<i>Cereals and cereal products</i>.
|
1435
|
-
<a href='spec/assets/iso713'>spec/assets/iso713</a>.
|
1436
|
-
</p>
|
1437
|
-
<p id='ISO714' class='NormRef'>
|
1438
|
-
ISO 714,
|
1439
|
-
<i>Cereals and cereal products</i>.
|
1440
|
-
<a href='spec/assets/iso714.svg'>spec/assets/iso714.svg</a>.
|
1441
|
-
</p>
|
1442
|
-
</div>
|
1443
|
-
</div>
|
1444
|
-
</body>
|
1445
|
-
</html>
|
1446
|
-
OUTPUT
|
1447
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1448
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
1449
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
1450
|
-
.convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
1451
|
-
expect(xmlpp(IsoDoc::WordConvert.new({})
|
1452
|
-
.convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
|
1453
|
-
end
|
1454
|
-
|
1455
|
-
it "processes eref content pointing to hidden bibliographic entries" do
|
1456
|
-
input = <<~INPUT
|
1457
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1458
|
-
<preface><foreword>
|
1459
|
-
<p>
|
1460
|
-
<eref type="inline" bibitemid="ISO712" citeas="ISO 712"/>
|
1461
|
-
<eref type="inline" bibitemid="ISO712"/>
|
1462
|
-
<eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
|
1463
|
-
<eref type="inline" bibitemid="ISO713"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
|
1464
|
-
<eref type="inline" bibitemid="ISO713"><localityStack connective="and"><locality type="table"><referenceFrom>1</referenceFrom></locality></localityStack><localityStack connective="and"><locality type="clause"><referenceFrom>1</referenceFrom></locality></localityStack></eref>
|
1465
|
-
<eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom><referenceTo>1</referenceTo></locality></eref>
|
1466
|
-
<eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality><locality type="table"><referenceFrom>1</referenceFrom></locality></eref>
|
1467
|
-
<eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
1468
|
-
<eref type="inline" bibitemid="ISO713"><locality type="clause"><referenceFrom>1.5</referenceFrom></locality></eref>
|
1469
|
-
<eref type="inline" bibitemid="ISO713"><locality type="table"><referenceFrom>1</referenceFrom></locality>A</eref>
|
1470
|
-
<eref type="inline" bibitemid="ISO713"><locality type="whole"></locality></eref>
|
1471
|
-
<eref type="inline" bibitemid="ISO713"><locality type="locality:prelude"><referenceFrom>7</referenceFrom></locality></eref>
|
1472
|
-
<eref type="inline" bibitemid="ISO713" citeas="ISO 713">A</eref>
|
1473
|
-
<eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality></eref>
|
1474
|
-
<eref type="inline" bibitemid="ISO713"><locality type="anchor"><referenceFrom>xyz</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality></eref>
|
1475
|
-
</p>
|
1476
|
-
</foreword></preface>
|
1477
|
-
<bibliography><references id="_normative_references" obligation="informative" normative="true" hidden="true"><title>Normative References</title>
|
1478
|
-
<bibitem id="ISO712" type="standard" hidden="true">
|
1479
|
-
<title format="text/plain">Cereals and cereal products</title>
|
1480
|
-
<uri type="citation">http://www.example.com</uri>
|
1481
|
-
<docidentifier>ISO 712</docidentifier>
|
1482
|
-
<contributor>
|
1483
|
-
<role type="publisher"/>
|
1484
|
-
<organization>
|
1485
|
-
<abbreviation>ISO</abbreviation>
|
1486
|
-
</organization>
|
1487
|
-
</contributor>
|
1488
|
-
</bibitem>
|
1489
|
-
<bibitem id="ISO713" type="standard" hidden="true">
|
1490
|
-
<title format="text/plain">Cereals and cereal products</title>
|
1491
|
-
<uri type='src'>https://www.iso.org/standard/3944.html</uri>
|
1492
|
-
<uri type='rss'>https://www.iso.org/contents/data/standard/00/39/3944.detail.rss</uri>
|
1493
|
-
<docidentifier>ISO 713</docidentifier>
|
1494
|
-
<contributor>
|
1495
|
-
<role type="publisher"/>
|
1496
|
-
<organization>
|
1497
|
-
<abbreviation>ISO</abbreviation>
|
1498
|
-
</organization>
|
1499
|
-
</contributor>
|
1500
|
-
</bibitem>
|
1501
|
-
INPUT
|
1502
|
-
presxml = <<~PRESXML
|
1503
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1504
|
-
<preface>
|
1505
|
-
<foreword displayorder='1'>
|
1506
|
-
<p>
|
1507
|
-
<eref type='inline' bibitemid='ISO712' citeas='ISO 712'>ISO 712</eref>
|
1508
|
-
<eref type='inline' bibitemid='ISO712'>ISO 712</eref>
|
1509
|
-
<eref type='inline' bibitemid='ISO713'>
|
1510
|
-
<locality type='table'>
|
1511
|
-
<referenceFrom>1</referenceFrom>
|
1512
|
-
</locality>
|
1513
|
-
ISO 713, Table 1
|
1514
|
-
</eref>
|
1515
|
-
<eref type='inline' bibitemid='ISO713'>
|
1516
|
-
<localityStack connective="and">
|
1517
|
-
<locality type='table'>
|
1518
|
-
<referenceFrom>1</referenceFrom>
|
1519
|
-
</locality>
|
1520
|
-
</localityStack>
|
1521
|
-
ISO 713, Table 1
|
1522
|
-
</eref>
|
1523
|
-
<eref type='inline' bibitemid='ISO713'>
|
1524
|
-
<localityStack connective="and">
|
1525
|
-
<locality type='table'>
|
1526
|
-
<referenceFrom>1</referenceFrom>
|
1527
|
-
</locality>
|
1528
|
-
</localityStack>
|
1529
|
-
<localityStack connective="and">
|
1530
|
-
<locality type='clause'>
|
1531
|
-
<referenceFrom>1</referenceFrom>
|
1532
|
-
</locality>
|
1533
|
-
</localityStack>
|
1534
|
-
ISO 713, Table 1 and Clause 1
|
1535
|
-
</eref>
|
1536
|
-
<eref type='inline' bibitemid='ISO713'>
|
1537
|
-
<locality type='table'>
|
1538
|
-
<referenceFrom>1</referenceFrom>
|
1539
|
-
<referenceTo>1</referenceTo>
|
1540
|
-
</locality>
|
1541
|
-
ISO 713, Table 1–1
|
1542
|
-
</eref>
|
1543
|
-
<eref type='inline' bibitemid='ISO713'>
|
1544
|
-
<locality type='clause'>
|
1545
|
-
<referenceFrom>1</referenceFrom>
|
1546
|
-
</locality>
|
1547
|
-
<locality type='table'>
|
1548
|
-
<referenceFrom>1</referenceFrom>
|
1549
|
-
</locality>
|
1550
|
-
ISO 713, Clause 1, Table 1
|
1551
|
-
</eref>
|
1552
|
-
<eref type='inline' bibitemid='ISO713'>
|
1553
|
-
<locality type='clause'>
|
1554
|
-
<referenceFrom>1</referenceFrom>
|
1555
|
-
</locality>
|
1556
|
-
ISO 713, Clause 1
|
1557
|
-
</eref>
|
1558
|
-
<eref type='inline' bibitemid='ISO713'>
|
1559
|
-
<locality type='clause'>
|
1560
|
-
<referenceFrom>1.5</referenceFrom>
|
1561
|
-
</locality>
|
1562
|
-
ISO 713, Clause 1.5
|
1563
|
-
</eref>
|
1564
|
-
<eref type='inline' bibitemid='ISO713'>
|
1565
|
-
<locality type='table'>
|
1566
|
-
<referenceFrom>1</referenceFrom>
|
1567
|
-
</locality>
|
1568
|
-
A
|
1569
|
-
</eref>
|
1570
|
-
<eref type='inline' bibitemid='ISO713'>
|
1571
|
-
<locality type='whole'/>
|
1572
|
-
ISO 713, Whole of text
|
1573
|
-
</eref>
|
1574
|
-
<eref type='inline' bibitemid='ISO713'>
|
1575
|
-
<locality type='locality:prelude'>
|
1576
|
-
<referenceFrom>7</referenceFrom>
|
1577
|
-
</locality>
|
1578
|
-
ISO 713, Prelude 7
|
1579
|
-
</eref>
|
1580
|
-
<eref type='inline' bibitemid='ISO713' citeas='ISO 713'>A</eref>
|
1581
|
-
<eref type='inline' bibitemid='ISO713'>
|
1582
|
-
<locality type='anchor'>
|
1583
|
-
<referenceFrom>xyz</referenceFrom>
|
1584
|
-
</locality>
|
1585
|
-
ISO 713
|
1586
|
-
</eref>
|
1587
|
-
<eref type='inline' bibitemid='ISO713'>
|
1588
|
-
<locality type='anchor'>
|
1589
|
-
<referenceFrom>xyz</referenceFrom>
|
1590
|
-
</locality>
|
1591
|
-
<locality type='clause'>
|
1592
|
-
<referenceFrom>1</referenceFrom>
|
1593
|
-
</locality>
|
1594
|
-
ISO 713, Clause 1
|
1595
|
-
</eref>
|
1596
|
-
</p>
|
1597
|
-
</foreword>
|
1598
|
-
</preface>
|
1599
|
-
<bibliography>
|
1600
|
-
<references id='_normative_references' obligation='informative' normative='true' displayorder='2' hidden="true">
|
1601
|
-
<title depth='1'>Normative References</title>
|
1602
|
-
<bibitem id='ISO712' type='standard' hidden="true">
|
1603
|
-
<formattedref><em>Cereals and cereal products</em>. <link target="http://www.example.com">http://www.example.com</link>.</formattedref>
|
1604
|
-
<uri type='citation'>http://www.example.com</uri>
|
1605
|
-
<docidentifier>ISO 712</docidentifier>
|
1606
|
-
</bibitem>
|
1607
|
-
<bibitem id='ISO713' type='standard' hidden="true">
|
1608
|
-
<formattedref><em>Cereals and cereal products</em>. <link target="https://www.iso.org/standard/3944.html">https://www.iso.org/standard/3944.html</link>.</formattedref>
|
1609
|
-
<uri type='src'>https://www.iso.org/standard/3944.html</uri>
|
1610
|
-
<uri type='rss'>https://www.iso.org/contents/data/standard/00/39/3944.detail.rss</uri>
|
1611
|
-
<docidentifier>ISO 713</docidentifier>
|
1612
|
-
</bibitem>
|
1613
|
-
</references>
|
1614
|
-
</bibliography>
|
1615
|
-
</iso-standard>
|
1616
|
-
PRESXML
|
1617
|
-
html = <<~OUTPUT
|
1618
|
-
#{HTML_HDR}
|
1619
|
-
<br/>
|
1620
|
-
<div>
|
1621
|
-
<h1 class='ForewordTitle'>Foreword</h1>
|
1622
|
-
<p>
|
1623
|
-
<a href='http://www.example.com'>ISO 712</a>
|
1624
|
-
<a href='http://www.example.com'>ISO 712</a>
|
1625
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1 </a>
|
1626
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1 </a>
|
1627
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1 and Clause 1 </a>
|
1628
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1–1 </a>
|
1629
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Clause 1, Table 1 </a>
|
1630
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Clause 1 </a>
|
1631
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Clause 1.5 </a>
|
1632
|
-
<a href='https://www.iso.org/standard/3944.html'> A </a>
|
1633
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Whole of text </a>
|
1634
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Prelude 7 </a>
|
1635
|
-
<a href='https://www.iso.org/standard/3944.html'>A</a>
|
1636
|
-
<a href='https://www.iso.org/standard/3944.html#xyz'> ISO 713 </a>
|
1637
|
-
<a href='https://www.iso.org/standard/3944.html#xyz'> ISO 713, Clause 1 </a>
|
1638
|
-
</p>
|
1639
|
-
</div>
|
1640
|
-
<p class='zzSTDTitle1'/>
|
1641
|
-
</div>
|
1642
|
-
</body>
|
1643
|
-
</html>
|
1644
|
-
OUTPUT
|
1645
|
-
word = <<~OUTPUT
|
1646
|
-
<html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
|
1647
|
-
<head><style/></head>
|
1648
|
-
<body lang='EN-US' link='blue' vlink='#954F72'>
|
1649
|
-
<div class='WordSection1'>
|
1650
|
-
<p> </p>
|
1651
|
-
</div>
|
1652
|
-
<p>
|
1653
|
-
<br clear='all' class='section'/>
|
1654
|
-
</p>
|
1655
|
-
<div class='WordSection2'>
|
1656
|
-
<p>
|
1657
|
-
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1658
|
-
</p>
|
1659
|
-
<div>
|
1660
|
-
<h1 class='ForewordTitle'>Foreword</h1>
|
1661
|
-
<p>
|
1662
|
-
<a href='http://www.example.com'>ISO 712</a>
|
1663
|
-
<a href='http://www.example.com'>ISO 712</a>
|
1664
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1 </a>
|
1665
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1 </a>
|
1666
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1 and Clause 1 </a>
|
1667
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Table 1–1 </a>
|
1668
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Clause 1, Table 1 </a>
|
1669
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Clause 1 </a>
|
1670
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Clause 1.5 </a>
|
1671
|
-
<a href='https://www.iso.org/standard/3944.html'> A </a>
|
1672
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Whole of text </a>
|
1673
|
-
<a href='https://www.iso.org/standard/3944.html'> ISO 713, Prelude 7 </a>
|
1674
|
-
<a href='https://www.iso.org/standard/3944.html'>A</a>
|
1675
|
-
<a href='https://www.iso.org/standard/3944.html#xyz'> ISO 713 </a>
|
1676
|
-
<a href='https://www.iso.org/standard/3944.html#xyz'> ISO 713, Clause 1 </a>
|
1677
|
-
</p>
|
1678
|
-
</div>
|
1679
|
-
<p> </p>
|
1680
|
-
</div>
|
1681
|
-
<p>
|
1682
|
-
<br clear='all' class='section'/>
|
1683
|
-
</p>
|
1684
|
-
<div class='WordSection3'>
|
1685
|
-
<p class='zzSTDTitle1'/>
|
1686
|
-
</div>
|
1687
|
-
</body>
|
1688
|
-
</html>
|
1689
|
-
OUTPUT
|
1690
|
-
|
1691
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1692
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
1693
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
1694
|
-
.convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
1695
|
-
expect(xmlpp(IsoDoc::WordConvert.new({})
|
1696
|
-
.convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
|
1697
|
-
end
|
1698
|
-
|
1699
|
-
it "processes eref content with Unicode characters" do
|
1700
|
-
input = <<~INPUT
|
1701
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1702
|
-
<preface><foreword>
|
1703
|
-
<p>
|
1704
|
-
<eref type="inline" bibitemid="ISO712" citeas="BSI BS EN ISO 19011:2018 — TC"/>
|
1705
|
-
</foreword></preface>
|
1706
|
-
<bibliography>
|
1707
|
-
<references id='_normative_references' obligation='informative' normative='true' displayorder="2">
|
1708
|
-
<title>Normative References</title>
|
1709
|
-
<bibitem id='ISO712' type='standard'>
|
1710
|
-
<title format='text/plain'>Cereals and cereal products</title>
|
1711
|
-
<uri type='citation'>http://www.example.com</uri>
|
1712
|
-
<docidentifier>ISO 712</docidentifier>
|
1713
|
-
<contributor>
|
1714
|
-
<role type='publisher'/>
|
1715
|
-
<organization>
|
1716
|
-
<abbreviation>ISO</abbreviation>
|
1717
|
-
</organization>
|
1718
|
-
</contributor>
|
1719
|
-
</bibitem>
|
1720
|
-
</references></bibliography>
|
1721
|
-
</iso-standard>
|
1722
|
-
INPUT
|
1723
|
-
presxml = <<~OUTPUT
|
1724
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1725
|
-
<preface>
|
1726
|
-
<foreword displayorder='1'>
|
1727
|
-
<p>
|
1728
|
-
<eref type='inline' bibitemid='ISO712' citeas='BSI BS EN ISO 19011:2018 — TC'>BSI BS EN ISO 19011:2018 — TC</eref>
|
1729
|
-
</p>
|
1730
|
-
</foreword>
|
1731
|
-
<bibliography displayorder='2'>
|
1732
|
-
<references id='_normative_references' obligation='informative' normative='true' displayorder='3'>
|
1733
|
-
<title depth='1'>
|
1734
|
-
1.
|
1735
|
-
<tab/>
|
1736
|
-
Normative References
|
1737
|
-
</title>
|
1738
|
-
<bibitem id='ISO712' type='standard'>
|
1739
|
-
<formattedref><em>Cereals and cereal products</em>. <link target="http://www.example.com">http://www.example.com</link>.</formattedref>
|
1740
|
-
<uri type='citation'>http://www.example.com</uri>
|
1741
|
-
<docidentifier>ISO 712</docidentifier>
|
1742
|
-
</bibitem>
|
1743
|
-
</references>
|
1744
|
-
</bibliography>
|
1745
|
-
</preface>
|
1746
|
-
</iso-standard>
|
1747
|
-
OUTPUT
|
1748
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1749
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
1750
|
-
end
|
1751
|
-
|
1752
|
-
it "processes variant" do
|
1753
|
-
input = <<~INPUT
|
1754
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1755
|
-
<bibdata>
|
1756
|
-
<language>en</language>
|
1757
|
-
<script>Latn</script>
|
1758
|
-
</bibdata>
|
1759
|
-
<preface>
|
1760
|
-
<clause id="A"><title><variant lang="en" script="Latn">ABC</variant><variant lang="fr" script="Latn">DEF</variant></title></clause>
|
1761
|
-
<clause id="A1"><title><variant lang="en" script="Grek">ABC</variant><variant lang="fr" script="Grek">DEF</variant></title></clause>
|
1762
|
-
<clause id="A2"><title><variant lang="en">ABC</variant><variant lang="fr">DEF</variant></title></clause>
|
1763
|
-
<clause id="B"><title><variant lang="de" script="Latn">GHI</variant><variant lang="es" script="Latn">JKL</variant></title></clause>
|
1764
|
-
<clause id="C"><title><variant lang="fr" script="Latn">ABC</variant><variant lang="en" script="Latn">DEF</variant></title></clause>
|
1765
|
-
<clause id="C1"><title><variant lang="fr" script="Grek">ABC</variant><variant lang="en" script="Grek">DEF</variant></title></clause>
|
1766
|
-
<clause id="C2"><title><variant lang="fr">ABC</variant><variant lang="en">DEF</variant></title></clause>
|
1767
|
-
<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>
|
1768
|
-
</preface>
|
1769
|
-
</iso-standard>
|
1770
|
-
INPUT
|
1771
|
-
output = <<~OUTPUT
|
1772
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1773
|
-
<bibdata>
|
1774
|
-
<language current='true'>en</language>
|
1775
|
-
<script current='true'>Latn</script>
|
1776
|
-
</bibdata>
|
1777
|
-
<preface>
|
1778
|
-
<clause id='A' displayorder='1'>
|
1779
|
-
<title depth='1'>ABC</title>
|
1780
|
-
</clause>
|
1781
|
-
<clause id='A1' displayorder='2'>
|
1782
|
-
<title depth='1'>ABC/DEF</title>
|
1783
|
-
</clause>
|
1784
|
-
<clause id='A2' displayorder='3'>
|
1785
|
-
<title depth='1'>ABC</title>
|
1786
|
-
</clause>
|
1787
|
-
<clause id='B' displayorder='4'>
|
1788
|
-
<title depth='1'>GHI/JKL</title>
|
1789
|
-
</clause>
|
1790
|
-
<clause id='C' displayorder='5'>
|
1791
|
-
<title depth='1'>DEF</title>
|
1792
|
-
</clause>
|
1793
|
-
<clause id='C1' displayorder='6'>
|
1794
|
-
<title depth='1'>ABC/DEF</title>
|
1795
|
-
</clause>
|
1796
|
-
<clause id='C2' displayorder='7'>
|
1797
|
-
<title depth='1'>DEF</title>
|
1798
|
-
</clause>
|
1799
|
-
<p displayorder='8'>A B D E</p>
|
1800
|
-
</preface>
|
1801
|
-
</iso-standard>
|
1802
|
-
OUTPUT
|
1803
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1804
|
-
.convert("test", input, true)
|
1805
|
-
.sub(%r{<localized-strings>.*</localized-strings>}m, "")))
|
1806
|
-
.to be_equivalent_to xmlpp(output)
|
1807
|
-
end
|
1808
|
-
|
1809
|
-
it "cases xrefs" do
|
1810
|
-
input = <<~INPUT
|
1811
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1812
|
-
<preface>
|
1813
|
-
<clause id="CC"><title>Introduction</title></clause>
|
1814
|
-
<sections>
|
1815
|
-
<clause id="A">
|
1816
|
-
<table id="B">
|
1817
|
-
</table>
|
1818
|
-
<figure id="B1"/>
|
1819
|
-
<example id="B2"/>
|
1820
|
-
</clause>
|
1821
|
-
<clause id="C">
|
1822
|
-
<p>This is <xref target="A"/> and <xref target="B"/>.
|
1823
|
-
This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
|
1824
|
-
This is <xref target="A" case="lowercase"/> and <xref target="B" case="capital"/>.
|
1825
|
-
Downcasing an xref affects only the first letter: <xref target="B2" case="lowercase"/>.
|
1826
|
-
Capitalising an xref affects only the first letter: <xref target="B1" case="capital"/>.
|
1827
|
-
<xref target="A"/> is clause <em>initial.</em><br/>
|
1828
|
-
<xref target="A"/> is too. </p>
|
1829
|
-
<p><xref target="A"/> is also.</p>
|
1830
|
-
<p>Annex has formatting, and crossreferences ignore it when determining casing. <xref target="AA"/>.</p>
|
1831
|
-
<p>Labels are not subject to casing: <xref target="CC" case="lowercase"/>
|
1832
|
-
</clause>
|
1833
|
-
<annex id="AA">
|
1834
|
-
<clause id="AA1"/>
|
1835
|
-
</annex>
|
1836
|
-
</sections>
|
1837
|
-
</iso-standard>
|
1838
|
-
INPUT
|
1839
|
-
output = <<~OUTPUT
|
1840
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1841
|
-
<preface>
|
1842
|
-
<clause id='CC' displayorder='1'>
|
1843
|
-
<title depth='1'>Introduction</title>
|
1844
|
-
</clause>
|
1845
|
-
<sections displayorder='2'>
|
1846
|
-
<clause id='A' displayorder='3'>
|
1847
|
-
<title>1.</title>
|
1848
|
-
<table id='B'>
|
1849
|
-
<name>Tabelo 1</name>
|
1850
|
-
</table>
|
1851
|
-
<figure id='B1'>
|
1852
|
-
<name>Figur-etikedo duvorta 1</name>
|
1853
|
-
</figure>
|
1854
|
-
<example id='B2'>
|
1855
|
-
<name>Ekzempl-etikedo Duvorta</name>
|
1856
|
-
</example>
|
1857
|
-
</clause>
|
1858
|
-
<clause id='C' displayorder='4'>
|
1859
|
-
<title>2.</title>
|
1860
|
-
<p>
|
1861
|
-
This is
|
1862
|
-
<xref target='A'>klaŭzo 1</xref>
|
1863
|
-
and
|
1864
|
-
<xref target='B'>tabelo 1</xref>
|
1865
|
-
. This is
|
1866
|
-
<xref target='A' case='capital'>Klaŭzo 1</xref>
|
1867
|
-
and
|
1868
|
-
<xref target='B' case='lowercase'>tabelo 1</xref>
|
1869
|
-
. This is
|
1870
|
-
<xref target='A' case='lowercase'>klaŭzo 1</xref>
|
1871
|
-
and
|
1872
|
-
<xref target='B' case='capital'>Tabelo 1</xref>
|
1873
|
-
. Downcasing an xref affects only the first letter:
|
1874
|
-
<xref target='B2' case='lowercase'>klaŭzo 1, Example</xref>
|
1875
|
-
. Capitalising an xref affects only the first letter:
|
1876
|
-
<xref target='B1' case='capital'>Figur-etikedo duvorta 1</xref>
|
1877
|
-
.
|
1878
|
-
<xref target='A'>Klaŭzo 1</xref>
|
1879
|
-
is clause
|
1880
|
-
<em>initial.</em>
|
1881
|
-
<br/>
|
1882
|
-
<xref target='A'>Klaŭzo 1</xref>
|
1883
|
-
is too.
|
1884
|
-
</p>
|
1885
|
-
<p>
|
1886
|
-
<xref target='A'>Klaŭzo 1</xref>
|
1887
|
-
is also.
|
1888
|
-
</p>
|
1889
|
-
<p>
|
1890
|
-
Annex has formatting, and crossreferences ignore it when determining
|
1891
|
-
casing.
|
1892
|
-
<xref target='AA'>
|
1893
|
-
<strong>Aldono</strong>
|
1894
|
-
A
|
1895
|
-
</xref>
|
1896
|
-
.
|
1897
|
-
</p>
|
1898
|
-
<p>
|
1899
|
-
Labels are not subject to casing:
|
1900
|
-
<xref target='CC' case='lowercase'>Introduction</xref>
|
1901
|
-
</p>
|
1902
|
-
<annex id='AA' displayorder='5'>
|
1903
|
-
<title>
|
1904
|
-
<strong>
|
1905
|
-
<strong>Aldono</strong>
|
1906
|
-
A
|
1907
|
-
</strong>
|
1908
|
-
<br/>
|
1909
|
-
(informa)
|
1910
|
-
</title>
|
1911
|
-
<clause id='AA1'>
|
1912
|
-
<title>A.1.</title>
|
1913
|
-
</clause>
|
1914
|
-
</annex>
|
1915
|
-
</clause>
|
1916
|
-
</sections>
|
1917
|
-
</preface>
|
1918
|
-
</iso-standard>
|
1919
|
-
OUTPUT
|
1920
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
1921
|
-
.new({ i18nyaml: "spec/assets/i18n.yaml" })
|
1922
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1923
|
-
end
|
1924
|
-
|
1925
|
-
it "ignores casing of xrefs in unicameral scripts" do
|
1926
|
-
input = <<~INPUT
|
1927
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1928
|
-
<sections>
|
1929
|
-
<clause id="A">
|
1930
|
-
<table id="B">
|
1931
|
-
</table>
|
1932
|
-
</clause>
|
1933
|
-
<clause id="C">
|
1934
|
-
<p>This is <xref target="A"/> and <xref target="B"/>.
|
1935
|
-
This is <xref target="A" case="capital"/> and <xref target="B" case="lowercase"/>.
|
1936
|
-
This is <xref target="A" case="lowercase"/> and <xref target="B" case="capital"/>.
|
1937
|
-
<xref target="A"/> is clause <em>initial.</em><br/>
|
1938
|
-
<xref target="A"/> is too. </p>
|
1939
|
-
<p><xref target="A"/> is also.</p>
|
1940
|
-
</clause>
|
1941
|
-
</sections>
|
1942
|
-
</iso-standard>
|
1943
|
-
INPUT
|
1944
|
-
output = <<~OUTPUT
|
1945
|
-
<?xml version='1.0'?>
|
1946
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
1947
|
-
<sections>
|
1948
|
-
<clause id='A' displayorder="1">
|
1949
|
-
<title>1.</title>
|
1950
|
-
<table id='B'>
|
1951
|
-
<name>Tabelo 1</name>
|
1952
|
-
</table>
|
1953
|
-
</clause>
|
1954
|
-
<clause id='C' displayorder="2">
|
1955
|
-
<title>2.</title>
|
1956
|
-
<p>
|
1957
|
-
This is
|
1958
|
-
<xref target='A'>klaŭzo 1</xref>
|
1959
|
-
and
|
1960
|
-
<xref target='B'>tabelo 1</xref>
|
1961
|
-
. This is
|
1962
|
-
<xref target='A' case='capital'>klaŭzo 1</xref>
|
1963
|
-
and
|
1964
|
-
<xref target='B' case='lowercase'>tabelo 1</xref>
|
1965
|
-
. This is
|
1966
|
-
<xref target='A' case='lowercase'>klaŭzo 1</xref>
|
1967
|
-
and
|
1968
|
-
<xref target='B' case='capital'>tabelo 1</xref>
|
1969
|
-
.
|
1970
|
-
<xref target='A'>klaŭzo 1</xref>
|
1971
|
-
is clause
|
1972
|
-
<em>initial.</em>
|
1973
|
-
<br/>
|
1974
|
-
<xref target='A'>klaŭzo 1</xref>
|
1975
|
-
is too.
|
1976
|
-
</p>
|
1977
|
-
<p>
|
1978
|
-
<xref target='A'>klaŭzo 1</xref>
|
1979
|
-
is also.
|
1980
|
-
</p>
|
1981
|
-
</clause>
|
1982
|
-
</sections>
|
1983
|
-
</iso-standard>
|
1984
|
-
OUTPUT
|
1985
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
1986
|
-
.new({ i18nyaml: "spec/assets/i18n.yaml", script: "Hans" })
|
1987
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1988
|
-
end
|
1989
|
-
|
1990
|
-
it "processes add, del" do
|
1991
|
-
input = <<~INPUT
|
1992
|
-
<itu-standard xmlns="https://www.calconnect.org/standards/itu">
|
1993
|
-
<preface><foreword id="A">
|
1994
|
-
<add>ABC <xref target="A"></add> <del><strong>B</strong></del>
|
1995
|
-
</foreword></preface>
|
1996
|
-
</itu-standard>
|
1997
|
-
INPUT
|
1998
|
-
output = <<~OUTPUT
|
1999
|
-
#{HTML_HDR}
|
2000
|
-
<br/>
|
2001
|
-
<div id='A'>
|
2002
|
-
<h1 class='ForewordTitle'>Foreword</h1>
|
2003
|
-
<span class='addition'>
|
2004
|
-
ABC
|
2005
|
-
<a href='#A'/>
|
2006
|
-
<span class='deletion'>
|
2007
|
-
<b>B</b>
|
2008
|
-
</span>
|
2009
|
-
</span>
|
2010
|
-
</div>
|
2011
|
-
<p class='zzSTDTitle1'/>
|
2012
|
-
</div>
|
2013
|
-
</body>
|
2014
|
-
</html>
|
2015
|
-
OUTPUT
|
2016
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
2017
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
2018
|
-
end
|
2019
|
-
|
2020
|
-
it "processes formatting in eref/@citeas" do
|
2021
|
-
input = <<~INPUT
|
2022
|
-
<itu-standard xmlns="https://www.calconnect.org/standards/itu">
|
2023
|
-
<preface>
|
2024
|
-
<foreword id='_' obligation='informative'>
|
2025
|
-
<title>Foreword</title>
|
2026
|
-
<p id='_'>
|
2027
|
-
<eref type='inline' bibitemid='iso124' citeas='[&#x3c;strong&#x3e;A&#x3c;/strong&#x3e;.&#x3c;fn reference=&#x22;1&#x22;&#x3e;&#xa; &#x3c;p&#x3e;hello&#x3c;/p&#x3e;&#xa;&#x3c;/fn&#x3e;]'/>
|
2028
|
-
</p>
|
2029
|
-
</foreword>
|
2030
|
-
</preface>
|
2031
|
-
</itu-standard>
|
2032
|
-
INPUT
|
2033
|
-
output = <<~OUTPUT
|
2034
|
-
<itu-standard xmlns='https://www.calconnect.org/standards/itu' type='presentation'>
|
2035
|
-
<preface>
|
2036
|
-
<foreword id='_' obligation='informative' displayorder='1'>
|
2037
|
-
<title>Foreword</title>
|
2038
|
-
<p id='_'>
|
2039
|
-
<eref type='inline' bibitemid='iso124' citeas='[&#x3c;strong&#x3e;A&#x3c;/strong&#x3e;.&#x3c;fn reference=&#x22;1&#x22;&#x3e;&#xa; &#x3c;p&#x3e;hello&#x3c;/p&#x3e;&#xa;&#x3c;/fn&#x3e;]'>
|
2040
|
-
[
|
2041
|
-
<strong>A</strong>
|
2042
|
-
.
|
2043
|
-
<fn reference='1'>
|
2044
|
-
<p>hello</p>
|
2045
|
-
</fn>
|
2046
|
-
]
|
2047
|
-
</eref>
|
2048
|
-
</p>
|
2049
|
-
</foreword>
|
2050
|
-
</preface>
|
2051
|
-
</itu-standard>
|
2052
|
-
OUTPUT
|
2053
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
2054
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
2055
|
-
end
|
2056
|
-
|
2057
|
-
it "combines locality stacks with connectives" do
|
2058
|
-
input = <<~INPUT
|
2059
|
-
<itu-standard xmlns="https://www.calconnect.org/standards/itu">
|
2060
|
-
<p id='_'>
|
2061
|
-
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2062
|
-
<localityStack connective='from'>
|
2063
|
-
<locality type='clause'>
|
2064
|
-
<referenceFrom>3</referenceFrom>
|
2065
|
-
</locality>
|
2066
|
-
</localityStack>
|
2067
|
-
<localityStack connective='to'>
|
2068
|
-
<locality type='clause'>
|
2069
|
-
<referenceFrom>5</referenceFrom>
|
2070
|
-
</locality>
|
2071
|
-
</localityStack>
|
2072
|
-
</eref>
|
2073
|
-
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2074
|
-
<localityStack connective='from'>
|
2075
|
-
<locality type='clause'>
|
2076
|
-
<referenceFrom>3</referenceFrom>
|
2077
|
-
</locality>
|
2078
|
-
</localityStack>
|
2079
|
-
<localityStack connective='to'>
|
2080
|
-
<locality type='clause'>
|
2081
|
-
<referenceFrom>5</referenceFrom>
|
2082
|
-
</locality>
|
2083
|
-
<locality type="table">
|
2084
|
-
<referenceFrom>2</referenceFrom>
|
2085
|
-
</locality>
|
2086
|
-
</locality>
|
2087
|
-
</localityStack>
|
2088
|
-
text
|
2089
|
-
</eref>
|
2090
|
-
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2091
|
-
<localityStack connective='and'>
|
2092
|
-
<locality type='clause'>
|
2093
|
-
<referenceFrom>3</referenceFrom>
|
2094
|
-
</locality>
|
2095
|
-
</localityStack>
|
2096
|
-
<localityStack connective='and'>
|
2097
|
-
<locality type='clause'>
|
2098
|
-
<referenceFrom>5</referenceFrom>
|
2099
|
-
</locality>
|
2100
|
-
</localityStack>
|
2101
|
-
</eref>
|
2102
|
-
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2103
|
-
<localityStack connective='and'>
|
2104
|
-
<locality type='clause'>
|
2105
|
-
<referenceFrom>3</referenceFrom>
|
2106
|
-
</locality>
|
2107
|
-
</localityStack>
|
2108
|
-
<localityStack connective='and'>
|
2109
|
-
<locality type='clause'>
|
2110
|
-
<referenceFrom>5</referenceFrom>
|
2111
|
-
</locality>
|
2112
|
-
</localityStack>
|
2113
|
-
<localityStack connective='and'>
|
2114
|
-
<locality type='clause'>
|
2115
|
-
<referenceFrom>7</referenceFrom>
|
2116
|
-
</locality>
|
2117
|
-
</localityStack>
|
2118
|
-
</eref>
|
2119
|
-
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2120
|
-
<localityStack connective='and'>
|
2121
|
-
<locality type='clause'>
|
2122
|
-
<referenceFrom>3</referenceFrom>
|
2123
|
-
</locality>
|
2124
|
-
</localityStack>
|
2125
|
-
<localityStack connective='and'>
|
2126
|
-
<locality type='annex'>
|
2127
|
-
<referenceFrom>5</referenceFrom>
|
2128
|
-
</locality>
|
2129
|
-
</localityStack>
|
2130
|
-
</eref>
|
2131
|
-
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2132
|
-
<localityStack connective='and'>
|
2133
|
-
<locality type='clause'>
|
2134
|
-
<referenceFrom>3</referenceFrom>
|
2135
|
-
</locality>
|
2136
|
-
</localityStack>
|
2137
|
-
<localityStack connective='or'>
|
2138
|
-
<locality type='clause'>
|
2139
|
-
<referenceFrom>5</referenceFrom>
|
2140
|
-
</locality>
|
2141
|
-
</localityStack>
|
2142
|
-
text
|
2143
|
-
</eref>
|
2144
|
-
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2145
|
-
<localityStack connective='from'>
|
2146
|
-
<locality type='clause'>
|
2147
|
-
<referenceFrom>3</referenceFrom>
|
2148
|
-
</locality>
|
2149
|
-
</localityStack>
|
2150
|
-
<localityStack connective='to'>
|
2151
|
-
<locality type='clause'>
|
2152
|
-
<referenceFrom>5</referenceFrom>
|
2153
|
-
</locality>
|
2154
|
-
</localityStack>
|
2155
|
-
<localityStack connective='and'>
|
2156
|
-
<locality type='clause'>
|
2157
|
-
<referenceFrom>8</referenceFrom>
|
2158
|
-
</locality>
|
2159
|
-
</localityStack>
|
2160
|
-
<localityStack connective='to'>
|
2161
|
-
<locality type='clause'>
|
2162
|
-
<referenceFrom>10</referenceFrom>
|
2163
|
-
</locality>
|
2164
|
-
</localityStack>
|
2165
|
-
</eref>
|
2166
|
-
</p>
|
2167
|
-
</clause>
|
2168
|
-
</sections>
|
2169
|
-
<bibliography>
|
2170
|
-
<references id='_' normative='false' obligation='informative'>
|
2171
|
-
<title>Bibliography</title>
|
2172
|
-
<bibitem id='ref1'>
|
2173
|
-
<formattedref format='application/x-isodoc+xml'>
|
2174
|
-
<em>Standard</em>
|
2175
|
-
</formattedref>
|
2176
|
-
<docidentifier>XYZ</docidentifier>
|
2177
|
-
</bibitem>
|
2178
|
-
</references>
|
2179
|
-
</bibliography>
|
2180
|
-
</itu-standard>
|
2181
|
-
INPUT
|
2182
|
-
output = <<~OUTPUT
|
2183
|
-
<itu-standard xmlns='https://www.calconnect.org/standards/itu' type='presentation'>
|
2184
|
-
<p id='_'>
|
2185
|
-
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2186
|
-
<localityStack connective='from'>
|
2187
|
-
<locality type='clause'>
|
2188
|
-
<referenceFrom>3</referenceFrom>
|
2189
|
-
</locality>
|
2190
|
-
</localityStack>
|
2191
|
-
<localityStack connective='to'>
|
2192
|
-
<locality type='clause'>
|
2193
|
-
<referenceFrom>5</referenceFrom>
|
2194
|
-
</locality>
|
2195
|
-
</localityStack>
|
2196
|
-
XYZ, Clause 3 to 5
|
2197
|
-
</eref>
|
2198
|
-
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2199
|
-
<localityStack connective='from'>
|
2200
|
-
<locality type='clause'>
|
2201
|
-
<referenceFrom>3</referenceFrom>
|
2202
|
-
</locality>
|
2203
|
-
</localityStack>
|
2204
|
-
<localityStack connective='to'>
|
2205
|
-
<locality type='clause'>
|
2206
|
-
<referenceFrom>5</referenceFrom>
|
2207
|
-
</locality>
|
2208
|
-
<locality type='table'>
|
2209
|
-
<referenceFrom>2</referenceFrom>
|
2210
|
-
</locality>
|
2211
|
-
</localityStack>
|
2212
|
-
XYZ, Clause 3 to Clause 5, Table 2
|
2213
|
-
</eref>
|
2214
|
-
text
|
2215
|
-
</p>
|
2216
|
-
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2217
|
-
<localityStack connective='and'>
|
2218
|
-
<locality type='clause'>
|
2219
|
-
<referenceFrom>3</referenceFrom>
|
2220
|
-
</locality>
|
2221
|
-
</localityStack>
|
2222
|
-
<localityStack connective='and'>
|
2223
|
-
<locality type='clause'>
|
2224
|
-
<referenceFrom>5</referenceFrom>
|
2225
|
-
</locality>
|
2226
|
-
</localityStack>
|
2227
|
-
XYZ, Clause 3 and 5
|
2228
|
-
</eref>
|
2229
|
-
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2230
|
-
<localityStack connective='and'>
|
2231
|
-
<locality type='clause'>
|
2232
|
-
<referenceFrom>3</referenceFrom>
|
2233
|
-
</locality>
|
2234
|
-
</localityStack>
|
2235
|
-
<localityStack connective='and'>
|
2236
|
-
<locality type='clause'>
|
2237
|
-
<referenceFrom>5</referenceFrom>
|
2238
|
-
</locality>
|
2239
|
-
</localityStack>
|
2240
|
-
<localityStack connective='and'>
|
2241
|
-
<locality type='clause'>
|
2242
|
-
<referenceFrom>7</referenceFrom>
|
2243
|
-
</locality>
|
2244
|
-
</localityStack>
|
2245
|
-
XYZ, Clause 3, 5, and 7
|
2246
|
-
</eref>
|
2247
|
-
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2248
|
-
<localityStack connective='and'>
|
2249
|
-
<locality type='clause'>
|
2250
|
-
<referenceFrom>3</referenceFrom>
|
2251
|
-
</locality>
|
2252
|
-
</localityStack>
|
2253
|
-
<localityStack connective='and'>
|
2254
|
-
<locality type='annex'>
|
2255
|
-
<referenceFrom>5</referenceFrom>
|
2256
|
-
</locality>
|
2257
|
-
</localityStack>
|
2258
|
-
XYZ, Clause 3 and Annex 5
|
2259
|
-
</eref>
|
2260
|
-
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2261
|
-
<localityStack connective='and'>
|
2262
|
-
<locality type='clause'>
|
2263
|
-
<referenceFrom>3</referenceFrom>
|
2264
|
-
</locality>
|
2265
|
-
</localityStack>
|
2266
|
-
<localityStack connective='or'>
|
2267
|
-
<locality type='clause'>
|
2268
|
-
<referenceFrom>5</referenceFrom>
|
2269
|
-
</locality>
|
2270
|
-
</localityStack>
|
2271
|
-
text
|
2272
|
-
</eref>
|
2273
|
-
<eref type='inline' bibitemid='ref1' citeas='XYZ'>
|
2274
|
-
<localityStack connective='from'>
|
2275
|
-
<locality type='clause'>
|
2276
|
-
<referenceFrom>3</referenceFrom>
|
2277
|
-
</locality>
|
2278
|
-
</localityStack>
|
2279
|
-
<localityStack connective='to'>
|
2280
|
-
<locality type='clause'>
|
2281
|
-
<referenceFrom>5</referenceFrom>
|
2282
|
-
</locality>
|
2283
|
-
</localityStack>
|
2284
|
-
<localityStack connective='and'>
|
2285
|
-
<locality type='clause'>
|
2286
|
-
<referenceFrom>8</referenceFrom>
|
2287
|
-
</locality>
|
2288
|
-
</localityStack>
|
2289
|
-
<localityStack connective='to'>
|
2290
|
-
<locality type='clause'>
|
2291
|
-
<referenceFrom>10</referenceFrom>
|
2292
|
-
</locality>
|
2293
|
-
</localityStack>
|
2294
|
-
XYZ, Clause 3 to 5 and 8 to 10
|
2295
|
-
</eref>
|
2296
|
-
</itu-standard>
|
2297
|
-
OUTPUT
|
2298
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
2299
|
-
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
2300
|
-
end
|
2301
|
-
end
|