isodoc 1.6.2 → 1.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +2 -12
- data/.hound.yml +3 -1
- data/.rubocop.yml +4 -6
- data/Rakefile +2 -2
- data/isodoc.gemspec +3 -2
- data/lib/isodoc-yaml/i18n-en.yaml +1 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc.rb +0 -2
- data/lib/isodoc/convert.rb +7 -1
- data/lib/isodoc/function/blocks.rb +5 -4
- data/lib/isodoc/function/cleanup.rb +52 -43
- data/lib/isodoc/function/inline.rb +7 -7
- data/lib/isodoc/function/references.rb +32 -51
- data/lib/isodoc/function/section.rb +28 -16
- data/lib/isodoc/function/table.rb +21 -22
- data/lib/isodoc/function/terms.rb +6 -7
- data/lib/isodoc/function/to_word_html.rb +6 -3
- data/lib/isodoc/function/utils.rb +181 -163
- data/lib/isodoc/gem_tasks.rb +8 -9
- data/lib/isodoc/headlesshtml_convert.rb +8 -7
- data/lib/isodoc/html_convert.rb +5 -1
- data/lib/isodoc/html_function/comments.rb +14 -12
- data/lib/isodoc/html_function/footnotes.rb +14 -7
- data/lib/isodoc/html_function/html.rb +30 -26
- data/lib/isodoc/html_function/postprocess.rb +191 -182
- data/lib/isodoc/html_function/sectionsplit.rb +230 -0
- data/lib/isodoc/metadata.rb +22 -20
- data/lib/isodoc/metadata_contributor.rb +31 -28
- data/lib/isodoc/pdf_convert.rb +11 -13
- data/lib/isodoc/presentation_function/bibdata.rb +61 -30
- data/lib/isodoc/presentation_function/inline.rb +34 -27
- data/lib/isodoc/presentation_function/section.rb +54 -19
- data/lib/isodoc/presentation_xml_convert.rb +2 -0
- data/lib/isodoc/sassc_importer.rb +1 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/postprocess.rb +50 -36
- data/lib/isodoc/xref.rb +2 -0
- data/lib/isodoc/xref/xref_counter.rb +1 -2
- data/lib/isodoc/xref/xref_gen.rb +21 -14
- data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
- data/lib/isodoc/xref/xref_sect_gen.rb +15 -15
- data/spec/assets/scripts_override.html +3 -0
- data/spec/isodoc/blocks_spec.rb +624 -997
- data/spec/isodoc/cleanup_spec.rb +40 -42
- data/spec/isodoc/i18n_spec.rb +694 -821
- data/spec/isodoc/inline_spec.rb +482 -328
- data/spec/isodoc/metadata_spec.rb +384 -379
- data/spec/isodoc/postproc_spec.rb +163 -55
- data/spec/isodoc/presentation_xml_spec.rb +355 -278
- data/spec/isodoc/ref_spec.rb +5 -5
- data/spec/isodoc/section_spec.rb +216 -199
- data/spec/isodoc/sectionsplit_spec.rb +190 -0
- data/spec/isodoc/table_spec.rb +41 -42
- data/spec/isodoc/terms_spec.rb +84 -84
- data/spec/isodoc/xref_spec.rb +974 -932
- metadata +22 -5
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "droplocs xrefs" do
|
5
|
-
|
5
|
+
input = <<~INPUT
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<sections>
|
8
8
|
<clause id="A">
|
@@ -16,15 +16,16 @@ RSpec.describe IsoDoc do
|
|
16
16
|
</sections>
|
17
17
|
</iso-standard>
|
18
18
|
INPUT
|
19
|
+
output = <<~OUTPUT
|
19
20
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
20
21
|
<sections>
|
21
|
-
<clause id='A'>
|
22
|
+
<clause id='A' displayorder="1">
|
22
23
|
<title>1.</title>
|
23
24
|
<formula id='B'>
|
24
25
|
<name>1</name>
|
25
26
|
</formula>
|
26
27
|
</clause>
|
27
|
-
<clause id='C'>
|
28
|
+
<clause id='C' displayorder="2">
|
28
29
|
<title>2.</title>
|
29
30
|
<p>
|
30
31
|
This is
|
@@ -41,10 +42,13 @@ RSpec.describe IsoDoc do
|
|
41
42
|
</sections>
|
42
43
|
</iso-standard>
|
43
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)
|
44
48
|
end
|
45
49
|
|
46
|
-
it "processes inline formatting
|
47
|
-
|
50
|
+
it "processes inline formatting" do
|
51
|
+
input = <<~INPUT
|
48
52
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
49
53
|
<preface><foreword>
|
50
54
|
<p>
|
@@ -56,69 +60,55 @@ RSpec.describe IsoDoc do
|
|
56
60
|
<sections>
|
57
61
|
</iso-standard>
|
58
62
|
INPUT
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
</div>
|
70
|
-
<p class="zzSTDTitle1"/>
|
71
|
-
</div>
|
72
|
-
</body>
|
73
|
-
</html>
|
63
|
+
html = <<~OUTPUT
|
64
|
+
<div>
|
65
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
66
|
+
<p>
|
67
|
+
<i>A</i> <b>B</b> <sup>C</sup> <sub>D</sub> <tt>E</tt>
|
68
|
+
<s>F</s> <span style="font-variant:small-caps;">G</span> <span class="keyword">I</span> <br/> <hr/>
|
69
|
+
<a id="H"/> <br/> <br/>
|
70
|
+
<span style='text-decoration: underline;'>J</span>
|
71
|
+
</p>
|
72
|
+
</div>
|
74
73
|
OUTPUT
|
75
|
-
end
|
76
74
|
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
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
|
-
</p>
|
113
|
-
</div>
|
114
|
-
</div>
|
115
|
-
</body>
|
116
|
-
</html>
|
75
|
+
doc = <<~OUTPUT
|
76
|
+
<div>
|
77
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
78
|
+
<p>
|
79
|
+
<i>A</i>
|
80
|
+
<b>B</b>
|
81
|
+
<sup>C</sup>
|
82
|
+
<sub>D</sub>
|
83
|
+
<tt>E</tt>
|
84
|
+
<s>F</s>
|
85
|
+
<span style='font-variant:small-caps;'>G</span>
|
86
|
+
<span class='keyword'>I</span>
|
87
|
+
<br/>
|
88
|
+
<hr/>
|
89
|
+
<a id='H'/>
|
90
|
+
<p>
|
91
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
92
|
+
</p>
|
93
|
+
<p>
|
94
|
+
<br clear='all' class='section' orientation='landscape'/>
|
95
|
+
</p>
|
96
|
+
<u>J</u>
|
97
|
+
</p>
|
98
|
+
</div>
|
117
99
|
OUTPUT
|
100
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
101
|
+
.convert("test", input, true))
|
102
|
+
.sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
|
103
|
+
.to be_equivalent_to xmlpp(html)
|
104
|
+
expect(xmlpp(IsoDoc::WordConvert.new({})
|
105
|
+
.convert("test", input, true))
|
106
|
+
.sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
|
107
|
+
.to be_equivalent_to xmlpp(doc)
|
118
108
|
end
|
119
109
|
|
120
110
|
it "ignores index entries" do
|
121
|
-
|
111
|
+
input = <<~INPUT
|
122
112
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
123
113
|
<preface><foreword>
|
124
114
|
<p><index primary="A" secondary="B" tertiary="C"/></p>
|
@@ -129,15 +119,18 @@ RSpec.describe IsoDoc do
|
|
129
119
|
</indexsect>
|
130
120
|
</iso-standard>
|
131
121
|
INPUT
|
122
|
+
output = <<~OUTPUT
|
132
123
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
133
124
|
<preface>
|
134
|
-
<foreword>
|
125
|
+
<foreword displayorder="1">
|
135
126
|
<p/>
|
136
127
|
</foreword>
|
137
128
|
</preface>
|
138
129
|
<sections> </sections>
|
139
130
|
</iso-standard>
|
140
131
|
OUTPUT
|
132
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
133
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
141
134
|
end
|
142
135
|
|
143
136
|
it "processes concept markup" do
|
@@ -226,162 +219,243 @@ RSpec.describe IsoDoc do
|
|
226
219
|
</iso-standard>
|
227
220
|
INPUT
|
228
221
|
presxml = <<~OUTPUT
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
</iso-standard>
|
355
|
-
end
|
356
|
-
|
357
|
-
it "processes embedded inline formatting" do
|
358
|
-
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
359
|
-
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
360
|
-
<preface><foreword>
|
361
|
-
<p>
|
362
|
-
<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>
|
363
|
-
</p>
|
364
|
-
</foreword></preface>
|
365
|
-
<sections>
|
222
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
223
|
+
<preface>
|
224
|
+
<foreword displayorder="1">
|
225
|
+
<p>
|
226
|
+
<ul>
|
227
|
+
<li>
|
228
|
+
<em>
|
229
|
+
<xref target='clause1'>Clause 2</xref>
|
230
|
+
</em>
|
231
|
+
</li>
|
232
|
+
<li>
|
233
|
+
<em>
|
234
|
+
<xref target='clause1'>w[o]rd</xref>
|
235
|
+
</em>
|
236
|
+
</li>
|
237
|
+
<li>
|
238
|
+
<em>
|
239
|
+
<eref bibitemid='ISO712' type='inline' citeas='ISO 712'>ISO 712</eref>
|
240
|
+
</em>
|
241
|
+
</li>
|
242
|
+
<li>
|
243
|
+
<em>
|
244
|
+
<eref bibitemid='ISO712' type='inline' citeas='ISO 712'>word</eref>
|
245
|
+
</em>
|
246
|
+
</li>
|
247
|
+
<li>
|
248
|
+
<em>
|
249
|
+
<eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
|
250
|
+
<locality type='clause'>
|
251
|
+
<referenceFrom>3.1</referenceFrom>
|
252
|
+
</locality>
|
253
|
+
<locality type='figure'>
|
254
|
+
<referenceFrom>a</referenceFrom>
|
255
|
+
</locality>
|
256
|
+
ISO 712, Clause 3.1, Figure a
|
257
|
+
</eref>
|
258
|
+
</em>
|
259
|
+
</li>
|
260
|
+
<li>
|
261
|
+
<em>
|
262
|
+
<eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
|
263
|
+
<localityStack>
|
264
|
+
<locality type='clause'>
|
265
|
+
<referenceFrom>3.1</referenceFrom>
|
266
|
+
</locality>
|
267
|
+
</localityStack>
|
268
|
+
<localityStack>
|
269
|
+
<locality type='figure'>
|
270
|
+
<referenceFrom>b</referenceFrom>
|
271
|
+
</locality>
|
272
|
+
</localityStack>
|
273
|
+
ISO 712, Clause 3.1; Figure b
|
274
|
+
</eref>
|
275
|
+
</em>
|
276
|
+
</li>
|
277
|
+
<li>
|
278
|
+
<em>
|
279
|
+
<eref bibitemid='ISO712' type='inline' citeas='ISO 712'>
|
280
|
+
<localityStack>
|
281
|
+
<locality type='clause'>
|
282
|
+
<referenceFrom>3.1</referenceFrom>
|
283
|
+
</locality>
|
284
|
+
</localityStack>
|
285
|
+
<localityStack>
|
286
|
+
<locality type='figure'>
|
287
|
+
<referenceFrom>b</referenceFrom>
|
288
|
+
</locality>
|
289
|
+
</localityStack>
|
290
|
+
<em>word</em>
|
291
|
+
</eref>
|
292
|
+
</em>
|
293
|
+
</li>
|
294
|
+
<li>
|
295
|
+
[term defined in
|
296
|
+
<termref base='IEV' target='135-13-13'/>
|
297
|
+
]
|
298
|
+
</li>
|
299
|
+
<li>
|
300
|
+
<em>
|
301
|
+
<termref base='IEV' target='135-13-13'>
|
302
|
+
<em>word</em>
|
303
|
+
word
|
304
|
+
</termref>
|
305
|
+
</em>
|
306
|
+
</li>
|
307
|
+
</ul>
|
308
|
+
</p>
|
309
|
+
</foreword>
|
310
|
+
</preface>
|
311
|
+
<sections>
|
312
|
+
<clause id='clause1' displayorder="3">
|
313
|
+
<title depth='1'>
|
314
|
+
2.
|
315
|
+
<tab/>
|
316
|
+
Clause 1
|
317
|
+
</title>
|
318
|
+
</clause>
|
319
|
+
</sections>
|
320
|
+
<bibliography>
|
321
|
+
<references id='_normative_references' obligation='informative' normative='true' displayorder="2">
|
322
|
+
<title depth='1'>
|
323
|
+
1.
|
324
|
+
<tab/>
|
325
|
+
Normative References
|
326
|
+
</title>
|
327
|
+
<p>
|
328
|
+
The following documents are referred to in the text in such a way that
|
329
|
+
some or all of their content constitutes requirements of this document.
|
330
|
+
For dated references, only the edition cited applies. For undated
|
331
|
+
references, the latest edition of the referenced document (including any
|
332
|
+
amendments) applies.
|
333
|
+
</p>
|
334
|
+
<bibitem id='ISO712' type='standard'>
|
335
|
+
<title format='text/plain'>Cereals or cereal products</title>
|
336
|
+
<title type='main' format='text/plain'>Cereals and cereal products</title>
|
337
|
+
<docidentifier type='ISO'>ISO 712</docidentifier>
|
338
|
+
<contributor>
|
339
|
+
<role type='publisher'/>
|
340
|
+
<organization>
|
341
|
+
<name>International Organization for Standardization</name>
|
342
|
+
</organization>
|
343
|
+
</contributor>
|
344
|
+
</bibitem>
|
345
|
+
</references>
|
346
|
+
</bibliography>
|
366
347
|
</iso-standard>
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
348
|
+
OUTPUT
|
349
|
+
output = <<~OUTPUT
|
350
|
+
#{HTML_HDR}
|
351
|
+
<br/>
|
352
|
+
<div>
|
353
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
354
|
+
<p>
|
355
|
+
<ul>
|
356
|
+
<li>
|
357
|
+
<i>
|
358
|
+
<a href='#clause1'>Clause 2</a>
|
359
|
+
</i>
|
360
|
+
</li>
|
361
|
+
<li>
|
362
|
+
<i>
|
363
|
+
<a href='#clause1'>w[o]rd</a>
|
364
|
+
</i>
|
365
|
+
</li>
|
366
|
+
<li>
|
367
|
+
<i>
|
368
|
+
<a href='#ISO712'>ISO 712</a>
|
369
|
+
</i>
|
370
|
+
</li>
|
371
|
+
<li>
|
372
|
+
<i>
|
373
|
+
<a href='#ISO712'>word</a>
|
374
|
+
</i>
|
375
|
+
</li>
|
376
|
+
<li>
|
377
|
+
<i>
|
378
|
+
<a href='#ISO712'> ISO 712, Clause 3.1, Figure a </a>
|
379
|
+
</i>
|
380
|
+
</li>
|
381
|
+
<li>
|
382
|
+
<i>
|
383
|
+
<a href='#ISO712'> ISO 712, Clause 3.1; Figure b </a>
|
384
|
+
</i>
|
385
|
+
</li>
|
386
|
+
<li>
|
387
|
+
<i>
|
388
|
+
<a href='#ISO712'>
|
389
|
+
<i>word</i>
|
390
|
+
</a>
|
391
|
+
</i>
|
392
|
+
</li>
|
393
|
+
<li> [term defined in Termbase IEV, term ID 135-13-13 ] </li>
|
394
|
+
<li>
|
395
|
+
<i> Termbase IEV, term ID 135-13-13 </i>
|
396
|
+
</li>
|
397
|
+
</ul>
|
398
|
+
</p>
|
399
|
+
</div>
|
400
|
+
<p class='zzSTDTitle1'/>
|
401
|
+
<div>
|
402
|
+
<h1> 1.   Normative References </h1>
|
403
|
+
<p>
|
404
|
+
The following documents are referred to in the text in such a way
|
405
|
+
that some or all of their content constitutes requirements of this
|
406
|
+
document. For dated references, only the edition cited applies. For
|
407
|
+
undated references, the latest edition of the referenced document
|
408
|
+
(including any amendments) applies.
|
409
|
+
</p>
|
410
|
+
<p id='ISO712' class='NormRef'>
|
411
|
+
ISO 712,
|
412
|
+
<i>Cereals and cereal products</i>
|
413
|
+
</p>
|
414
|
+
</div>
|
415
|
+
<div id='clause1'>
|
416
|
+
<h1> 2.   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 embedded inline formatting" do
|
429
|
+
input = <<~INPUT
|
430
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
431
|
+
<preface><foreword>
|
432
|
+
<p>
|
433
|
+
<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>
|
434
|
+
</p>
|
435
|
+
</foreword></preface>
|
436
|
+
<sections>
|
437
|
+
</iso-standard>
|
438
|
+
INPUT
|
439
|
+
output = <<~OUTPUT
|
440
|
+
#{HTML_HDR}
|
441
|
+
<br/>
|
442
|
+
<div>
|
443
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
444
|
+
<p>
|
445
|
+
<i><b><</b></i> <tt><a href="B">B</a></tt> <a href="#_http_1_1">Requirement <tt>/req/core/http</tt></a> <a href="#ISO712">Requirement <tt>/req/core/http</tt></a>
|
446
|
+
</p>
|
377
447
|
</div>
|
378
|
-
|
379
|
-
|
448
|
+
<p class="zzSTDTitle1"/>
|
449
|
+
</div>
|
450
|
+
</body>
|
451
|
+
</html>
|
380
452
|
OUTPUT
|
453
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
454
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
381
455
|
end
|
382
456
|
|
383
457
|
it "processes inline images" do
|
384
|
-
|
458
|
+
input = <<~INPUT
|
385
459
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
386
460
|
<preface><foreword>
|
387
461
|
<p>
|
@@ -390,6 +464,7 @@ RSpec.describe IsoDoc do
|
|
390
464
|
</foreword></preface>
|
391
465
|
</iso-standard>
|
392
466
|
INPUT
|
467
|
+
output = <<~OUTPUT
|
393
468
|
#{HTML_HDR}
|
394
469
|
<br/>
|
395
470
|
<div>
|
@@ -403,10 +478,12 @@ RSpec.describe IsoDoc do
|
|
403
478
|
</body>
|
404
479
|
</html>
|
405
480
|
OUTPUT
|
481
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
482
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
406
483
|
end
|
407
484
|
|
408
485
|
it "processes links" do
|
409
|
-
|
486
|
+
input = <<~INPUT
|
410
487
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
411
488
|
<preface><foreword>
|
412
489
|
<p>
|
@@ -420,6 +497,7 @@ RSpec.describe IsoDoc do
|
|
420
497
|
<sections>
|
421
498
|
</iso-standard>
|
422
499
|
INPUT
|
500
|
+
output = <<~OUTPUT
|
423
501
|
#{HTML_HDR}
|
424
502
|
<br/>
|
425
503
|
<div>
|
@@ -437,10 +515,55 @@ RSpec.describe IsoDoc do
|
|
437
515
|
</body>
|
438
516
|
</html>
|
439
517
|
OUTPUT
|
518
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
519
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
520
|
+
end
|
521
|
+
|
522
|
+
it "processes updatetype links" do
|
523
|
+
input = <<~INPUT
|
524
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
525
|
+
<preface><foreword>
|
526
|
+
<p>
|
527
|
+
<link updatetype="true" target="http://example.com"/>
|
528
|
+
<link updatetype="true" target="list.adoc">example</link>
|
529
|
+
<link updatetype="true" target="list" alt="tip">example</link>
|
530
|
+
</p>
|
531
|
+
</foreword></preface>
|
532
|
+
<sections>
|
533
|
+
</iso-standard>
|
534
|
+
INPUT
|
535
|
+
html = <<~OUTPUT
|
536
|
+
<div>
|
537
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
538
|
+
<p>
|
539
|
+
<a href="http://example.com">http://example.com</a>
|
540
|
+
<a href='list.adoc'>example</a>
|
541
|
+
<a href='list.html' title='tip'>example</a>
|
542
|
+
</p>
|
543
|
+
</div>
|
544
|
+
OUTPUT
|
545
|
+
doc = <<~OUTPUT
|
546
|
+
<div>
|
547
|
+
<h1 class="ForewordTitle">Foreword</h1>
|
548
|
+
<p>
|
549
|
+
<a href="http://example.com">http://example.com</a>
|
550
|
+
<a href='list.adoc'>example</a>
|
551
|
+
<a href='list.doc' title='tip'>example</a>
|
552
|
+
</p>
|
553
|
+
</div>
|
554
|
+
OUTPUT
|
555
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
556
|
+
.convert("test", input, true))
|
557
|
+
.sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
|
558
|
+
.to be_equivalent_to xmlpp(html)
|
559
|
+
expect(xmlpp(IsoDoc::WordConvert.new({})
|
560
|
+
.convert("test", input, true))
|
561
|
+
.sub(/^.*<h1/m, "<div><h1").sub(%r{</div>.*$}m, "</div>"))
|
562
|
+
.to be_equivalent_to xmlpp(doc)
|
440
563
|
end
|
441
564
|
|
442
565
|
it "processes unrecognised markup" do
|
443
|
-
|
566
|
+
input = <<~INPUT
|
444
567
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
445
568
|
<preface><foreword>
|
446
569
|
<p>
|
@@ -450,6 +573,7 @@ RSpec.describe IsoDoc do
|
|
450
573
|
<sections>
|
451
574
|
</iso-standard>
|
452
575
|
INPUT
|
576
|
+
output = <<~OUTPUT
|
453
577
|
#{HTML_HDR}
|
454
578
|
<br/>
|
455
579
|
<div>
|
@@ -463,10 +587,12 @@ RSpec.describe IsoDoc do
|
|
463
587
|
</body>
|
464
588
|
</html>
|
465
589
|
OUTPUT
|
590
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
591
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
466
592
|
end
|
467
593
|
|
468
594
|
it "processes AsciiMath and MathML" do
|
469
|
-
|
595
|
+
input = <<~INPUT
|
470
596
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
471
597
|
<preface><foreword>
|
472
598
|
<p>
|
@@ -478,6 +604,7 @@ RSpec.describe IsoDoc do
|
|
478
604
|
<sections>
|
479
605
|
</iso-standard>
|
480
606
|
INPUT
|
607
|
+
output = <<~OUTPUT
|
481
608
|
#{HTML_HDR.sub(/<html/, "<html xmlns:m='m'")}
|
482
609
|
<br/>
|
483
610
|
<div>
|
@@ -495,10 +622,13 @@ RSpec.describe IsoDoc do
|
|
495
622
|
</body>
|
496
623
|
</html>
|
497
624
|
OUTPUT
|
625
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
626
|
+
.convert("test", input, true).sub(/<html/, "<html xmlns:m='m'")))
|
627
|
+
.to be_equivalent_to xmlpp(output)
|
498
628
|
end
|
499
629
|
|
500
630
|
it "overrides AsciiMath delimiters" do
|
501
|
-
|
631
|
+
input = <<~INPUT
|
502
632
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
503
633
|
<preface><foreword>
|
504
634
|
<p>
|
@@ -509,6 +639,7 @@ RSpec.describe IsoDoc do
|
|
509
639
|
<sections>
|
510
640
|
</iso-standard>
|
511
641
|
INPUT
|
642
|
+
output = <<~OUTPUT
|
512
643
|
#{HTML_HDR}
|
513
644
|
<br/>
|
514
645
|
<div>
|
@@ -523,10 +654,12 @@ RSpec.describe IsoDoc do
|
|
523
654
|
</body>
|
524
655
|
</html>
|
525
656
|
OUTPUT
|
657
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
658
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
526
659
|
end
|
527
660
|
|
528
661
|
it "processes eref types" do
|
529
|
-
|
662
|
+
input = <<~INPUT
|
530
663
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
531
664
|
<preface><foreword>
|
532
665
|
<p>
|
@@ -549,6 +682,7 @@ RSpec.describe IsoDoc do
|
|
549
682
|
</bibliography>
|
550
683
|
</iso-standard>
|
551
684
|
INPUT
|
685
|
+
output = <<~OUTPUT
|
552
686
|
#{HTML_HDR}
|
553
687
|
<br/>
|
554
688
|
<div>
|
@@ -567,6 +701,8 @@ RSpec.describe IsoDoc do
|
|
567
701
|
</body>
|
568
702
|
</html>
|
569
703
|
OUTPUT
|
704
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
705
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
570
706
|
end
|
571
707
|
|
572
708
|
it "processes eref content" do
|
@@ -610,7 +746,7 @@ RSpec.describe IsoDoc do
|
|
610
746
|
INPUT
|
611
747
|
presxml = <<~OUTPUT
|
612
748
|
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
|
613
|
-
<preface><foreword>
|
749
|
+
<preface><foreword displayorder="1">
|
614
750
|
<p>
|
615
751
|
<eref type="inline" bibitemid="ISO712" citeas="ISO 712">ISO 712</eref>
|
616
752
|
<eref type="inline" bibitemid="ISO712">ISO 712</eref>
|
@@ -631,7 +767,8 @@ RSpec.describe IsoDoc do
|
|
631
767
|
<eref type="inline" case="lowercase" bibitemid="ISO712"><locality type="anchor"><referenceFrom>1</referenceFrom></locality><locality type="clause"><referenceFrom>1</referenceFrom></locality>ISO 712, clause 1</eref>
|
632
768
|
</p>
|
633
769
|
</foreword></preface>
|
634
|
-
<bibliography><references id="_normative_references" obligation="informative" normative="true"
|
770
|
+
<bibliography><references id="_normative_references" obligation="informative" normative="true" displayorder=
|
771
|
+
"2"><title depth='1'>1.<tab/>Normative References</title>
|
635
772
|
<bibitem id="ISO712" type="standard">
|
636
773
|
<title format="text/plain">Cereals and cereal products</title>
|
637
774
|
<docidentifier>ISO 712</docidentifier>
|
@@ -681,8 +818,10 @@ RSpec.describe IsoDoc do
|
|
681
818
|
</body>
|
682
819
|
</html>
|
683
820
|
OUTPUT
|
684
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
685
|
-
|
821
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
822
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
823
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
824
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
686
825
|
end
|
687
826
|
|
688
827
|
it "processes eref content pointing to reference with citation URL" do
|
@@ -749,7 +888,7 @@ RSpec.describe IsoDoc do
|
|
749
888
|
presxml = <<~OUTPUT
|
750
889
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
751
890
|
<preface>
|
752
|
-
<foreword>
|
891
|
+
<foreword displayorder="1">
|
753
892
|
<p>
|
754
893
|
<eref type='inline' bibitemid='ISO712' citeas='ISO 712'>ISO 712</eref>
|
755
894
|
<eref type='inline' bibitemid='ISO712'>ISO 712</eref>
|
@@ -784,7 +923,7 @@ RSpec.describe IsoDoc do
|
|
784
923
|
</foreword>
|
785
924
|
</preface>
|
786
925
|
<bibliography>
|
787
|
-
<references id='_normative_references' obligation='informative' normative='true'>
|
926
|
+
<references id='_normative_references' obligation='informative' normative='true' displayorder="2">
|
788
927
|
<title depth='1'>1.<tab/>Normative References</title>
|
789
928
|
<bibitem id='ISO712' type='standard'>
|
790
929
|
<title format='text/plain'>Cereals and cereal products</title>
|
@@ -870,80 +1009,83 @@ RSpec.describe IsoDoc do
|
|
870
1009
|
OUTPUT
|
871
1010
|
|
872
1011
|
word = <<~OUTPUT
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
1012
|
+
<html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
|
1013
|
+
<head>
|
1014
|
+
<style>
|
1015
|
+
</style>
|
1016
|
+
</head>
|
1017
|
+
<body lang='EN-US' link='blue' vlink='#954F72'>
|
1018
|
+
<div class='WordSection1'>
|
1019
|
+
<p> </p>
|
1020
|
+
</div>
|
1021
|
+
<p>
|
1022
|
+
<br clear='all' class='section'/>
|
1023
|
+
</p>
|
1024
|
+
<div class='WordSection2'>
|
1025
|
+
<p>
|
1026
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1027
|
+
</p>
|
1028
|
+
<div>
|
1029
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
1030
|
+
<p>
|
1031
|
+
<a href='http://www.example.com'>ISO 712</a>
|
1032
|
+
<a href='http://www.example.com'>ISO 712</a>
|
1033
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
|
1034
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Table 1</a>
|
1035
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Table 1; Clause 1</a>
|
1036
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Table 1–1</a>
|
1037
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Clause 1, Table 1</a>
|
1038
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Clause 1</a>
|
1039
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Clause 1.5</a>
|
1040
|
+
<a href='spec/assets/iso713.doc'>A</a>
|
1041
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Whole of text</a>
|
1042
|
+
<a href='spec/assets/iso713.doc'>ISO 713, Prelude 7</a>
|
1043
|
+
<a href='spec/assets/iso713.doc'>A</a>
|
1044
|
+
<a href='spec/assets/iso713.doc#xyz'>ISO 713</a>
|
1045
|
+
<a href='spec/assets/iso713.doc#xyz'>ISO 713, Clause 1</a>
|
1046
|
+
<a href='spec/assets/iso714.svg'>ISO 714</a>
|
1047
|
+
</p>
|
1048
|
+
</div>
|
1049
|
+
<p> </p>
|
1050
|
+
</div>
|
1051
|
+
<p>
|
1052
|
+
<br clear='all' class='section'/>
|
1053
|
+
</p>
|
1054
|
+
<div class='WordSection3'>
|
1055
|
+
<p class='zzSTDTitle1'/>
|
1056
|
+
<div>
|
1057
|
+
<h1>
|
1058
|
+
1.
|
1059
|
+
<span style='mso-tab-count:1'>  </span>
|
1060
|
+
Normative References
|
1061
|
+
</h1>
|
1062
|
+
<p id='ISO712' class='NormRef'>
|
1063
|
+
ISO 712,
|
1064
|
+
<i>Cereals and cereal products</i>
|
1065
|
+
</p>
|
1066
|
+
<p id='ISO713' class='NormRef'>
|
1067
|
+
ISO 713,
|
1068
|
+
<i>Cereals and cereal products</i>
|
1069
|
+
</p>
|
1070
|
+
<p id='ISO714' class='NormRef'>
|
1071
|
+
ISO 714,
|
1072
|
+
<i>Cereals and cereal products</i>
|
1073
|
+
</p>
|
1074
|
+
</div>
|
1075
|
+
</div>
|
1076
|
+
</body>
|
1077
|
+
</html>
|
939
1078
|
OUTPUT
|
940
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
941
|
-
|
942
|
-
expect(xmlpp(IsoDoc::
|
1079
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1080
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(presxml)
|
1081
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
1082
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
|
1083
|
+
expect(xmlpp(IsoDoc::WordConvert.new({})
|
1084
|
+
.convert("test", presxml, true))).to be_equivalent_to xmlpp(word)
|
943
1085
|
end
|
944
1086
|
|
945
1087
|
it "processes variant" do
|
946
|
-
|
1088
|
+
input = <<~INPUT
|
947
1089
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
948
1090
|
<bibdata>
|
949
1091
|
<language>en</language>
|
@@ -961,41 +1103,46 @@ RSpec.describe IsoDoc do
|
|
961
1103
|
</preface>
|
962
1104
|
</iso-standard>
|
963
1105
|
INPUT
|
964
|
-
|
965
|
-
<
|
966
|
-
<
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
<
|
971
|
-
<
|
972
|
-
|
973
|
-
|
974
|
-
<
|
975
|
-
|
976
|
-
|
977
|
-
<
|
978
|
-
|
979
|
-
|
980
|
-
<
|
981
|
-
|
982
|
-
|
983
|
-
<
|
984
|
-
|
985
|
-
|
986
|
-
<
|
987
|
-
|
988
|
-
|
989
|
-
<
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
1106
|
+
output = <<~OUTPUT
|
1107
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
1108
|
+
<bibdata>
|
1109
|
+
<language current='true'>en</language>
|
1110
|
+
<script current='true'>Latn</script>
|
1111
|
+
</bibdata>
|
1112
|
+
<preface>
|
1113
|
+
<clause id='A' displayorder='1'>
|
1114
|
+
<title depth='1'>ABC</title>
|
1115
|
+
</clause>
|
1116
|
+
<clause id='A1' displayorder='2'>
|
1117
|
+
<title depth='1'>ABC/DEF</title>
|
1118
|
+
</clause>
|
1119
|
+
<clause id='A2' displayorder='3'>
|
1120
|
+
<title depth='1'>ABC</title>
|
1121
|
+
</clause>
|
1122
|
+
<clause id='B' displayorder='4'>
|
1123
|
+
<title depth='1'>GHI/JKL</title>
|
1124
|
+
</clause>
|
1125
|
+
<clause id='C' displayorder='5'>
|
1126
|
+
<title depth='1'>DEF</title>
|
1127
|
+
</clause>
|
1128
|
+
<clause id='C1' displayorder='6'>
|
1129
|
+
<title depth='1'>ABC/DEF</title>
|
1130
|
+
</clause>
|
1131
|
+
<clause id='C2' displayorder='7'>
|
1132
|
+
<title depth='1'>DEF</title>
|
1133
|
+
</clause>
|
1134
|
+
<p displayorder='8'>A B D E</p>
|
1135
|
+
</preface>
|
1136
|
+
</iso-standard>
|
994
1137
|
OUTPUT
|
1138
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
1139
|
+
.convert("test", input, true)
|
1140
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, "")))
|
1141
|
+
.to be_equivalent_to xmlpp(output)
|
995
1142
|
end
|
996
1143
|
|
997
1144
|
it "cases xrefs" do
|
998
|
-
|
1145
|
+
input = <<~INPUT
|
999
1146
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1000
1147
|
<sections>
|
1001
1148
|
<clause id="A">
|
@@ -1013,16 +1160,17 @@ RSpec.describe IsoDoc do
|
|
1013
1160
|
</sections>
|
1014
1161
|
</iso-standard>
|
1015
1162
|
INPUT
|
1163
|
+
output = <<~OUTPUT
|
1016
1164
|
<?xml version='1.0'?>
|
1017
1165
|
<iso-standard xmlns='http://riboseinc.com/isoxml' type="presentation">
|
1018
1166
|
<sections>
|
1019
|
-
<clause id='A'>
|
1167
|
+
<clause id='A' displayorder="1">
|
1020
1168
|
<title>1.</title>
|
1021
1169
|
<table id='B'>
|
1022
1170
|
<name>Tabelo 1</name>
|
1023
1171
|
</table>
|
1024
1172
|
</clause>
|
1025
|
-
<clause id='C'>
|
1173
|
+
<clause id='C' displayorder="2">
|
1026
1174
|
<title>2.</title>
|
1027
1175
|
<p>
|
1028
1176
|
This is
|
@@ -1053,16 +1201,20 @@ RSpec.describe IsoDoc do
|
|
1053
1201
|
</sections>
|
1054
1202
|
</iso-standard>
|
1055
1203
|
OUTPUT
|
1204
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert
|
1205
|
+
.new({ i18nyaml: "spec/assets/i18n.yaml" })
|
1206
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1056
1207
|
end
|
1057
1208
|
|
1058
1209
|
it "processes add, del" do
|
1059
|
-
|
1210
|
+
input = <<~INPUT
|
1060
1211
|
<itu-standard xmlns="https://www.calconnect.org/standards/itu">
|
1061
1212
|
<preface><foreword id="A">
|
1062
1213
|
<add>ABC <xref target="A"></add> <del><strong>B</strong></del>
|
1063
1214
|
</foreword></preface>
|
1064
1215
|
</itu-standard>
|
1065
1216
|
INPUT
|
1217
|
+
output = <<~OUTPUT
|
1066
1218
|
#{HTML_HDR}
|
1067
1219
|
<br/>
|
1068
1220
|
<div id='A'>
|
@@ -1080,5 +1232,7 @@ RSpec.describe IsoDoc do
|
|
1080
1232
|
</body>
|
1081
1233
|
</html>
|
1082
1234
|
OUTPUT
|
1235
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({})
|
1236
|
+
.convert("test", input, true))).to be_equivalent_to xmlpp(output)
|
1083
1237
|
end
|
1084
1238
|
end
|