isodoc 1.5.1 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +1 -1
  3. data/.rubocop.yml +6 -2
  4. data/Gemfile +2 -2
  5. data/isodoc.gemspec +11 -11
  6. data/lib/isodoc/base_style/all.css +7 -0
  7. data/lib/isodoc/base_style/metanorma_word.css +7 -0
  8. data/lib/isodoc/base_style/metanorma_word.scss +8 -0
  9. data/lib/isodoc/base_style/reset.css +7 -0
  10. data/lib/isodoc/base_style/reset.scss +9 -0
  11. data/lib/isodoc/base_style/scripts.html +187 -0
  12. data/lib/isodoc/class_utils.rb +6 -5
  13. data/lib/isodoc/convert.rb +28 -15
  14. data/lib/isodoc/css.rb +14 -4
  15. data/lib/isodoc/function/blocks.rb +4 -0
  16. data/lib/isodoc/function/inline.rb +31 -10
  17. data/lib/isodoc/function/references.rb +1 -1
  18. data/lib/isodoc/function/to_word_html.rb +19 -8
  19. data/lib/isodoc/function/utils.rb +1 -0
  20. data/lib/isodoc/html_function/postprocess.rb +8 -5
  21. data/lib/isodoc/pdf_convert.rb +1 -3
  22. data/lib/isodoc/presentation_function/block.rb +11 -5
  23. data/lib/isodoc/presentation_function/inline.rb +42 -38
  24. data/lib/isodoc/presentation_function/section.rb +1 -1
  25. data/lib/isodoc/presentation_xml_convert.rb +1 -1
  26. data/lib/isodoc/version.rb +1 -1
  27. data/lib/isodoc/word_function/inline.rb +6 -0
  28. data/lib/isodoc/word_function/postprocess.rb +16 -6
  29. data/lib/isodoc/xref.rb +1 -1
  30. data/lib/isodoc/xref/xref_gen.rb +16 -15
  31. data/lib/isodoc/xslfo_convert.rb +36 -25
  32. data/spec/assets/html_override.css +1 -0
  33. data/spec/assets/word_override.css +1 -0
  34. data/spec/isodoc/blocks_spec.rb +87 -0
  35. data/spec/isodoc/footnotes_spec.rb +1 -16
  36. data/spec/isodoc/inline_spec.rb +38 -1
  37. data/spec/isodoc/postproc_spec.rb +42 -14
  38. data/spec/isodoc/presentation_xml_spec.rb +345 -338
  39. data/spec/isodoc/section_spec.rb +910 -902
  40. data/spec/isodoc/table_spec.rb +566 -556
  41. data/spec/isodoc/terms_spec.rb +252 -256
  42. data/spec/isodoc/xref_spec.rb +2990 -2987
  43. data/spec/isodoc/xslfo_convert_spec.rb +39 -0
  44. data/spec/spec_helper.rb +30 -29
  45. metadata +71 -69
  46. data/.rubocop.ribose.yml +0 -65
  47. data/.rubocop.tb.yml +0 -650
@@ -1,132 +1,137 @@
1
1
  require "spec_helper"
2
2
 
