isodoc 2.1.0.2 → 2.1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/isodoc.gemspec +6 -3
  3. data/lib/isodoc/base_style/all.css +227 -0
  4. data/lib/isodoc/base_style/blocks.css +0 -0
  5. data/lib/isodoc/base_style/blocks.scss +7 -0
  6. data/lib/isodoc/base_style/coverpage.css +0 -0
  7. data/lib/isodoc/base_style/defaults.css +0 -0
  8. data/lib/isodoc/base_style/metanorma_word.css +47 -0
  9. data/lib/isodoc/base_style/nav.css +0 -0
  10. data/lib/isodoc/base_style/reset.css +125 -0
  11. data/lib/isodoc/base_style/typography.css +0 -0
  12. data/lib/isodoc/class_utils.rb +1 -1
  13. data/lib/isodoc/function/blocks.rb +1 -1
  14. data/lib/isodoc/function/cleanup.rb +1 -1
  15. data/lib/isodoc/function/inline.rb +4 -2
  16. data/lib/isodoc/function/lists.rb +24 -9
  17. data/lib/isodoc/function/table.rb +1 -1
  18. data/lib/isodoc/function/to_word_html.rb +3 -2
  19. data/lib/isodoc/function/utils.rb +18 -8
  20. data/lib/isodoc/gem_tasks.rb +19 -10
  21. data/lib/isodoc/html_function/html.rb +2 -2
  22. data/lib/isodoc/i18n.rb +19 -0
  23. data/lib/isodoc/metadata.rb +2 -2
  24. data/lib/isodoc/presentation_function/block.rb +3 -3
  25. data/lib/isodoc/presentation_function/image.rb +1 -1
  26. data/lib/isodoc/presentation_function/inline.rb +13 -6
  27. data/lib/isodoc/presentation_function/section.rb +3 -1
  28. data/lib/isodoc/presentation_function/xrefs.rb +22 -6
  29. data/lib/isodoc/presentation_xml_convert.rb +1 -0
  30. data/lib/isodoc/version.rb +1 -1
  31. data/lib/isodoc/word_function/body.rb +9 -6
  32. data/lib/isodoc/word_function/postprocess.rb +1 -1
  33. data/lib/isodoc/word_function/postprocess_cover.rb +5 -5
  34. data/lib/isodoc/xref/xref_gen.rb +6 -6
  35. metadata +16 -69
  36. data/.github/workflows/rake.yml +0 -15
  37. data/.github/workflows/release.yml +0 -24
  38. data/.hound.yml +0 -5
  39. data/.oss-guides.rubocop.yml +0 -1077
  40. data/.rubocop.yml +0 -10
  41. data/Rakefile +0 -8
  42. data/bin/rspec +0 -17
  43. data/spec/assets/header.html +0 -7
  44. data/spec/assets/html.scss +0 -20
  45. data/spec/assets/html_override.css +0 -1
  46. data/spec/assets/htmlcover.html +0 -4
  47. data/spec/assets/htmlintro.html +0 -5
  48. data/spec/assets/i18n.yaml +0 -41
  49. data/spec/assets/iso.xml +0 -8
  50. data/spec/assets/odf.emf +0 -0
  51. data/spec/assets/odf.svg +0 -1
  52. data/spec/assets/odf1.svg +0 -4
  53. data/spec/assets/outputtest/a.xml +0 -66
  54. data/spec/assets/outputtest/iso.international-standard.xsl +0 -3011
  55. data/spec/assets/rice_image1 +0 -0
  56. data/spec/assets/rice_image1.png +0 -0
  57. data/spec/assets/scripts.html +0 -3
  58. data/spec/assets/scripts_override.html +0 -3
  59. data/spec/assets/std.css +0 -2
  60. data/spec/assets/word.css +0 -2
  61. data/spec/assets/word_override.css +0 -1
  62. data/spec/assets/wordcover.html +0 -3
  63. data/spec/assets/wordintro.html +0 -4
  64. data/spec/isodoc/blocks_spec.rb +0 -2934
  65. data/spec/isodoc/cleanup_spec.rb +0 -1056
  66. data/spec/isodoc/footnotes_spec.rb +0 -264
  67. data/spec/isodoc/form_spec.rb +0 -160
  68. data/spec/isodoc/i18n_spec.rb +0 -1201
  69. data/spec/isodoc/inline_spec.rb +0 -2301
  70. data/spec/isodoc/lists_spec.rb +0 -469
  71. data/spec/isodoc/metadata_spec.rb +0 -401
  72. data/spec/isodoc/postproc_spec.rb +0 -2941
  73. data/spec/isodoc/presentation_xml_spec.rb +0 -1476
  74. data/spec/isodoc/ref_spec.rb +0 -955
  75. data/spec/isodoc/section_spec.rb +0 -2123
  76. data/spec/isodoc/table_spec.rb +0 -588
  77. data/spec/isodoc/terms_spec.rb +0 -712
  78. data/spec/isodoc/utils_spec.rb +0 -57
  79. data/spec/isodoc/xref_numbering_spec.rb +0 -378
  80. data/spec/isodoc/xref_spec.rb +0 -1837
  81. data/spec/isodoc/xslfo_convert_spec.rb +0 -103
  82. data/spec/spec_helper.rb +0 -81
