isodoc 1.5.5 → 1.6.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +2 -12
- data/.hound.yml +3 -1
- data/.rubocop.yml +3 -7
- data/Gemfile +2 -2
- data/Rakefile +2 -2
- data/bin/rspec +1 -2
- data/isodoc.gemspec +11 -11
- data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
- data/lib/isodoc-yaml/i18n-de.yaml +149 -0
- data/lib/isodoc-yaml/i18n-es.yaml +151 -0
- data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
- data/lib/isodoc.rb +0 -2
- data/lib/isodoc/base_style/all.css +7 -0
- data/lib/isodoc/base_style/metanorma_word.css +7 -0
- data/lib/isodoc/base_style/metanorma_word.scss +8 -0
- data/lib/isodoc/base_style/reset.css +7 -0
- data/lib/isodoc/base_style/reset.scss +9 -0
- data/lib/isodoc/base_style/scripts.html +187 -0
- data/lib/isodoc/class_utils.rb +6 -5
- data/lib/isodoc/common.rb +2 -0
- data/lib/isodoc/convert.rb +30 -17
- data/lib/isodoc/css.rb +43 -34
- data/lib/isodoc/function/blocks.rb +21 -4
- data/lib/isodoc/function/blocks_example_note.rb +2 -2
- data/lib/isodoc/function/cleanup.rb +53 -45
- data/lib/isodoc/function/form.rb +51 -0
- data/lib/isodoc/function/inline.rb +37 -15
- data/lib/isodoc/function/references.rb +55 -42
- data/lib/isodoc/function/section.rb +29 -16
- data/lib/isodoc/function/table.rb +1 -0
- data/lib/isodoc/function/to_word_html.rb +33 -29
- data/lib/isodoc/function/utils.rb +180 -159
- data/lib/isodoc/gem_tasks.rb +30 -31
- data/lib/isodoc/headlesshtml_convert.rb +8 -7
- data/lib/isodoc/html_convert.rb +6 -4
- data/lib/isodoc/html_function/comments.rb +2 -0
- data/lib/isodoc/html_function/footnotes.rb +14 -7
- data/lib/isodoc/html_function/form.rb +62 -0
- data/lib/isodoc/html_function/html.rb +30 -26
- data/lib/isodoc/html_function/postprocess.rb +41 -82
- data/lib/isodoc/html_function/postprocess_footnotes.rb +59 -0
- data/lib/isodoc/i18n.rb +33 -31
- data/lib/isodoc/pdf_convert.rb +12 -16
- data/lib/isodoc/presentation_function/bibdata.rb +54 -30
- data/lib/isodoc/presentation_function/block.rb +17 -8
- data/lib/isodoc/presentation_function/inline.rb +84 -120
- data/lib/isodoc/presentation_function/math.rb +84 -0
- data/lib/isodoc/presentation_function/section.rb +20 -22
- data/lib/isodoc/presentation_xml_convert.rb +2 -1
- data/lib/isodoc/sassc_importer.rb +1 -1
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +28 -24
- data/lib/isodoc/word_function/footnotes.rb +22 -15
- data/lib/isodoc/word_function/postprocess.rb +50 -36
- data/lib/isodoc/xref.rb +9 -10
- data/lib/isodoc/xref/xref_counter.rb +32 -17
- data/lib/isodoc/xref/xref_gen.rb +33 -21
- data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
- data/lib/isodoc/xref/xref_sect_gen.rb +37 -35
- data/lib/isodoc/xslfo_convert.rb +36 -27
- data/spec/assets/scripts_override.html +3 -0
- data/spec/isodoc/blocks_spec.rb +2490 -2591
- data/spec/isodoc/cleanup_spec.rb +1107 -1109
- data/spec/isodoc/footnotes_spec.rb +1 -16
- data/spec/isodoc/form_spec.rb +156 -0
- data/spec/isodoc/i18n_spec.rb +984 -972
- data/spec/isodoc/inline_spec.rb +1129 -912
- data/spec/isodoc/lists_spec.rb +316 -315
- data/spec/isodoc/postproc_spec.rb +1751 -1540
- data/spec/isodoc/presentation_xml_spec.rb +403 -323
- data/spec/isodoc/ref_spec.rb +718 -723
- data/spec/isodoc/section_spec.rb +910 -902
- data/spec/isodoc/table_spec.rb +566 -556
- data/spec/isodoc/terms_spec.rb +251 -255
- data/spec/isodoc/xref_spec.rb +3041 -2992
- data/spec/isodoc/xslfo_convert_spec.rb +39 -0
- data/spec/spec_helper.rb +30 -29
- metadata +77 -65
@@ -1,136 +1,141 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
|
-
it "generates file based on string input" do
|
5
|
-
|
6
|
-
IsoDoc::PresentationXMLConvert.new({filename: "test"})
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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>
|
17
18
|
INPUT
|
18
19
|
expect(File.exist?("test.presentation.xml")).to be true
|
19
20
|
end
|
20
21
|
|
21
|
-
it "localises numbers in MathML" do
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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>64212149677264515</mn></math></stem>
|
31
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>642121496772645.15</mn></math></stem>
|
32
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
|
33
|
+
<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>
|
34
|
+
</preface>
|
35
|
+
</iso-standard>
|
36
|
+
INPUT
|
37
|
+
output = <<~OUTPUT
|
38
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
39
|
+
<bibdata>
|
40
|
+
<title language='en'>test</title>
|
26
41
|
</bibdata>
|
27
42
|
<preface>
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
INPUT
|
36
|
-
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
37
|
-
<bibdata>
|
38
|
-
<title language='en'>test</title>
|
39
|
-
</bibdata>
|
40
|
-
|
41
|
-
<preface>
|
42
|
-
<p>
|
43
|
-
64,212,149,677,264,515
|
44
|
-
642,121,496,772,645.15 30,000
|
45
|
-
<stem type='MathML'>
|
46
|
-
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
47
|
-
<mi>P</mi>
|
48
|
-
<mfenced open='(' close=')'>
|
49
|
-
<mrow>
|
50
|
-
<mi>X</mi>
|
51
|
-
<mo>≥</mo>
|
52
|
-
<msub>
|
53
|
-
<mrow>
|
54
|
-
<mi>X</mi>
|
55
|
-
</mrow>
|
56
|
-
<mrow>
|
57
|
-
<mo>max</mo>
|
58
|
-
</mrow>
|
59
|
-
</msub>
|
60
|
-
</mrow>
|
61
|
-
</mfenced>
|
62
|
-
<mo>=</mo>
|
63
|
-
<munderover>
|
64
|
-
<mrow>
|
65
|
-
<mo>∑</mo>
|
66
|
-
</mrow>
|
67
|
-
<mrow>
|
68
|
-
<mrow>
|
69
|
-
<mi>j</mi>
|
70
|
-
<mo>=</mo>
|
71
|
-
<msub>
|
43
|
+
<p>
|
44
|
+
64,212,149,677,264,515
|
45
|
+
642,121,496,772,645.15 30,000
|
46
|
+
<stem type='MathML'>
|
47
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
48
|
+
<mi>P</mi>
|
49
|
+
<mfenced open='(' close=')'>
|
72
50
|
<mrow>
|
73
51
|
<mi>X</mi>
|
52
|
+
<mo>≥</mo>
|
53
|
+
<msub>
|
54
|
+
<mrow>
|
55
|
+
<mi>X</mi>
|
56
|
+
</mrow>
|
57
|
+
<mrow>
|
58
|
+
<mo>max</mo>
|
59
|
+
</mrow>
|
60
|
+
</msub>
|
74
61
|
</mrow>
|
62
|
+
</mfenced>
|
63
|
+
<mo>=</mo>
|
64
|
+
<munderover>
|
75
65
|
<mrow>
|
76
|
-
<mo
|
66
|
+
<mo>∑</mo>
|
77
67
|
</mrow>
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
</
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
<
|
111
|
-
<
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
68
|
+
<mrow>
|
69
|
+
<mrow>
|
70
|
+
<mi>j</mi>
|
71
|
+
<mo>=</mo>
|
72
|
+
<msub>
|
73
|
+
<mrow>
|
74
|
+
<mi>X</mi>
|
75
|
+
</mrow>
|
76
|
+
<mrow>
|
77
|
+
<mo>max</mo>
|
78
|
+
</mrow>
|
79
|
+
</msub>
|
80
|
+
</mrow>
|
81
|
+
</mrow>
|
82
|
+
<mrow>
|
83
|
+
<mn>1,000</mn>
|
84
|
+
</mrow>
|
85
|
+
</munderover>
|
86
|
+
<mfenced open='(' close=')'>
|
87
|
+
<mtable>
|
88
|
+
<mtr>
|
89
|
+
<mtd>
|
90
|
+
<mn>1,000</mn>
|
91
|
+
</mtd>
|
92
|
+
</mtr>
|
93
|
+
<mtr>
|
94
|
+
<mtd>
|
95
|
+
<mi>j</mi>
|
96
|
+
</mtd>
|
97
|
+
</mtr>
|
98
|
+
</mtable>
|
99
|
+
</mfenced>
|
100
|
+
<msup>
|
101
|
+
<mrow>
|
102
|
+
<mi>p</mi>
|
103
|
+
</mrow>
|
104
|
+
<mrow>
|
105
|
+
<mi>j</mi>
|
106
|
+
</mrow>
|
107
|
+
</msup>
|
108
|
+
<msup>
|
109
|
+
<mrow>
|
110
|
+
<mfenced open='(' close=')'>
|
111
|
+
<mrow>
|
112
|
+
<mn>1</mn>
|
113
|
+
<mo>−</mo>
|
114
|
+
<mi>p</mi>
|
115
|
+
</mrow>
|
116
|
+
</mfenced>
|
117
|
+
</mrow>
|
118
|
+
<mrow>
|
119
|
+
<mrow>
|
120
|
+
<mn>1.003</mn>
|
121
|
+
<mo>−</mo>
|
122
|
+
<mi>j</mi>
|
123
|
+
</mrow>
|
124
|
+
</mrow>
|
125
|
+
</msup>
|
126
|
+
</math>
|
127
|
+
</stem>
|
128
|
+
</p>
|
129
|
+
</preface>
|
130
|
+
</iso-standard>
|
131
|
+
OUTPUT
|
132
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
133
|
+
.convert("test", input, true))
|
134
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
135
|
+
.to be_equivalent_to xmlpp(output)
|
136
|
+
end
|
132
137
|
|
133
|
-
context
|
138
|
+
context "when twitter_cldr_localiser_symbols has additional options" do
|
134
139
|
let(:input) do
|
135
140
|
<<~INPUT
|
136
141
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
@@ -362,246 +367,321 @@ end
|
|
362
367
|
{
|
363
368
|
fraction_group_digits: 2,
|
364
369
|
fraction_group: "'",
|
365
|
-
precision: 5
|
370
|
+
precision: 5,
|
366
371
|
}
|
367
372
|
end
|
368
373
|
|
369
374
|
before do
|
370
375
|
allow_any_instance_of(IsoDoc::PresentationXMLConvert)
|
371
|
-
.to(receive(:twitter_cldr_localiser_symbols)
|
376
|
+
.to(receive(:twitter_cldr_localiser_symbols)
|
377
|
+
.and_return(additional_symbols))
|
372
378
|
end
|
373
379
|
|
374
380
|
it "Supports twitter_cldr_localiser_symbols fraction options" do
|
375
|
-
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
376
|
-
|
381
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
382
|
+
.convert("test", input, true))
|
383
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
377
384
|
.to(be_equivalent_to(xmlpp(output)))
|
378
385
|
end
|
379
386
|
end
|
380
387
|
|
381
|
-
it "localises numbers in MathML in French" do
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
388
|
+
it "localises numbers in MathML in French" do
|
389
|
+
input = <<~INPUT
|
390
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
391
|
+
<bibdata>
|
392
|
+
<title language="en">test</title>
|
393
|
+
<language>fr</language>
|
394
|
+
</bibdata>
|
395
|
+
<preface>
|
396
|
+
<p><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math>
|
397
|
+
<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>
|
398
|
+
</preface>
|
399
|
+
</iso-standard>
|
400
|
+
INPUT
|
401
|
+
output = <<~OUTPUT
|
402
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
403
|
+
<bibdata>
|
404
|
+
<title language='en'>test</title>
|
405
|
+
<language current='true'>fr</language>
|
387
406
|
</bibdata>
|
388
407
|
<preface>
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
<bibdata>
|
396
|
-
<title language='en'>test</title>
|
397
|
-
<language current='true'>fr</language>
|
398
|
-
</bibdata>
|
399
|
-
|
400
|
-
<preface>
|
401
|
-
<p>
|
402
|
-
30 000
|
403
|
-
<stem type='MathML'>
|
404
|
-
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
405
|
-
<mi>P</mi>
|
406
|
-
<mfenced open='(' close=')'>
|
407
|
-
<mrow>
|
408
|
-
<mi>X</mi>
|
409
|
-
<mo>≥</mo>
|
410
|
-
<msub>
|
411
|
-
<mrow>
|
412
|
-
<mi>X</mi>
|
413
|
-
</mrow>
|
414
|
-
<mrow>
|
415
|
-
<mo>max</mo>
|
416
|
-
</mrow>
|
417
|
-
</msub>
|
418
|
-
</mrow>
|
419
|
-
</mfenced>
|
420
|
-
<mo>=</mo>
|
421
|
-
<munderover>
|
422
|
-
<mrow>
|
423
|
-
<mo>∑</mo>
|
424
|
-
</mrow>
|
425
|
-
<mrow>
|
426
|
-
<mrow>
|
427
|
-
<mi>j</mi>
|
428
|
-
<mo>=</mo>
|
429
|
-
<msub>
|
408
|
+
<p>
|
409
|
+
30 000
|
410
|
+
<stem type='MathML'>
|
411
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
412
|
+
<mi>P</mi>
|
413
|
+
<mfenced open='(' close=')'>
|
430
414
|
<mrow>
|
431
415
|
<mi>X</mi>
|
416
|
+
<mo>≥</mo>
|
417
|
+
<msub>
|
418
|
+
<mrow>
|
419
|
+
<mi>X</mi>
|
420
|
+
</mrow>
|
421
|
+
<mrow>
|
422
|
+
<mo>max</mo>
|
423
|
+
</mrow>
|
424
|
+
</msub>
|
432
425
|
</mrow>
|
426
|
+
</mfenced>
|
427
|
+
<mo>=</mo>
|
428
|
+
<munderover>
|
433
429
|
<mrow>
|
434
|
-
<mo
|
430
|
+
<mo>∑</mo>
|
435
431
|
</mrow>
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
</
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
<
|
469
|
-
<
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
<language>fr</language>
|
498
|
-
</bibdata>
|
499
|
-
<preface>
|
500
|
-
<p><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
|
501
|
-
<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>
|
432
|
+
<mrow>
|
433
|
+
<mrow>
|
434
|
+
<mi>j</mi>
|
435
|
+
<mo>=</mo>
|
436
|
+
<msub>
|
437
|
+
<mrow>
|
438
|
+
<mi>X</mi>
|
439
|
+
</mrow>
|
440
|
+
<mrow>
|
441
|
+
<mo>max</mo>
|
442
|
+
</mrow>
|
443
|
+
</msub>
|
444
|
+
</mrow>
|
445
|
+
</mrow>
|
446
|
+
<mrow>
|
447
|
+
<mn>1 000</mn>
|
448
|
+
</mrow>
|
449
|
+
</munderover>
|
450
|
+
<mfenced open='(' close=')'>
|
451
|
+
<mtable>
|
452
|
+
<mtr>
|
453
|
+
<mtd>
|
454
|
+
<mn>1 000</mn>
|
455
|
+
</mtd>
|
456
|
+
</mtr>
|
457
|
+
<mtr>
|
458
|
+
<mtd>
|
459
|
+
<mi>j</mi>
|
460
|
+
</mtd>
|
461
|
+
</mtr>
|
462
|
+
</mtable>
|
463
|
+
</mfenced>
|
464
|
+
<msup>
|
465
|
+
<mrow>
|
466
|
+
<mi>p</mi>
|
467
|
+
</mrow>
|
468
|
+
<mrow>
|
469
|
+
<mi>j</mi>
|
470
|
+
</mrow>
|
471
|
+
</msup>
|
472
|
+
<msup>
|
473
|
+
<mrow>
|
474
|
+
<mfenced open='(' close=')'>
|
475
|
+
<mrow>
|
476
|
+
<mn>1</mn>
|
477
|
+
<mo>−</mo>
|
478
|
+
<mi>p</mi>
|
479
|
+
</mrow>
|
480
|
+
</mfenced>
|
481
|
+
</mrow>
|
482
|
+
<mrow>
|
483
|
+
<mrow>
|
484
|
+
<mn>1,003</mn>
|
485
|
+
<mo>−</mo>
|
486
|
+
<mi>j</mi>
|
487
|
+
</mrow>
|
488
|
+
</mrow>
|
489
|
+
</msup>
|
490
|
+
</math>
|
491
|
+
</stem>
|
492
|
+
</p>
|
502
493
|
</preface>
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
494
|
+
</iso-standard>
|
495
|
+
OUTPUT
|
496
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
497
|
+
.convert("test", input, true))
|
498
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
499
|
+
.to be_equivalent_to xmlpp(output)
|
500
|
+
end
|
510
501
|
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
502
|
+
it "customises localisation of numbers" do
|
503
|
+
mock_symbols
|
504
|
+
input = <<~INPUT
|
505
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
506
|
+
<bibdata>
|
507
|
+
<title language="en">test</title>
|
508
|
+
<language>fr</language>
|
509
|
+
</bibdata>
|
510
|
+
<preface>
|
511
|
+
<p><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
|
512
|
+
<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>
|
513
|
+
</preface>
|
514
|
+
</iso-standard>
|
515
|
+
INPUT
|
516
|
+
output = <<~OUTPUT
|
517
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
518
|
+
<bibdata>
|
519
|
+
<title language='en'>test</title>
|
520
|
+
<language current='true'>fr</language>
|
521
|
+
</bibdata>
|
522
|
+
|
523
|
+
<preface>
|
524
|
+
<p>
|
525
|
+
30'000
|
526
|
+
<stem type='MathML'>
|
527
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
528
|
+
<mi>P</mi>
|
529
|
+
<mfenced open='(' close=')'>
|
522
530
|
<mrow>
|
523
531
|
<mi>X</mi>
|
532
|
+
<mo>≥</mo>
|
533
|
+
<msub>
|
534
|
+
<mrow>
|
535
|
+
<mi>X</mi>
|
536
|
+
</mrow>
|
537
|
+
<mrow>
|
538
|
+
<mo>max</mo>
|
539
|
+
</mrow>
|
540
|
+
</msub>
|
524
541
|
</mrow>
|
542
|
+
</mfenced>
|
543
|
+
<mo>=</mo>
|
544
|
+
<munderover>
|
525
545
|
<mrow>
|
526
|
-
<mo
|
546
|
+
<mo>∑</mo>
|
527
547
|
</mrow>
|
528
|
-
|
529
|
-
</mrow>
|
530
|
-
</mfenced>
|
531
|
-
<mo>=</mo>
|
532
|
-
<munderover>
|
533
|
-
<mrow>
|
534
|
-
<mo>∑</mo>
|
535
|
-
</mrow>
|
536
|
-
<mrow>
|
537
|
-
<mrow>
|
538
|
-
<mi>j</mi>
|
539
|
-
<mo>=</mo>
|
540
|
-
<msub>
|
541
|
-
<mrow>
|
542
|
-
<mi>X</mi>
|
543
|
-
</mrow>
|
548
|
+
<mrow>
|
544
549
|
<mrow>
|
545
|
-
<
|
550
|
+
<mi>j</mi>
|
551
|
+
<mo>=</mo>
|
552
|
+
<msub>
|
553
|
+
<mrow>
|
554
|
+
<mi>X</mi>
|
555
|
+
</mrow>
|
556
|
+
<mrow>
|
557
|
+
<mo>max</mo>
|
558
|
+
</mrow>
|
559
|
+
</msub>
|
546
560
|
</mrow>
|
547
|
-
</
|
548
|
-
|
549
|
-
</mrow>
|
550
|
-
<mrow>
|
551
|
-
<mn>1'000</mn>
|
552
|
-
</mrow>
|
553
|
-
</munderover>
|
554
|
-
<mfenced open='(' close=')'>
|
555
|
-
<mtable>
|
556
|
-
<mtr>
|
557
|
-
<mtd>
|
561
|
+
</mrow>
|
562
|
+
<mrow>
|
558
563
|
<mn>1'000</mn>
|
559
|
-
</
|
560
|
-
</
|
561
|
-
<mtr>
|
562
|
-
<mtd>
|
563
|
-
<mi>j</mi>
|
564
|
-
</mtd>
|
565
|
-
</mtr>
|
566
|
-
</mtable>
|
567
|
-
</mfenced>
|
568
|
-
<msup>
|
569
|
-
<mrow>
|
570
|
-
<mi>p</mi>
|
571
|
-
</mrow>
|
572
|
-
<mrow>
|
573
|
-
<mi>j</mi>
|
574
|
-
</mrow>
|
575
|
-
</msup>
|
576
|
-
<msup>
|
577
|
-
<mrow>
|
564
|
+
</mrow>
|
565
|
+
</munderover>
|
578
566
|
<mfenced open='(' close=')'>
|
567
|
+
<mtable>
|
568
|
+
<mtr>
|
569
|
+
<mtd>
|
570
|
+
<mn>1'000</mn>
|
571
|
+
</mtd>
|
572
|
+
</mtr>
|
573
|
+
<mtr>
|
574
|
+
<mtd>
|
575
|
+
<mi>j</mi>
|
576
|
+
</mtd>
|
577
|
+
</mtr>
|
578
|
+
</mtable>
|
579
|
+
</mfenced>
|
580
|
+
<msup>
|
579
581
|
<mrow>
|
580
|
-
<mn>0,0000032</mn>
|
581
|
-
<mo>−</mo>
|
582
582
|
<mi>p</mi>
|
583
583
|
</mrow>
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
<
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
584
|
+
<mrow>
|
585
|
+
<mi>j</mi>
|
586
|
+
</mrow>
|
587
|
+
</msup>
|
588
|
+
<msup>
|
589
|
+
<mrow>
|
590
|
+
<mfenced open='(' close=')'>
|
591
|
+
<mrow>
|
592
|
+
<mn>0,0000032</mn>
|
593
|
+
<mo>−</mo>
|
594
|
+
<mi>p</mi>
|
595
|
+
</mrow>
|
596
|
+
</mfenced>
|
597
|
+
</mrow>
|
598
|
+
<mrow>
|
599
|
+
<mrow>
|
600
|
+
<mn>1,003</mn>
|
601
|
+
<mo>−</mo>
|
602
|
+
<mi>j</mi>
|
603
|
+
</mrow>
|
604
|
+
</mrow>
|
605
|
+
</msup>
|
606
|
+
</math>
|
607
|
+
</stem>
|
608
|
+
</p>
|
609
|
+
</preface>
|
610
|
+
</iso-standard>
|
611
|
+
OUTPUT
|
612
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
613
|
+
.convert("test", input, true))
|
614
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
615
|
+
.to be_equivalent_to xmlpp(output)
|
616
|
+
end
|
617
|
+
|
618
|
+
it "resolve address components" do
|
619
|
+
input = <<~INPUT
|
620
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
621
|
+
<bibdata>
|
622
|
+
<contributor>
|
623
|
+
<role type='author'/>
|
624
|
+
<person>
|
625
|
+
<name>
|
626
|
+
<completename>Fred Flintstone</completename>
|
627
|
+
</name>
|
628
|
+
<affiliation>
|
629
|
+
<organization>
|
630
|
+
<name>Slate Rock and Gravel Company</name>
|
631
|
+
<address>
|
632
|
+
<street>1 Infinity Loop</street>
|
633
|
+
<city>Cupertino</city>
|
634
|
+
<state>CA</state>
|
635
|
+
<country>USA</country>
|
636
|
+
<postcode>95014</postcode>
|
637
|
+
</address>
|
638
|
+
</organization>
|
639
|
+
</affiliation>
|
640
|
+
</person>
|
641
|
+
</contributor>
|
642
|
+
</bibdata>
|
643
|
+
</iso-standard>
|
644
|
+
INPUT
|
645
|
+
output = <<~OUTPUT
|
646
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
647
|
+
<bibdata>
|
648
|
+
<contributor>
|
649
|
+
<role type='author'/>
|
650
|
+
<person>
|
651
|
+
<name>
|
652
|
+
<completename>Fred Flintstone</completename>
|
653
|
+
</name>
|
654
|
+
<affiliation>
|
655
|
+
<organization>
|
656
|
+
<name>Slate Rock and Gravel Company</name>
|
657
|
+
<address>
|
658
|
+
<formattedAddress>
|
659
|
+
1 Infinity Loop
|
660
|
+
<br/>
|
661
|
+
Cupertino
|
662
|
+
<br/>
|
663
|
+
CA
|
664
|
+
<br/>
|
665
|
+
USA 95014
|
666
|
+
</formattedAddress>
|
667
|
+
</address>
|
668
|
+
</organization>
|
669
|
+
</affiliation>
|
670
|
+
</person>
|
671
|
+
</contributor>
|
672
|
+
</bibdata>
|
673
|
+
</iso-standard>
|
674
|
+
OUTPUT
|
675
|
+
expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
|
676
|
+
.convert("test", input, true))
|
677
|
+
.sub(%r{<localized-strings>.*</localized-strings>}m, ""))
|
678
|
+
.to be_equivalent_to xmlpp(output)
|
679
|
+
end
|
601
680
|
|
602
|
-
private
|
681
|
+
private
|
603
682
|
|
604
683
|
def mock_symbols
|
605
|
-
allow_any_instance_of(::IsoDoc::PresentationXMLConvert)
|
684
|
+
allow_any_instance_of(::IsoDoc::PresentationXMLConvert)
|
685
|
+
.to receive(:twitter_cldr_localiser_symbols).and_return(group: "'")
|
606
686
|
end
|
607
687
|
end
|