3
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"}).convert("test", <<~"INPUT", false)
7
- <iso-standard xmlns="http://riboseinc.com/isoxml">
8
- <bibdata>
9
- <title language="en">test</title>
10
- </bibdata>
11
- <preface><foreword>
12
- <note>
13
- <p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
14
- </note>
15
- </foreword></preface>
16
- </iso-standard>
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
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~INPUT, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(<<~OUTPUT)
23
- <iso-standard xmlns="http://riboseinc.com/isoxml">
24
- <bibdata>
25
- <title language="en">test</title>
26
- </bibdata>
27
- <preface>
28
- <p><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
29
- <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>
30
- </preface>
31
- </iso-standard>
32
- INPUT
33
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
34
- <bibdata>
35
- <title language='en'>test</title>
36
- </bibdata>
37
-
38
- <preface>
39
- <p>
40
- 30,000
41
- <stem type='MathML'>
42
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
43
- <mi>P</mi>
44
- <mfenced open='(' close=')'>
45
- <mrow>
46
- <mi>X</mi>
47
- <mo>&#x2265;</mo>
48
- <msub>
49
- <mrow>
50
- <mi>X</mi>
51
- </mrow>
52
- <mrow>
53
- <mo>max</mo>
54
- </mrow>
55
- </msub>
56
- </mrow>
57
- </mfenced>
58
- <mo>=</mo>
59
- <munderover>
60
- <mrow>
61
- <mo>&#x2211;</mo>
62
- </mrow>
63
- <mrow>
64
- <mrow>
65
- <mi>j</mi>
66
- <mo>=</mo>
67
- <msub>
68
- <mrow>
69
- <mi>X</mi>
70
- </mrow>
71
- <mrow>
72
- <mo>max</mo>
73
- </mrow>
74
- </msub>
75
- </mrow>
76
- </mrow>
77
- <mrow>
78
- <mn>1,000</mn>
79
- </mrow>
80
- </munderover>
81
- <mfenced open='(' close=')'>
82
- <mtable>
83
- <mtr>
84
- <mtd>
85
- <mn>1,000</mn>
86
- </mtd>
87
- </mtr>
88
- <mtr>
89
- <mtd>
90
- <mi>j</mi>
91
- </mtd>
92
- </mtr>
93
- </mtable>
94
- </mfenced>
95
- <msup>
96
- <mrow>
97
- <mi>p</mi>
98
- </mrow>
99
- <mrow>
100
- <mi>j</mi>
101
- </mrow>
102
- </msup>
103
- <msup>
104
- <mrow>
105
- <mfenced open='(' close=')'>
106
- <mrow>
107
- <mn>1</mn>
108
- <mo>&#x2212;</mo>
109
- <mi>p</mi>
110
- </mrow>
111
- </mfenced>
112
- </mrow>
113
- <mrow>
114
- <mrow>
115
- <mn>1.003</mn>
116
- <mo>&#x2212;</mo>
117
- <mi>j</mi>
118
- </mrow>
119
- </mrow>
120
- </msup>
121
- </math>
122
- </stem>
123
- </p>
124
- </preface>
125
- </iso-standard>
126
- OUTPUT
127
- end
22
+ it "localises numbers in MathML" do
23
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
24
+ .convert("test", <<~INPUT, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(<<~OUTPUT)
25
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
26
+ <bibdata>
27
+ <title language="en">test</title>
28
+ </bibdata>
29
+ <preface>
30
+ <p>
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
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
39
+ <bibdata>
40
+ <title language='en'>test</title>
41
+ </bibdata>
42
+ <preface>
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=')'>
50
+ <mrow>
51
+ <mi>X</mi>
52
+ <mo>&#x2265;</mo>
53
+ <msub>
54
+ <mrow>
55
+ <mi>X</mi>
56
+ </mrow>
57
+ <mrow>
58
+ <mo>max</mo>
59
+ </mrow>
60
+ </msub>
61
+ </mrow>
62
+ </mfenced>
63
+ <mo>=</mo>
64
+ <munderover>
65
+ <mrow>
66
+ <mo>&#x2211;</mo>
67
+ </mrow>
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>&#x2212;</mo>
114
+ <mi>p</mi>
115
+ </mrow>
116
+ </mfenced>
117
+ </mrow>
118
+ <mrow>
119
+ <mrow>
120
+ <mn>1.003</mn>
121
+ <mo>&#x2212;</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
+ end
128
133
 
129
- context 'when twitter_cldr_localiser_symbols has additional options' do
134
+ context "when twitter_cldr_localiser_symbols has additional options" do
130
135
  let(:input) do
131
136
  <<~INPUT
132
137
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -358,7 +363,7 @@ end
358
363
  {
359
364
  fraction_group_digits: 2,
360
365
  fraction_group: "'",
361
- precision: 5
366
+ precision: 5,
362
367
  }
363
368
  end
364
369
 
@@ -368,234 +373,236 @@ end
368
373
  end
369
374
 
370
375
  it "Supports twitter_cldr_localiser_symbols fraction options" do
371
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", input, true))
372
- .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
376
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
377
+ .convert("test", input, true))
378
+ .sub(%r{<localized-strings>.*</localized-strings>}m, ""))
373
379
  .to(be_equivalent_to(xmlpp(output)))
374
380
  end
375
381
  end
376
382
 