@@ -1,1476 +0,0 @@
1
- require "spec_helper"
2
-
3
- RSpec.describe IsoDoc do
4
- it "generates file based on string input" do
5
- FileUtils.rm_f "test.presentation.xml"
6
- IsoDoc::PresentationXMLConvert.new({ filename: "test" })
7
- .convert("test", <<~"INPUT", false)
8
- <iso-standard xmlns="http://riboseinc.com/isoxml">
9
- <bibdata>
10
- <title language="en">test</title>
11
- </bibdata>
12
- <preface><foreword>
13
- <note>
14
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
15
- </note>
16
- </foreword></preface>
17
- </iso-standard>
18
- INPUT
19
- expect(File.exist?("test.presentation.xml")).to be true
20
- end
21
-
22
- it "localises numbers in MathML" do
23
- input = <<~INPUT
24
- <iso-standard xmlns="http://riboseinc.com/isoxml">
25
- <bibdata>
26
- <title language="en">test</title>
27
- </bibdata>
28
- <preface>
29
- <p>
30
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>...</mn></math></stem>
31
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>64212149677264515</mn></math></stem>
32
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>642121496772645.15</mn></math></stem>
33
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
34
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi><mfenced open="(" close=")"><mrow><mi>X</mi><mo>≥</mo><msub><mrow><mi>X</mi></mrow><mrow><mo>max</mo></mrow></msub></mrow></mfenced><mo>=</mo><munderover><mrow><mo>∑</mo></mrow><mrow><mrow><mi>j</mi><mo>=</mo><msub><mrow><mi>X</mi></mrow><mrow><mo>max</mo></mrow></msub></mrow></mrow><mrow><mn>1000</mn></mrow></munderover><mfenced open="(" close=")"><mtable><mtr><mtd><mn>1000</mn></mtd></mtr><mtr><mtd><mi>j</mi></mtd></mtr></mtable></mfenced><msup><mrow><mi>p</mi></mrow><mrow><mi>j</mi></mrow></msup><msup><mrow><mfenced open="(" close=")"><mrow><mn>1</mn><mo>−</mo><mi>p</mi></mrow></mfenced></mrow><mrow><mrow><mn>1.003</mn><mo>−</mo><mi>j</mi></mrow></mrow></msup></math></stem></p>
35
- </preface>
36
- </iso-standard>
37
- INPUT
38
- output = <<~OUTPUT
39
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
40
- <bibdata>
41
- <title language='en'>test</title>
42
- </bibdata>
43
- <preface>
44
- <p displayorder="1">
45
- ...
46
- 64,212,149,677,264,515
47
- 642,121,496,772,645.15 30,000
48
- <stem type='MathML'>
49
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
50
- <mi>P</mi>
51
- <mfenced open='(' close=')'>
52
- <mrow>
53
- <mi>X</mi>
54
- <mo>&#x2265;</mo>
55
- <msub>
56
- <mrow>
57
- <mi>X</mi>
58
- </mrow>
59
- <mrow>
60
- <mo>max</mo>
61
- </mrow>
62
- </msub>
63
- </mrow>
64
- </mfenced>
65
- <mo>=</mo>
66
- <munderover>
67
- <mrow>
68
- <mo>&#x2211;</mo>
69
- </mrow>
70
- <mrow>
71
- <mrow>
72
- <mi>j</mi>
73
- <mo>=</mo>
74
- <msub>
75
- <mrow>
76
- <mi>X</mi>
77
- </mrow>
78
- <mrow>
79
- <mo>max</mo>
80
- </mrow>
81
- </msub>
82
- </mrow>
83
- </mrow>
84
- <mrow>
85
- <mn>1,000</mn>
86
- </mrow>
87
- </munderover>
88
- <mfenced open='(' close=')'>
89
- <mtable>
90
- <mtr>
91
- <mtd>
92
- <mn>1,000</mn>
93
- </mtd>
94
- </mtr>
95
- <mtr>
96
- <mtd>
97
- <mi>j</mi>
98
- </mtd>
99
- </mtr>
100
- </mtable>
101
- </mfenced>
102
- <msup>
103
- <mrow>
104
- <mi>p</mi>
105
- </mrow>
106
- <mrow>
107
- <mi>j</mi>
108
- </mrow>
109
- </msup>
110
- <msup>
111
- <mrow>
112
- <mfenced open='(' close=')'>
113
- <mrow>
114
- <mn>1</mn>
115
- <mo>&#x2212;</mo>
116
- <mi>p</mi>
117
- </mrow>
118
- </mfenced>
119
- </mrow>
120
- <mrow>
121
- <mrow>
122
- <mn>1.003</mn>
123
- <mo>&#x2212;</mo>
124
- <mi>j</mi>
125
- </mrow>
126
- </mrow>
127
- </msup>
128
- </math>
129
- </stem>
130
- </p>
131
- </preface>
132
- </iso-standard>
133
- OUTPUT
134
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
135
- .convert("test", input, true))
136
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
137
- .to be_equivalent_to xmlpp(output)
138
- end
139
-
140
- context "when twitter_cldr_localiser_symbols has additional options" do
141
- let(:input) do
142
- <<~INPUT
143
- <iso-standard xmlns="http://riboseinc.com/isoxml">
144
- <bibdata>
145
- <title language="en">test</title>
146
- </bibdata>
147
- <preface>
148
- <p>
149
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
150
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML">
151
- <mi>P</mi>
152
- <mfenced open="(" close=")">
153
- <mrow>
154
- <mi>X</mi>
155
- <mo>≥</mo>
156
- <msub>
157
- <mrow>
158
- <mi>X</mi>
159
- </mrow>
160
- <mrow>
161
- <mo>max</mo>
162
- </mrow>
163
- </msub>
164
- </mrow>
165
- </mfenced>
166
- <mo>=</mo>
167
- <munderover>
168
- <mrow>
169
- <mo>∑</mo>
170
- </mrow>
171
- <mrow>
172
- <mrow>
173
- <mi>j</mi>
174
- <mo>=</mo>
175
- <msub>
176
- <mrow>
177
- <mi>X</mi>
178
- </mrow>
179
- <mrow>
180
- <mo>max</mo>
181
- </mrow>
182
- </msub>
183
- </mrow>
184
- </mrow>
185
- <mrow>
186
- <mn>1000</mn>
187
- </mrow>
188
- </munderover>
189
- <mfenced open="(" close=")">
190
- <mtable>
191
- <mtr>
192
- <mtd>
193
- <mn>1000</mn>
194
- </mtd>
195
- </mtr>
196
- <mtr>
197
- <mtd>
198
- <mi>j</mi>
199
- </mtd>
200
- </mtr>
201
- </mtable>
202
- </mfenced>
203
- <msup>
204
- <mrow>
205
- <mi>p</mi>
206
- </mrow>
207
- <mrow>
208
- <mi>j</mi>
209
- </mrow>
210
- </msup>
211
- <msup>
212
- <mrow>
213
- <mfenced open="(" close=")">
214
- <mrow>
215
- <mn>1</mn>
216
- <mo>−</mo>
217
- <mi>p</mi>
218
- </mrow>
219
- </mfenced>
220
- </mrow>
221
- <mrow>
222
- <mrow>
223
- <mn>1.003</mn>
224
- <mo>−</mo>
225
- <mi>j</mi>
226
- </mrow>
227
- </mrow>
228
- </msup>
229
- <msup>
230
- <mrow>
231
- <mfenced open="(" close=")">
232
- <mrow>
233
- <mn>1</mn>
234
- <mo>−</mo>
235
- <mi>p</mi>
236
- </mrow>
237
- </mfenced>
238
- </mrow>
239
- <mrow>
240
- <mrow>
241
- <mn>459384.123456789</mn>
242
- <mo>−</mo>
243
- <mi>j</mi>
244
- </mrow>
245
- </mrow>
246
- </msup>
247
- </math></stem>
248
- </p>
249
- </preface>
250
- </iso-standard>
251
- INPUT
252
- end
253
- let(:output) do
254
- <<~OUTPUT
255
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
256
- <bibdata>
257
- <title language='en'>test</title>
258
- </bibdata>
259
-
260
- <preface>
261
- <p displayorder="1">
262
- 30,000
263
- <stem type='MathML'>
264
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
265
- <mi>P</mi>
266
- <mfenced open='(' close=')'>
267
- <mrow>
268
- <mi>X</mi>
269
- <mo>&#x2265;</mo>
270
- <msub>
271
- <mrow>
272
- <mi>X</mi>
273
- </mrow>
274
- <mrow>
275
- <mo>max</mo>
276
- </mrow>
277
- </msub>
278
- </mrow>
279
- </mfenced>
280
- <mo>=</mo>
281
- <munderover>
282
- <mrow>
283
- <mo>&#x2211;</mo>
284
- </mrow>
285
- <mrow>
286
- <mrow>
287
- <mi>j</mi>
288
- <mo>=</mo>
289
- <msub>
290
- <mrow>
291
- <mi>X</mi>
292
- </mrow>
293
- <mrow>
294
- <mo>max</mo>
295
- </mrow>
296
- </msub>
297
- </mrow>
298
- </mrow>
299
- <mrow>
300
- <mn>1,000</mn>
301
- </mrow>
302
- </munderover>
303
- <mfenced open='(' close=')'>
304
- <mtable>
305
- <mtr>
306
- <mtd>
307
- <mn>1,000</mn>
308
- </mtd>
309
- </mtr>
310
- <mtr>
311
- <mtd>
312
- <mi>j</mi>
313
- </mtd>
314
- </mtr>
315
- </mtable>
316
- </mfenced>
317
- <msup>
318
- <mrow>
319
- <mi>p</mi>
320
- </mrow>
321
- <mrow>
322
- <mi>j</mi>
323
- </mrow>
324
- </msup>
325
- <msup>
326
- <mrow>
327
- <mfenced open='(' close=')'>
328
- <mrow>
329
- <mn>1</mn>
330
- <mo>&#x2212;</mo>
331
- <mi>p</mi>
332
- </mrow>
333
- </mfenced>
334
- </mrow>
335
- <mrow>
336
- <mrow>
337
- <mn>1.00'3</mn>
338
- <mo>&#x2212;</mo>
339
- <mi>j</mi>
340
- </mrow>
341
- </mrow>
342
- </msup>
343
- <msup>
344
- <mrow>
345
- <mfenced open='(' close=')'>
346
- <mrow>
347
- <mn>1</mn>
348
- <mo>&#x2212;</mo>
349
- <mi>p</mi>
350
- </mrow>
351
- </mfenced>
352
- </mrow>
353
- <mrow>
354
- <mrow>
355
- <mn>459,384.12'34'56</mn>
356
- <mo>&#x2212;</mo>
357
- <mi>j</mi>
358
- </mrow>
359
- </mrow>
360
- </msup>
361
- </math>
362
- </stem>
363
- </p>
364
- </preface>
365
- </iso-standard>
366
- OUTPUT
367
- end
368
- let(:additional_symbols) do
369
- {
370
- fraction_group_digits: 2,
371
- fraction_group: "'",
372
- precision: 5,
373
- }
374
- end
375
-
376
- before do
377
- allow_any_instance_of(IsoDoc::PresentationXMLConvert)
378
- .to(receive(:twitter_cldr_localiser_symbols)
379
- .and_return(additional_symbols))
380
- end
381
-
382
- it "Supports twitter_cldr_localiser_symbols fraction options" do
383
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
384
- .convert("test", input, true))
385
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
386
- .to(be_equivalent_to(xmlpp(output)))
387
- end
388
- end
389
-
390
- it "localises numbers in MathML in French" do
391
- input = <<~INPUT
392
- <iso-standard xmlns="http://riboseinc.com/isoxml">
393
- <bibdata>
394
- <title language="en">test</title>
395
- <language>fr</language>
396
- </bibdata>
397
- <preface>
398
- <p><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math>
399
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi><mfenced open="(" close=")"><mrow><mi>X</mi><mo>≥</mo><msub><mrow><mi>X</mi></mrow><mrow><mo>max</mo></mrow></msub></mrow></mfenced><mo>=</mo><munderover><mrow><mo>∑</mo></mrow><mrow><mrow><mi>j</mi><mo>=</mo><msub><mrow><mi>X</mi></mrow><mrow><mo>max</mo></mrow></msub></mrow></mrow><mrow><mn>1000</mn></mrow></munderover><mfenced open="(" close=")"><mtable><mtr><mtd><mn>1000</mn></mtd></mtr><mtr><mtd><mi>j</mi></mtd></mtr></mtable></mfenced><msup><mrow><mi>p</mi></mrow><mrow><mi>j</mi></mrow></msup><msup><mrow><mfenced open="(" close=")"><mrow><mn>1</mn><mo>−</mo><mi>p</mi></mrow></mfenced></mrow><mrow><mrow><mn>1.003</mn><mo>−</mo><mi>j</mi></mrow></mrow></msup></math></stem></p>
400
- </preface>
401
- </iso-standard>
402
- INPUT
403
- output = <<~OUTPUT
404
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
405
- <bibdata>
406
- <title language='en'>test</title>
407
- <language current='true'>fr</language>
408
- </bibdata>
409
- <preface>
410
- <p displayorder="1">
411
- 30&#x202F;000
412
- <stem type='MathML'>
413
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
414
- <mi>P</mi>
415
- <mfenced open='(' close=')'>
416
- <mrow>
417
- <mi>X</mi>
418
- <mo>&#x2265;</mo>
419
- <msub>
420
- <mrow>
421
- <mi>X</mi>
422
- </mrow>
423
- <mrow>
424
- <mo>max</mo>
425
- </mrow>
426
- </msub>
427
- </mrow>
428
- </mfenced>
429
- <mo>=</mo>
430
- <munderover>
431
- <mrow>
432
- <mo>&#x2211;</mo>
433
- </mrow>
434
- <mrow>
435
- <mrow>
436
- <mi>j</mi>
437
- <mo>=</mo>
438
- <msub>
439
- <mrow>
440
- <mi>X</mi>
441
- </mrow>
442
- <mrow>
443
- <mo>max</mo>
444
- </mrow>
445
- </msub>
446
- </mrow>
447
- </mrow>
448
- <mrow>
449
- <mn>1&#x202F;000</mn>
450
- </mrow>
451
- </munderover>
452
- <mfenced open='(' close=')'>
453
- <mtable>
454
- <mtr>
455
- <mtd>
456
- <mn>1&#x202F;000</mn>
457
- </mtd>
458
- </mtr>
459
- <mtr>
460
- <mtd>
461
- <mi>j</mi>
462
- </mtd>
463
- </mtr>
464
- </mtable>
465
- </mfenced>
466
- <msup>
467
- <mrow>
468
- <mi>p</mi>
469
- </mrow>
470
- <mrow>
471
- <mi>j</mi>
472
- </mrow>
473
- </msup>
474
- <msup>
475
- <mrow>
476
- <mfenced open='(' close=')'>
477
- <mrow>
478
- <mn>1</mn>
479
- <mo>&#x2212;</mo>
480
- <mi>p</mi>
481
- </mrow>
482
- </mfenced>
483
- </mrow>
484
- <mrow>
485
- <mrow>
486
- <mn>1,003</mn>
487
- <mo>&#x2212;</mo>
488
- <mi>j</mi>
489
- </mrow>
490
- </mrow>
491
- </msup>
492
- </math>
493
- </stem>
494
- </p>
495
- </preface>
496
- </iso-standard>
497
- OUTPUT
498
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
499
- .convert("test", input, true))
500
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
501
- .to be_equivalent_to xmlpp(output)
502
- end
503
-
504
- it "customises localisation of numbers" do
505
- mock_symbols
506
- input = <<~INPUT
507
- <iso-standard xmlns="http://riboseinc.com/isoxml">
508
- <bibdata>
509
- <title language="en">test</title>
510
- <language>fr</language>
511
- </bibdata>
512
- <preface>
513
- <p><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
514
- <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mi>P</mi><mfenced open="(" close=")"><mrow><mi>X</mi><mo>≥</mo><msub><mrow><mi>X</mi></mrow><mrow><mo>max</mo></mrow></msub></mrow></mfenced><mo>=</mo><munderover><mrow><mo>∑</mo></mrow><mrow><mrow><mi>j</mi><mo>=</mo><msub><mrow><mi>X</mi></mrow><mrow><mo>max</mo></mrow></msub></mrow></mrow><mrow><mn>1000</mn></mrow></munderover><mfenced open="(" close=")"><mtable><mtr><mtd><mn>1000</mn></mtd></mtr><mtr><mtd><mi>j</mi></mtd></mtr></mtable></mfenced><msup><mrow><mi>p</mi></mrow><mrow><mi>j</mi></mrow></msup><msup><mrow><mfenced open="(" close=")"><mrow><mn>0.0000032</mn><mo>−</mo><mi>p</mi></mrow></mfenced></mrow><mrow><mrow><mn>1.003</mn><mo>−</mo><mi>j</mi></mrow></mrow></msup></math></stem></p>
515
- </preface>
516
- </iso-standard>
517
- INPUT
518
- output = <<~OUTPUT
519
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
520
- <bibdata>
521
- <title language='en'>test</title>
522
- <language current='true'>fr</language>
523
- </bibdata>
524
-
525
- <preface>
526
- <p displayorder="1">
527
- 30'000
528
- <stem type='MathML'>
529
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
530
- <mi>P</mi>
531
- <mfenced open='(' close=')'>
532
- <mrow>
533
- <mi>X</mi>
534
- <mo>&#x2265;</mo>
535
- <msub>
536
- <mrow>
537
- <mi>X</mi>
538
- </mrow>
539
- <mrow>
540
- <mo>max</mo>
541
- </mrow>
542
- </msub>
543
- </mrow>
544
- </mfenced>
545
- <mo>=</mo>
546
- <munderover>
547
- <mrow>
548
- <mo>&#x2211;</mo>
549
- </mrow>
550
- <mrow>
551
- <mrow>
552
- <mi>j</mi>
553
- <mo>=</mo>
554
- <msub>
555
- <mrow>
556
- <mi>X</mi>
557
- </mrow>
558
- <mrow>
559
- <mo>max</mo>
560
- </mrow>
561
- </msub>
562
- </mrow>
563
- </mrow>
564
- <mrow>
565
- <mn>1'000</mn>
566
- </mrow>
567
- </munderover>
568
- <mfenced open='(' close=')'>
569
- <mtable>
570
- <mtr>
571
- <mtd>
572
- <mn>1'000</mn>
573
- </mtd>
574
- </mtr>
575
- <mtr>
576
- <mtd>
577
- <mi>j</mi>
578
- </mtd>
579
- </mtr>
580
- </mtable>
581
- </mfenced>
582
- <msup>
583
- <mrow>
584
- <mi>p</mi>
585
- </mrow>
586
- <mrow>
587
- <mi>j</mi>
588
- </mrow>
589
- </msup>
590
- <msup>
591
- <mrow>
592
- <mfenced open='(' close=')'>
593
- <mrow>
594
- <mn>0,0000032</mn>
595
- <mo>&#x2212;</mo>
596
- <mi>p</mi>
597
- </mrow>
598
- </mfenced>
599
- </mrow>
600
- <mrow>
601
- <mrow>
602
- <mn>1,003</mn>
603
- <mo>&#x2212;</mo>
604
- <mi>j</mi>
605
- </mrow>
606
- </mrow>
607
- </msup>
608
- </math>
609
- </stem>
610
- </p>
611
- </preface>
612
- </iso-standard>
613
- OUTPUT
614
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
615
- .convert("test", input, true))
616
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
617
- .to be_equivalent_to xmlpp(output)
618
- end
619
-
620
- it "resolve address components" do
621
- input = <<~INPUT
622
- <iso-standard xmlns="http://riboseinc.com/isoxml">
623
- <bibdata>
624
- <contributor>
625
- <role type='author'/>
626
- <person>
627
- <name>
628
- <completename>Fred Flintstone</completename>
629
- </name>
630
- <affiliation>
631
- <organization>
632
- <name>Slate Rock and Gravel Company</name>
633
- <address>
634
- <street>1 Infinity Loop</street>
635
- <city>Cupertino</city>
636
- <state>CA</state>
637
- <country>USA</country>
638
- <postcode>95014</postcode>
639
- </address>
640
- </organization>
641
- </affiliation>
642
- </person>
643
- </contributor>
644
- </bibdata>
645
- </iso-standard>
646
- INPUT
647
- output = <<~OUTPUT
648
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
649
- <bibdata>
650
- <contributor>
651
- <role type='author'/>
652
- <person>
653
- <name>
654
- <completename>Fred Flintstone</completename>
655
- </name>
656
- <affiliation>
657
- <organization>
658
- <name>Slate Rock and Gravel Company</name>
659
- <address>
660
- <formattedAddress>
661
- 1 Infinity Loop
662
- <br/>
663
- Cupertino
664
- <br/>
665
- CA
666
- <br/>
667
- USA 95014
668
- </formattedAddress>
669
- </address>
670
- </organization>
671
- </affiliation>
672
- </person>
673
- </contributor>
674
- </bibdata>
675
- </iso-standard>
676
- OUTPUT
677
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
678
- .convert("test", input, true))
679
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
680
- .to be_equivalent_to xmlpp(output)
681
- end
682
-
683
- it "strips variant-title" do
684
- input = <<~INPUT
685
- <iso-standard xmlns="http://riboseinc.com/isoxml">
686
- <bibdata/>
687
- <sections>
688
- <clause id='_' inline-header='false' obligation='normative'>
689
- <title>Clause</title>
690
- <p id='_'>Text</p>
691
- <clause id='_' inline-header='false' obligation='normative'>
692
- <title>Subclause</title>
693
- <variant-title variant_title='true' type='sub' id='_'>&#8220;A&#8221; &#8216;B&#8217;</variant-title>
694
- <variant-title variant_title='true' type='toc' id='_'>
695
- Clause
696
- <em>A</em>
697
- <stem type='MathML'>
698
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
699
- <mi>x</mi>
700
- </math>
701
- </stem>
702
- </variant-title>
703
- <p id='_'>Text</p>
704
- </clause>
705
- </clause>
706
- </sections>
707
- <annex id='_' inline-header='false' obligation='normative'>
708
- <title>Clause</title>
709
- <variant-title variant_title='true' type='toc' id='_'>
710
- Clause
711
- <em>A</em>
712
- <stem type='MathML'>
713
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
714
- <mi>x</mi>
715
- </math>
716
- </stem>
717
- </variant-title>
718
- <p id='_'>Text</p>
719
- </annex>
720
- </iso-standard>
721
- INPUT
722
- presxml = <<~OUTPUT
723
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
724
- <bibdata/>
725
- <sections>
726
- <clause id='_' inline-header='false' obligation='normative' displayorder='1'>
727
- <title depth='1'>
728
- <strong>Annex A</strong>
729
- <br/>
730
- (normative).
731
- <tab/>
732
- Clause
733
- </title>
734
- <p id='_'>Text</p>
735
- <clause id='_' inline-header='false' obligation='normative'>
736
- <title depth='1'>
737
- <strong>Annex A</strong>
738
- <br/>
739
- (normative).
740
- <tab/>
741
- Subclause
742
- </title>
743
- <variant-title variant_title='true' type='sub' id='_'>&#x201C;A&#x201D; &#x2018;B&#x2019;</variant-title>
744
- <variant-title variant_title='true' type='toc' id='_'>
745
- Clause
746
- <em>A</em>
747
- <stem type='MathML'>
748
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
749
- <mi>x</mi>
750
- </math>
751
- <!-- x -->
752
- </stem>
753
- </variant-title>
754
- <p id='_'>Text</p>
755
- </clause>
756
- </clause>
757
- </sections>
758
- <annex id='_' inline-header='false' obligation='normative' displayorder='2'>
759
- <title>
760
- <strong>Annex A</strong>
761
- <br/>
762
- (normative)
763
- <br/>
764
- <br/>
765
- <strong>Clause</strong>
766
- </title>
767
- <variant-title variant_title='true' type='toc' id='_'>
768
- Clause
769
- <em>A</em>
770
- <stem type='MathML'>
771
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
772
- <mi>x</mi>
773
- </math>
774
- <!-- x -->
775
- </stem>
776
- </variant-title>
777
- <p id='_'>Text</p>
778
- </annex>
779
- </iso-standard>
780
- OUTPUT
781
- html = <<~OUTPUT
782
- <html lang='en'>
783
- <head/>
784
- <body lang='en'>
785
- <div class='title-section'>
786
- <p>&#160;</p>
787
- </div>
788
- <br/>
789
- <div class='prefatory-section'>
790
- <p>&#160;</p>
791
- </div>
792
- <br/>
793
- <div class='main-section'>
794
- <p class='zzSTDTitle1'/>
795
- <div id='_'>
796
- <h1>
797
- <b>Annex A</b>
798
- <br/>
799
- (normative). &#160; Clause
800
- </h1>
801
- <p id='_'>Text</p>
802
- <div id='_'>
803
- <h1>
804
- <b>Annex A</b>
805
- <br/>
806
- (normative). &#160; Subclause
807
- <br/>
808
- <br/>
809
- &#8220;A&#8221; &#8216;B&#8217;
810
- </h1>
811
- <p style='display:none;' class='variant-title-toc'>
812
- Clause
813
- <i>A</i>
814
- <span class='stem'>
815
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
816
- <mi>x</mi>
817
- </math>
818
- </span>
819
- </p>
820
- <p id='_'>Text</p>
821
- </div>
822
- </div>
823
- <br/>
824
- <div id='_' class='Section3'>
825
- <h1 class='Annex'>
826
- <b>Annex A</b>
827
- <br/>
828
- (normative)
829
- <br/>
830
- <br/>
831
- <b>Clause</b>
832
- </h1>
833
- <p style='display:none;' class='variant-title-toc'>
834
- Clause
835
- <i>A</i>
836
- <span class='stem'>
837
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
838
- <mi>x</mi>
839
- </math>
840
- </span>
841
- </p>
842
- <p id='_'>Text</p>
843
- </div>
844
- </div>
845
- </body>
846
- </html>
847
- OUTPUT
848
- doc = <<~OUTPUT
849
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
850
- <head>
851
- <style>
852
- </style>
853
- </head>
854
- <body lang='EN-US' link='blue' vlink='#954F72'>
855
- <div class='WordSection1'>
856
- <p>&#160;</p>
857
- </div>
858
- <p>
859
- <br clear='all' class='section'/>
860
- </p>
861
- <div class='WordSection2'>
862
- <p>&#160;</p>
863
- </div>
864
- <p>
865
- <br clear='all' class='section'/>
866
- </p>
867
- <div class='WordSection3'>
868
- <p class='zzSTDTitle1'/>
869
- <div id='_'>
870
- <h1>
871
- <b>Annex A</b>
872
- <br/>
873
- (normative).
874
- <span style='mso-tab-count:1'>&#160; </span>
875
- Clause
876
- </h1>
877
- <p id='_'>Text</p>
878
- <div id='_'>
879
- <h1>
880
- <b>Annex A</b>
881
- <br/>
882
- (normative).
883
- <span style='mso-tab-count:1'>&#160; </span>
884
- Subclause
885
- <br/>
886
- <br/>
887
- &#8220;A&#8221; &#8216;B&#8217;
888
- </h1>
889
- <p style='display:none;' class='variant-title-toc'>
890
- Clause
891
- <i>A</i>
892
- <span class='stem'>
893
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
894
- <mi>x</mi>
895
- </math>
896
- </span>
897
- </p>
898
- <p id='_'>Text</p>
899
- </div>
900
- </div>
901
- <p>
902
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
903
- </p>
904
- <div id='_' class='Section3'>
905
- <h1 class='Annex'>
906
- <b>Annex A</b>
907
- <br/>
908
- (normative)
909
- <br/>
910
- <br/>
911
- <b>Clause</b>
912
- </h1>
913
- <p style='display:none;' class='variant-title-toc'>
914
- Clause
915
- <i>A</i>
916
- <span class='stem'>
917
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
918
- <mi>x</mi>
919
- </math>
920
- </span>
921
- </p>
922
- <p id='_'>Text</p>
923
- </div>
924
- </div>
925
- </body>
926
- </html>
927
- OUTPUT
928
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
929
- .convert("test", input, true))
930
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
931
- .to be_equivalent_to xmlpp(presxml)
932
- expect(xmlpp(IsoDoc::HtmlConvert.new({})
933
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(html)
934
- expect(xmlpp(IsoDoc::WordConvert.new({})
935
- .convert("test", presxml, true))).to be_equivalent_to xmlpp(doc)
936
- end
937
-
938
- it "duplicates EMF and SVG files" do
939
- input = <<~INPUT
940
- <iso-standard xmlns="http://riboseinc.com/isoxml">
941
- <bibdata/>
942
- <sections>
943
- <clause id='A' inline-header='false' obligation='normative'>
944
- <title>Clause</title>
945
- <figure id="B">
946
- <image src="spec/assets/odf.svg" mimetype="image/svg+xml" alt="1"/>
947
- <image src="spec/assets/odf.emf" mimetype="image/x-emf" alt="2"/>
948
- <image src="data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAgMTAwIj48Y2lyY2xlIGZpbGw9IiMwMDkiIHI9IjQ1IiBjeD0iNTAiIGN5PSI1MCIvPjxwYXRoIGQ9Ik0zMywyNkg3OEEzNywzNywwLDAsMSwzMyw4M1Y1N0g1OVY0M0gzM1oiIGZpbGw9IiNGRkYiLz48L3N2Zz4=" mimetype="image/svg+xml" alt="3"/>
949
- <image src="data:application/x-msmetafile;base64,AQAAAMgAAAAAAAAAAAAAAPsEAAD7BAAAAAAAAAAAAACLCgAAiwoAACBFTUYAAAEAJAQAACgAAAACAAAALgAAAGwAAAAAAAAA3ScAAH0zAADYAAAAFwEAAAAAAAAAAAAAAAAAAMBLAwDYQQQASQBuAGsAcwBjAGEAcABlACAAMQAuADAAIAAoADQAMAAzADUAYQA0AGYALAAgADIAMAAyADAALQAwADUALQAwADEAKQAgAAAAbwBkAGYALgBlAG0AZgAAAAAAAAARAAAADAAAAAEAAAAkAAAAJAAAAAAAgD8AAAAAAAAAAAAAgD8AAAAAAAAAAAIAAABGAAAALAAAACAAAABTY3JlZW49MTAyMDV4MTMxODFweCwgMjE2eDI3OW1tAEYAAAAwAAAAIwAAAERyYXdpbmc9MTAwLjB4MTAwLjBweCwgMjYuNXgyNi41bW0AABIAAAAMAAAAAQAAABMAAAAMAAAAAgAAABYAAAAMAAAAGAAAABgAAAAMAAAAAAAAABQAAAAMAAAADQAAACcAAAAYAAAAAQAAAAAAAAAAAJkABgAAACUAAAAMAAAAAQAAADsAAAAIAAAAGwAAABAAAACkBAAAcQIAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACkBAAAqAMAAKgDAACkBAAAcQIAAKQEAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAOgEAAKQEAAA/AAAAqAMAAD8AAABxAgAABQAAADQAAAAAAAAAAAAAAP//////////AwAAAD8AAAA6AQAAOgEAAD8AAABxAgAAPwAAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAACoAwAAPwAAAKQEAAA6AQAApAQAAHECAAA9AAAACAAAADwAAAAIAAAAPgAAABgAAAAAAAAAAAAAAP//////////JQAAAAwAAAAFAACAKAAAAAwAAAABAAAAJwAAABgAAAABAAAAAAAAAP///wAGAAAAJQAAAAwAAAABAAAAOwAAAAgAAAAbAAAAEAAAAJ0BAABFAQAANgAAABAAAADPAwAARQEAAAUAAAA0AAAAAAAAAAAAAAD//////////wMAAABfBAAA7QEAAGQEAADjAgAA2wMAAJEDAAAFAAAANAAAAAAAAAAAAAAA//////////8DAAAAUgMAAD4EAABhAgAAcwQAAJ0BAAAOBAAANgAAABAAAACdAQAAyQIAADYAAAAQAAAA4gIAAMkCAAA2AAAAEAAAAOICAAAaAgAANgAAABAAAACdAQAAGgIAAD0AAAAIAAAAPAAAAAgAAAA+AAAAGAAAAAAAAAAAAAAA//////////8lAAAADAAAAAUAAIAoAAAADAAAAAEAAAAOAAAAFAAAAAAAAAAAAAAAJAQAAA==" mimetype="image/x-emf" alt="4"/>
950
- </figure>
951
- </clause>
952
- </sections>
953
- </iso-standard>
954
- INPUT
955
- output = <<~OUTPUT
956
- <?xml version="1.0"?>
957
- <iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
958
- <bibdata/>
959
- <sections>
960
- <clause id="A" inline-header="false" obligation="normative" displayorder="1">
961
- <title depth="1">1.<tab/>Clause</title>
962
- <figure id="B"><name>Figure 1</name>
963
- <image src="spec/assets/odf.svg" mimetype="image/svg+xml" alt="1"><emf src="spec/assets/odf.emf"/></image>
964
- <image src="" mimetype="image/svg+xml" alt="2">
965
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1275.0000" height="1275.0000">
966
- <g transform="translate(-0.0000, -0.0000)">
967
- <g transform="matrix(1.0000 0.0000 0.0000 1.0000 0.0000 0.0000)">
968
- <path d="M 1188.0000,625.0000 C 1188.0000,936.0000 936.0000,1188.0000 625.0000,1188.0000 C 314.0000,1188.0000 63.0000,936.0000 63.0000,625.0000 C 63.0000,314.0000 314.0000,63.0000 625.0000,63.0000 C 936.0000,63.0000 1188.0000,314.0000 1188.0000,625.0000 Z " fill="#000099" stroke="none"/>
969
- <path d="M 413.0000,325.0000 L 975.0000,325.0000 C 1119.0000,493.0000 1124.0000,739.0000 987.0000,913.0000 C 850.0000,1086.0000 609.0000,1139.0000 413.0000,1038.0000 L 413.0000,713.0000 L 738.0000,713.0000 L 738.0000,538.0000 L 413.0000,538.0000 Z " fill="#FFFFFF" stroke="none"/>
970
- </g>
971
- </g>
972
- </svg>
973
- <emf src="data:application/x-msmetafile;base64"/></image>
974
- <image src="" mimetype="image/svg+xml" alt="3"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle fill="#009" r="45" cx="50" cy="50"/><path d="M33,26H78A37,37,0,0,1,33,83V57H59V43H33Z" fill="#FFF"/></svg><emf src="data:application/x-msmetafile;base64"/></image>
975
- <image src="" mimetype="image/svg+xml" alt="4">
976
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="1275.0000" height="1275.0000">
977
- <g transform="translate(-0.0000, -0.0000)">
978
- <g transform="matrix(1.0000 0.0000 0.0000 1.0000 0.0000 0.0000)">
979
- <path d="M 1188.0000,625.0000 C 1188.0000,936.0000 936.0000,1188.0000 625.0000,1188.0000 C 314.0000,1188.0000 63.0000,936.0000 63.0000,625.0000 C 63.0000,314.0000 314.0000,63.0000 625.0000,63.0000 C 936.0000,63.0000 1188.0000,314.0000 1188.0000,625.0000 Z " fill="#000099" stroke="none"/>
980
- <path d="M 413.0000,325.0000 L 975.0000,325.0000 C 1119.0000,493.0000 1124.0000,739.0000 987.0000,913.0000 C 850.0000,1086.0000 609.0000,1139.0000 413.0000,1038.0000 L 413.0000,713.0000 L 738.0000,713.0000 L 738.0000,538.0000 L 413.0000,538.0000 Z " fill="#FFFFFF" stroke="none"/>
981
- </g>
982
- </g>
983
- </svg>
984
- <emf src="data:application/x-msmetafile;base64"/></image>
985
- </figure>
986
- </clause>
987
- </sections>
988
- </iso-standard>
989
- OUTPUT
990
- expect(IsoDoc::PresentationXMLConvert.new({})
991
- .convert("test", input, true)
992
- .sub(%r{<localized-strings>.*</localized-strings>}m, "")
993
- .gsub(%r{"data:application/x-msmetafile;base64,[^"]+"},
994
- '"data:application/x-msmetafile;base64"'))
995
- .to be_equivalent_to (output)
996
- end
997
-
998
- it "adds types to ordered lists" do
999
- input = <<~INPUT
1000
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1001
- <bibdata/>
1002
- <sections>
1003
- <clause id='A' inline-header='false' obligation='normative'>
1004
- <title>Clause</title>
1005
- <ol id="B1">
1006
- <li>A1
1007
- <ol id="B2">
1008
- <li>A2
1009
- <ol id="B3">
1010
- <li>A3
1011
- <ol id="B4">
1012
- <li>A4
1013
- <ol id="B5">
1014
- <li>A5
1015
- <ol id="B6">
1016
- <li>A6
1017
- <ol id="B7">
1018
- <li>A7
1019
- <ol id="B8">
1020
- <li>A8
1021
- <ol id="B9">
1022
- <li>A9
1023
- <ol id="B0">
1024
- <li>A0</li>
1025
- </ol></li>
1026
- </ol></li>
1027
- </ol></li>
1028
- </ol></li>
1029
- </ol></li>
1030
- </ol></li>
1031
- </ol></li>
1032
- </ol></li>
1033
- </ol></li>
1034
- </ol>
1035
- </clause>
1036
- </sections>
1037
- </iso-standard>#{' '}
1038
- INPUT
1039
- presxml = <<~OUTPUT
1040
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1041
- <bibdata/>
1042
- <sections>
1043
- <clause id='A' inline-header='false' obligation='normative' displayorder='1'>
1044
- <title depth='1'>
1045
- 1.
1046
- <tab/>
1047
- Clause
1048
- </title>
1049
- <ol id='B1' type='alphabet'>
1050
- <li>
1051
- A1
1052
- <ol id='B2' type='arabic'>
1053
- <li>
1054
- A2
1055
- <ol id='B3' type='roman'>
1056
- <li>
1057
- A3
1058
- <ol id='B4' type='alphabet_upper'>
1059
- <li>
1060
- A4
1061
- <ol id='B5' type='roman_upper'>
1062
- <li>
1063
- A5
1064
- <ol id='B6' type='alphabet'>
1065
- <li>
1066
- A6
1067
- <ol id='B7' type='arabic'>
1068
- <li>
1069
- A7
1070
- <ol id='B8' type='roman'>
1071
- <li>
1072
- A8
1073
- <ol id='B9' type='alphabet_upper'>
1074
- <li>
1075
- A9
1076
- <ol id='B0' type='roman_upper'>
1077
- <li>A0</li>
1078
- </ol>
1079
- </li>
1080
- </ol>
1081
- </li>
1082
- </ol>
1083
- </li>
1084
- </ol>
1085
- </li>
1086
- </ol>
1087
- </li>
1088
- </ol>
1089
- </li>
1090
- </ol>
1091
- </li>
1092
- </ol>
1093
- </li>
1094
- </ol>
1095
- </li>
1096
- </ol>
1097
- </clause>
1098
- </sections>
1099
- </iso-standard>
1100
- OUTPUT
1101
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1102
- .convert("test", input, true))
1103
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1104
- .to be_equivalent_to xmlpp(presxml)
1105
- end
1106
-
1107
- it "considers ul when adding types to ordered lists" do
1108
- input = <<~INPUT
1109
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1110
- <bibdata/>
1111
- <sections>
1112
- <clause id='A' inline-header='false' obligation='normative'>
1113
- <title>Clause</title>
1114
- <ol id="B1">
1115
- <li>A1
1116
- <ul id="B2">
1117
- <li>A2
1118
- <ol id="B3">
1119
- <li>A3
1120
- </ol></li>
1121
- </ul></li>
1122
- </ol>
1123
- </clause>
1124
- </sections>
1125
- </iso-standard>
1126
- INPUT
1127
- presxml = <<~OUTPUT
1128
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1129
- <bibdata/>
1130
-
1131
- <sections>
1132
- <clause id='A' inline-header='false' obligation='normative' displayorder='1'>
1133
- <title depth='1'>
1134
- 1.
1135
- <tab/>
1136
- Clause
1137
- </title>
1138
- <ol id='B1' type='alphabet'>
1139
- <li>
1140
- A1
1141
- <ul id='B2'>
1142
- <li>
1143
- A2
1144
- <ol id='B3' type='roman'>
1145
- <li>A3 </li>
1146
- </ol>
1147
- </li>
1148
- </ul>
1149
- </li>
1150
- </ol>
1151
- </clause>
1152
- </sections>
1153
- </iso-standard>
1154
- OUTPUT
1155
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1156
- .convert("test", input, true))
1157
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1158
- .to be_equivalent_to xmlpp(presxml)
1159
- end
1160
-
1161
- it "inserts toc metadata" do
1162
- input = <<~INPUT
1163
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1164
- <bibdata/>
1165
- <sections>
1166
- </sections>
1167
- </iso-standard>
1168
- INPUT
1169
- presxml = <<~OUTPUT
1170
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1171
- <bibdata/>
1172
- <misc-container>
1173
- <toc type='figure'>
1174
- <title>List of figures</title>
1175
- </toc>
1176
- <toc type='table'>
1177
- <title>List of tables</title>
1178
- </toc>
1179
- <toc type='recommendation'>
1180
- <title>List of recommendations</title>
1181
- </toc>
1182
- </misc-container>
1183
- <sections> </sections>
1184
- </iso-standard>
1185
- OUTPUT
1186
- expect(xmlpp(IsoDoc::PresentationXMLConvert
1187
- .new({ tocfigures: true,
1188
- toctables: true,
1189
- tocrecommendations: true })
1190
- .convert("test", input, true))
1191
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1192
- .to be_equivalent_to xmlpp(presxml)
1193
- end
1194
-
1195
- it "processes multiple-target xrefs" do
1196
- input = <<~INPUT
1197
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1198
- <bibdata/>
1199
- <sections>
1200
- <clause id="A" inline-header="false" obligation="normative">
1201
- <title>Section</title>
1202
- <p id="A"><xref target="ref1"><location target="ref1" connective="from"/><location target="ref2" connective="to"/></xref>
1203
- <xref target="ref1"><location target="ref1" connective="from"/><location target="ref2" connective="to"/>text</xref>
1204
- <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="and"/></xref>
1205
- <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="and"/><location target="ref3" connective="and"/></xref>
1206
- <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="and"/>text</xref>
1207
- <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="or"/></xref>
1208
- <xref target="ref1"><location target="ref1" connective="and"/><location target="ref2" connective="or"/><location target="ref3" connective="or"/></xref>
1209
- <xref target="ref1"><location target="ref1" connective="from"/><location target="ref2" connective="to"/><location target="ref3" connective="and"/><location target="ref4" connective="to"/></xref></p>
1210
- </clause>
1211
- <clause id="ref1"/>
1212
- <clause id="ref2"/>
1213
- <clause id="ref3"/>
1214
- <clause id="ref4"/>
1215
- </sections>
1216
- </iso-standard>
1217
- INPUT
1218
- presxml = <<~OUTPUT
1219
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1220
- <bibdata/>
1221
-
1222
- <sections>
1223
- <clause id='A' inline-header='false' obligation='normative' displayorder='1'>
1224
- <title depth='1'>
1225
- 1.
1226
- <tab/>
1227
- Section
1228
- </title>
1229
- <p id='A'>
1230
- <xref target='ref1'>
1231
- <location target='ref1' connective='from'/>
1232
- <location target='ref2' connective='to'/>
1233
- Clause 2 to 3
1234
- </xref>
1235
- <xref target='ref1'>
1236
- <location target='ref1' connective='from'/>
1237
- <location target='ref2' connective='to'/>
1238
- text
1239
- </xref>
1240
- <xref target='ref1'>
1241
- <location target='ref1' connective='and'/>
1242
- <location target='ref2' connective='and'/>
1243
- Clause 2 and 3
1244
- </xref>
1245
- <xref target='ref1'>
1246
- <location target='ref1' connective='and'/>
1247
- <location target='ref2' connective='and'/>
1248
- <location target='ref3' connective='and'/>
1249
- Clause 2, 3, and 4
1250
- </xref>
1251
- <xref target='ref1'>
1252
- <location target='ref1' connective='and'/>
1253
- <location target='ref2' connective='and'/>
1254
- text
1255
- </xref>
1256
- <xref target='ref1'>
1257
- <location target='ref1' connective='and'/>
1258
- <location target='ref2' connective='or'/>
1259
- Clause 2 or 3
1260
- </xref>
1261
- <xref target='ref1'>
1262
- <location target='ref1' connective='and'/>
1263
- <location target='ref2' connective='or'/>
1264
- <location target='ref3' connective='or'/>
1265
- Clause 2, 3, or 4
1266
- </xref>
1267
- <xref target='ref1'>
1268
- <location target='ref1' connective='from'/>
1269
- <location target='ref2' connective='to'/>
1270
- <location target='ref3' connective='and'/>
1271
- <location target='ref4' connective='to'/>
1272
- Clause 2 to 3 and 4 to 5
1273
- </xref>
1274
- </p>
1275
- </clause>
1276
- <clause id='ref1' displayorder='2'>
1277
- <title>2.</title>
1278
- </clause>
1279
- <clause id='ref2' displayorder='3'>
1280
- <title>3.</title>
1281
- </clause>
1282
- <clause id='ref3' displayorder='4'>
1283
- <title>4.</title>
1284
- </clause>
1285
- <clause id='ref4' displayorder='5'>
1286
- <title>5.</title>
1287
- </clause>
1288
- </sections>
1289
- </iso-standard>
1290
- OUTPUT
1291
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1292
- .convert("test", input, true))
1293
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1294
- .to be_equivalent_to xmlpp(presxml)
1295
- end
1296
-
1297
- it "captions embedded figures" do
1298
- input = <<~INPUT
1299
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1300
- <bibdata/>
1301
- <sections>
1302
- <clause id="A" inline-header="false" obligation="normative">
1303
- <title>Section</title>
1304
- <figure id="B1">
1305
- <name>First</name>
1306
- </figure>
1307
- <example id="C1">
1308
- <figure id="B2">
1309
- <name>Second</name>
1310
- </figure>
1311
- </example>
1312
- <example id="C2">
1313
- <figure id="B4" unnumbered="true">
1314
- <name>Unnamed</name>
1315
- </figure>
1316
- </example>
1317
- <figure id="B3">
1318
- <name>Third</name>
1319
- </figure>
1320
- </clause>
1321
- </sections>
1322
- </iso-standard>
1323
- INPUT
1324
- presxml = <<~OUTPUT
1325
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1326
- <bibdata/>
1327
-
1328
- <sections>
1329
- <clause id='A' inline-header='false' obligation='normative' displayorder='1'>
1330
- <title depth='1'>
1331
- 1.
1332
- <tab/>
1333
- Section
1334
- </title>
1335
- <figure id='B1'>
1336
- <name>Figure 1&#xA0;&#x2014; First</name>
1337
- </figure>
1338
- <example id='C1'>
1339
- <name>EXAMPLE 1</name>
1340
- <figure id='B2'>
1341
- <name>Figure 2&#xA0;&#x2014; Second</name>
1342
- </figure>
1343
- </example>
1344
- <example id='C2'>
1345
- <name>EXAMPLE 2</name>
1346
- <figure id='B4' unnumbered='true'>
1347
- <name>Unnamed</name>
1348
- </figure>
1349
- </example>
1350
- <figure id='B3'>
1351
- <name>Figure 3&#xA0;&#x2014; Third</name>
1352
- </figure>
1353
- </clause>
1354
- </sections>
1355
- </iso-standard>
1356
- OUTPUT
1357
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1358
- .convert("test", input, true))
1359
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1360
- .to be_equivalent_to xmlpp(presxml)
1361
- end
1362
-
1363
- it "passes font names to Presentation XML" do
1364
- input = <<~INPUT
1365
- <iso-standard xmlns="http://riboseinc.com/isoxml">
1366
- <bibdata/>
1367
- <sections>
1368
- <clause id="A" inline-header="false" obligation="normative">
1369
- <title>Section</title>
1370
- <figure id="B1">
1371
- <name>First</name>
1372
- </figure>
1373
- </clause>
1374
- </sections>
1375
- </iso-standard>
1376
- INPUT
1377
- presxml = <<~OUTPUT
1378
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
1379
- <bibdata/>
1380
- <presentation-metadata>
1381
- <name>font-license-agreement</name>
1382
- <value>no-install-fonts</value>
1383
- </presentation-metadata>
1384
- <presentation-metadata>
1385
- <name>fonts</name>
1386
- <value>font2</value>
1387
- </presentation-metadata>
1388
- <presentation-metadata>
1389
- <name>fonts</name>
1390
- <value>font1</value>
1391
- </presentation-metadata>
1392
- <sections>
1393
- <clause id='A' inline-header='false' obligation='normative' displayorder='1'>
1394
- <title depth='1'>
1395
- 1.
1396
- <tab/>
1397
- Section
1398
- </title>
1399
- <figure id='B1'>
1400
- <name>Figure 1&#xA0;&#x2014; First</name>
1401
- </figure>
1402
- </clause>
1403
- </sections>
1404
- </iso-standard>
1405
- OUTPUT
1406
- expect(xmlpp(IsoDoc::PresentationXMLConvert
1407
- .new({ fonts: "font1; font2", fontlicenseagreement: "no-install-fonts" })
1408
- .convert("test", input, true))
1409
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1410
- .to be_equivalent_to xmlpp(presxml)
1411
- end
1412
-
1413
- it "skips numbering of hidden sections" do
1414
- input = <<~INPUT
1415
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="semantic">
1416
- <bibdata/>
1417
- <sections><clause id="_scope" type="scope" inline-header="false" obligation="normative">
1418
- <title>Scope</title>
1419
- <p id="_8d98c053-85d7-e8cc-75bb-183a14209d61">A</p>
1420
-
1421
- <p id="_2141c040-93a4-785a-73f0-ffad4fa1779f"><eref type="inline" bibitemid="_607373b1-0cc4-fcdb-c482-fd86ae572bd1" citeas="ISO 639-2"/></p>
1422
- </clause>
1423
-
1424
- <terms id="_terms_and_definitions" obligation="normative">
1425
- <title>Terms and definitions</title><p id="_36938d4b-05e5-bd0f-a082-0415db50e8f7">No terms and definitions are listed in this document.</p>
1426
-
1427
- </terms>
1428
- </sections><bibliography><references hidden="true" normative="true">
1429
- <title>Normative references</title>
1430
- </references>
1431
- </bibliography></standard-document>
1432
- INPUT
1433
- presxml = <<~OUTPUT
1434
- <standard-document xmlns="https://www.metanorma.org/ns/standoc" type="presentation">
1435
- <bibdata/>
1436
- <sections>
1437
- <clause id='_scope' type='scope' inline-header='false' obligation='normative' displayorder='1'>
1438
- <title depth='1'>
1439
- 1.
1440
- <tab/>
1441
- Scope
1442
- </title>
1443
- <p id='_8d98c053-85d7-e8cc-75bb-183a14209d61'>A</p>
1444
- <p id='_2141c040-93a4-785a-73f0-ffad4fa1779f'>
1445
- <eref type='inline' bibitemid='_607373b1-0cc4-fcdb-c482-fd86ae572bd1' citeas='ISO 639-2'>ISO 639-2</eref>
1446
- </p>
1447
- </clause>
1448
- <terms id='_terms_and_definitions' obligation='normative' displayorder='3'>
1449
- <title depth='1'>
1450
- 2.
1451
- <tab/>
1452
- Terms and definitions
1453
- </title>
1454
- <p id='_36938d4b-05e5-bd0f-a082-0415db50e8f7'>No terms and definitions are listed in this document.</p>
1455
- </terms>
1456
- </sections>
1457
- <bibliography>
1458
- <references hidden='true' normative='true' displayorder='2'>
1459
- <title depth='1'>Normative references</title>
1460
- </references>
1461
- </bibliography>
1462
- </standard-document>
1463
- OUTPUT
1464
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
1465
- .convert("test", input, true))
1466
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
1467
- .to be_equivalent_to xmlpp(presxml)
1468
- end
1469
-
1470
- private
1471
-
1472
- def mock_symbols
1473
- allow_any_instance_of(::IsoDoc::PresentationXMLConvert)
1474
- .to receive(:twitter_cldr_localiser_symbols).and_return(group: "'")
1475
- end
1476
- end