377
- it "localises numbers in MathML in French" do
378
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~INPUT, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(<<~OUTPUT)
379
- <iso-standard xmlns="http://riboseinc.com/isoxml">
380
- <bibdata>
381
- <title language="en">test</title>
382
- <language>fr</language>
383
- </bibdata>
384
- <preface>
385
- <p><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math>
386
- <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>
387
- </preface>
388
- </iso-standard>
389
- INPUT
390
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
391
- <bibdata>
392
- <title language='en'>test</title>
393
- <language current='true'>fr</language>
394
- </bibdata>
395
-
396
- <preface>
397
- <p>
398
- 30&#x202F;000
399
- <stem type='MathML'>
400
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
401
- <mi>P</mi>
402
- <mfenced open='(' close=')'>
403
- <mrow>
404
- <mi>X</mi>
405
- <mo>&#x2265;</mo>
406
- <msub>
407
- <mrow>
408
- <mi>X</mi>
409
- </mrow>
410
- <mrow>
411
- <mo>max</mo>
412
- </mrow>
413
- </msub>
414
- </mrow>
415
- </mfenced>
416
- <mo>=</mo>
417
- <munderover>
418
- <mrow>
419
- <mo>&#x2211;</mo>
420
- </mrow>
421
- <mrow>
422
- <mrow>
423
- <mi>j</mi>
424
- <mo>=</mo>
425
- <msub>
426
- <mrow>
427
- <mi>X</mi>
428
- </mrow>
429
- <mrow>
430
- <mo>max</mo>
431
- </mrow>
432
- </msub>
433
- </mrow>
434
- </mrow>
435
- <mrow>
436
- <mn>1&#x202F;000</mn>
437
- </mrow>
438
- </munderover>
439
- <mfenced open='(' close=')'>
440
- <mtable>
441
- <mtr>
442
- <mtd>
443
- <mn>1&#x202F;000</mn>
444
- </mtd>
445
- </mtr>
446
- <mtr>
447
- <mtd>
448
- <mi>j</mi>
449
- </mtd>
450
- </mtr>
451
- </mtable>
452
- </mfenced>
453
- <msup>
454
- <mrow>
455
- <mi>p</mi>
456
- </mrow>
457
- <mrow>
458
- <mi>j</mi>
459
- </mrow>
460
- </msup>
461
- <msup>
462
- <mrow>
463
- <mfenced open='(' close=')'>
464
- <mrow>
465
- <mn>1</mn>
466
- <mo>&#x2212;</mo>
467
- <mi>p</mi>
468
- </mrow>
469
- </mfenced>
470
- </mrow>
471
- <mrow>
472
- <mrow>
473
- <mn>1,003</mn>
474
- <mo>&#x2212;</mo>
475
- <mi>j</mi>
476
- </mrow>
477
- </mrow>
478
- </msup>
479
- </math>
480
- </stem>
481
- </p>
482
- </preface>
483
- </iso-standard>
484
- OUTPUT
485
- end
383
+ it "localises numbers in MathML in French" do
384
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
385
+ .convert("test", <<~INPUT, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(<<~OUTPUT)
386
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
387
+ <bibdata>
388
+ <title language="en">test</title>
389
+ <language>fr</language>
390
+ </bibdata>
391
+ <preface>
392
+ <p><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math>
393
+ <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>
394
+ </preface>
395
+ </iso-standard>
396
+ INPUT
397
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
398
+ <bibdata>
399
+ <title language='en'>test</title>
400
+ <language current='true'>fr</language>
401
+ </bibdata>
402
+ <preface>
403
+ <p>
404
+ 30&#x202F;000
405
+ <stem type='MathML'>
406
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
407
+ <mi>P</mi>
408
+ <mfenced open='(' close=')'>
409
+ <mrow>
410
+ <mi>X</mi>
411
+ <mo>&#x2265;</mo>
412
+ <msub>
413
+ <mrow>
414
+ <mi>X</mi>
415
+ </mrow>
416
+ <mrow>
417
+ <mo>max</mo>
418
+ </mrow>
419
+ </msub>
420
+ </mrow>
421
+ </mfenced>
422
+ <mo>=</mo>
423
+ <munderover>
424
+ <mrow>
425
+ <mo>&#x2211;</mo>
426
+ </mrow>
427
+ <mrow>
428
+ <mrow>
429
+ <mi>j</mi>
430
+ <mo>=</mo>
431
+ <msub>
432
+ <mrow>
433
+ <mi>X</mi>
434
+ </mrow>
435
+ <mrow>
436
+ <mo>max</mo>
437
+ </mrow>
438
+ </msub>
439
+ </mrow>
440
+ </mrow>
441
+ <mrow>
442
+ <mn>1&#x202F;000</mn>
443
+ </mrow>
444
+ </munderover>
445
+ <mfenced open='(' close=')'>
446
+ <mtable>
447
+ <mtr>
448
+ <mtd>
449
+ <mn>1&#x202F;000</mn>
450
+ </mtd>
451
+ </mtr>
452
+ <mtr>
453
+ <mtd>
454
+ <mi>j</mi>
455
+ </mtd>
456
+ </mtr>
457
+ </mtable>
458
+ </mfenced>
459
+ <msup>
460
+ <mrow>
461
+ <mi>p</mi>
462
+ </mrow>
463
+ <mrow>
464
+ <mi>j</mi>
465
+ </mrow>
466
+ </msup>
467
+ <msup>
468
+ <mrow>
469
+ <mfenced open='(' close=')'>
470
+ <mrow>
471
+ <mn>1</mn>
472
+ <mo>&#x2212;</mo>
473
+ <mi>p</mi>
474
+ </mrow>
475
+ </mfenced>
476
+ </mrow>
477
+ <mrow>
478
+ <mrow>
479
+ <mn>1,003</mn>
480
+ <mo>&#x2212;</mo>
481
+ <mi>j</mi>
482
+ </mrow>
483
+ </mrow>
484
+ </msup>
485
+ </math>
486
+ </stem>
487
+ </p>
488
+ </preface>
489
+ </iso-standard>
490
+ OUTPUT
491
+ end
486
492
 
487
- it "customises localisation of numbers" do
488
- mock_symbols
489
- expect(xmlpp(IsoDoc::PresentationXMLConvert.new({}).convert("test", <<~INPUT, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(<<~OUTPUT)
490
- <iso-standard xmlns="http://riboseinc.com/isoxml">
491
- <bibdata>
492
- <title language="en">test</title>
493
- <language>fr</language>
494
- </bibdata>
495
- <preface>
496
- <p><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
497
- <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>
498
- </preface>
499
- </iso-standard>
500
- INPUT
501
- <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
502
- <bibdata>
503
- <title language='en'>test</title>
504
- <language current='true'>fr</language>
505
- </bibdata>
493
+ it "customises localisation of numbers" do
494
+ mock_symbols
495
+ expect(xmlpp(IsoDoc::PresentationXMLConvert.new({})
496
+ .convert("test", <<~INPUT, true)).sub(%r{<localized-strings>.*</localized-strings>}m, "")).to be_equivalent_to xmlpp(<<~OUTPUT)
497
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
498
+ <bibdata>
499
+ <title language="en">test</title>
500
+ <language>fr</language>
501
+ </bibdata>
502
+ <preface>
503
+ <p><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
504
+ <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>
505
+ </preface>
506
+ </iso-standard>
507
+ INPUT
508
+ <iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
509
+ <bibdata>
510
+ <title language='en'>test</title>
511
+ <language current='true'>fr</language>
512
+ </bibdata>
506
513
 
507
- <preface>
508
- <p>
509
- 30'000
510
- <stem type='MathML'>
511
- <math xmlns='http://www.w3.org/1998/Math/MathML'>
512
- <mi>P</mi>
513
- <mfenced open='(' close=')'>
514
- <mrow>
515
- <mi>X</mi>
516
- <mo>&#x2265;</mo>
517
- <msub>
518
- <mrow>
519
- <mi>X</mi>
520
- </mrow>
521
- <mrow>
522
- <mo>max</mo>
523
- </mrow>
524
- </msub>
525
- </mrow>
526
- </mfenced>
527
- <mo>=</mo>
528
- <munderover>
529
- <mrow>
530
- <mo>&#x2211;</mo>
531
- </mrow>
532
- <mrow>
533
- <mrow>
534
- <mi>j</mi>
535
- <mo>=</mo>
536
- <msub>
514
+ <preface>
515
+ <p>
516
+ 30'000
517
+ <stem type='MathML'>
518
+ <math xmlns='http://www.w3.org/1998/Math/MathML'>
519
+ <mi>P</mi>
520
+ <mfenced open='(' close=')'>
537
521
  <mrow>
538
522
  <mi>X</mi>
523
+ <mo>&#x2265;</mo>
524
+ <msub>
525
+ <mrow>
526
+ <mi>X</mi>
527
+ </mrow>
528
+ <mrow>
529
+ <mo>max</mo>
530
+ </mrow>
531
+ </msub>
532
+ </mrow>
533
+ </mfenced>
534
+ <mo>=</mo>
535
+ <munderover>
536
+ <mrow>
537
+ <mo>&#x2211;</mo>
539
538
  </mrow>
540
539
  <mrow>
541
- <mo>max</mo>
540
+ <mrow>
541
+ <mi>j</mi>
542
+ <mo>=</mo>
543
+ <msub>
544
+ <mrow>
545
+ <mi>X</mi>
546
+ </mrow>
547
+ <mrow>
548
+ <mo>max</mo>
549
+ </mrow>
550
+ </msub>
551
+ </mrow>
542
552
  </mrow>
543
- </msub>
544
- </mrow>
545
- </mrow>
546
- <mrow>
547
- <mn>1'000</mn>
548
- </mrow>
549
- </munderover>
550
- <mfenced open='(' close=')'>
551
- <mtable>
552
- <mtr>
553
- <mtd>
554
- <mn>1'000</mn>
555
- </mtd>
556
- </mtr>
557
- <mtr>
558
- <mtd>
559
- <mi>j</mi>
560
- </mtd>
561
- </mtr>
562
- </mtable>
563
- </mfenced>
564
- <msup>
565
- <mrow>
566
- <mi>p</mi>
567
- </mrow>
568
- <mrow>
569
- <mi>j</mi>
570
- </mrow>
571
- </msup>
572
- <msup>
573
- <mrow>
574
- <mfenced open='(' close=')'>
575
- <mrow>
576
- <mn>0,0000032</mn>
577
- <mo>&#x2212;</mo>
578
- <mi>p</mi>
579
- </mrow>
580
- </mfenced>
581
- </mrow>
582
- <mrow>
583
- <mrow>
584
- <mn>1,003</mn>
585
- <mo>&#x2212;</mo>
586
- <mi>j</mi>
587
- </mrow>
588
- </mrow>
589
- </msup>
590
- </math>
591
- </stem>
592
- </p>
593
- </preface>
594
- </iso-standard>
595
- OUTPUT
596
- end
553
+ <mrow>
554
+ <mn>1'000</mn>
555
+ </mrow>
556
+ </munderover>
557
+ <mfenced open='(' close=')'>
558
+ <mtable>
559
+ <mtr>
560
+ <mtd>
561
+ <mn>1'000</mn>
562
+ </mtd>
563
+ </mtr>
564
+ <mtr>
565
+ <mtd>
566
+ <mi>j</mi>
567
+ </mtd>
568
+ </mtr>
569
+ </mtable>
570
+ </mfenced>
571
+ <msup>
572
+ <mrow>
573
+ <mi>p</mi>
574
+ </mrow>
575
+ <mrow>
576
+ <mi>j</mi>
577
+ </mrow>
578
+ </msup>
579
+ <msup>
580
+ <mrow>
581
+ <mfenced open='(' close=')'>
582
+ <mrow>
583
+ <mn>0,0000032</mn>
584
+ <mo>&#x2212;</mo>
585
+ <mi>p</mi>
586
+ </mrow>
587
+ </mfenced>
588
+ </mrow>
589
+ <mrow>
590
+ <mrow>
591
+ <mn>1,003</mn>
592
+ <mo>&#x2212;</mo>
593
+ <mi>j</mi>
594
+ </mrow>
595
+ </mrow>
596
+ </msup>
597
+ </math>
598
+ </stem>
599
+ </p>
600
+ </preface>
601
+ </iso-standard>
602
+ OUTPUT
603
+ end
597
604
 
598
- private
605
+ private
599
606
 
600
607
  def mock_symbols
601
608
  allow_any_instance_of(::IsoDoc::PresentationXMLConvert).to receive(:twitter_cldr_localiser_symbols).and_return(group: "'")