isodoc 1.2.6 → 1.4.0
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 +69 -0
- data/README.adoc +1 -3
- data/isodoc.gemspec +2 -1
- data/lib/isodoc-yaml/i18n-en.yaml +56 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +64 -7
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc/base_style/all.css +4 -0
- data/lib/isodoc/base_style/blocks.scss +2 -2
- data/lib/isodoc/base_style/reset.css +4 -0
- data/lib/isodoc/base_style/reset.scss +5 -0
- data/lib/isodoc/base_style/typography.scss +1 -1
- data/lib/isodoc/convert.rb +13 -98
- data/lib/isodoc/css.rb +95 -0
- data/lib/isodoc/function/inline.rb +0 -33
- data/lib/isodoc/function/inline_simple.rb +4 -1
- data/lib/isodoc/function/lists.rb +2 -1
- data/lib/isodoc/function/references.rb +8 -13
- data/lib/isodoc/function/section.rb +1 -1
- data/lib/isodoc/function/table.rb +10 -0
- data/lib/isodoc/function/to_word_html.rb +2 -2
- data/lib/isodoc/gem_tasks.rb +4 -0
- data/lib/isodoc/html_function/html.rb +1 -0
- data/lib/isodoc/html_function/mathvariant_to_plain.rb +82 -0
- data/lib/isodoc/html_function/postprocess.rb +41 -20
- data/lib/isodoc/i18n.rb +15 -2
- data/lib/isodoc/metadata.rb +28 -109
- data/lib/isodoc/metadata_contributor.rb +91 -0
- data/lib/isodoc/metadata_date.rb +6 -0
- data/lib/isodoc/presentation_function/bibdata.rb +79 -7
- data/lib/isodoc/presentation_function/block.rb +14 -9
- data/lib/isodoc/presentation_function/inline.rb +126 -22
- data/lib/isodoc/presentation_function/section.rb +9 -0
- data/lib/isodoc/presentation_xml_convert.rb +5 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_convert.rb +0 -20
- data/lib/isodoc/word_function/body.rb +12 -0
- data/lib/isodoc/word_function/postprocess.rb +38 -80
- data/lib/isodoc/word_function/postprocess_cover.rb +55 -0
- data/lib/isodoc/word_function/table.rb +10 -0
- data/lib/isodoc/xref.rb +1 -0
- data/lib/isodoc/xref/xref_counter.rb +20 -9
- data/lib/isodoc/xref/xref_gen.rb +20 -2
- data/lib/isodoc/xref/xref_sect_gen.rb +1 -1
- data/spec/assets/html.scss +14 -0
- data/spec/assets/i18n.yaml +17 -9
- data/spec/isodoc/blocks_spec.rb +89 -241
- data/spec/isodoc/cleanup_spec.rb +0 -1
- data/spec/isodoc/footnotes_spec.rb +4 -5
- data/spec/isodoc/i18n_spec.rb +73 -38
- data/spec/isodoc/inline_spec.rb +177 -199
- data/spec/isodoc/lists_spec.rb +1 -1
- data/spec/isodoc/metadata_spec.rb +50 -7
- data/spec/isodoc/postproc_spec.rb +472 -11
- data/spec/isodoc/presentation_xml_spec.rb +584 -1
- data/spec/isodoc/ref_spec.rb +327 -12
- data/spec/isodoc/table_spec.rb +28 -0
- data/spec/isodoc/xref_spec.rb +162 -17
- data/spec/spec_helper.rb +2 -0
- metadata +22 -7
- data/.github/workflows/macos.yml +0 -42
- data/.github/workflows/ubuntu.yml +0 -62
- data/.github/workflows/windows.yml +0 -44
@@ -1,5 +1,5 @@
|
|
1
1
|
require "spec_helper"
|
2
|
-
|
2
|
+
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "generates file based on string input" do
|
5
5
|
FileUtils.rm_f "test.presentation.xml"
|
@@ -17,4 +17,587 @@ it "generates file based on string input" do
|
|
17
17
|
INPUT
|
18
18
|
expect(File.exist?("test.presentation.xml")).to be true
|
19
19
|
end
|
20
|
+
|
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
|
+
<stem type='MathML'>30,000</stem>
|
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>≥</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>∑</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>−</mo>
|
109
|
+
<mi>p</mi>
|
110
|
+
</mrow>
|
111
|
+
</mfenced>
|
112
|
+
</mrow>
|
113
|
+
<mrow>
|
114
|
+
<mrow>
|
115
|
+
<mn>1.003</mn>
|
116
|
+
<mo>−</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
|
128
|
+
|
129
|
+
context 'when twitter_cldr_localiser_symbols has additional options' do
|
130
|
+
let(:input) do
|
131
|
+
<<~INPUT
|
132
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
133
|
+
<bibdata>
|
134
|
+
<title language="en">test</title>
|
135
|
+
</bibdata>
|
136
|
+
<preface>
|
137
|
+
<p>
|
138
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
|
139
|
+
<stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML">
|
140
|
+
<mi>P</mi>
|
141
|
+
<mfenced open="(" close=")">
|
142
|
+
<mrow>
|
143
|
+
<mi>X</mi>
|
144
|
+
<mo>≥</mo>
|
145
|
+
<msub>
|
146
|
+
<mrow>
|
147
|
+
<mi>X</mi>
|
148
|
+
</mrow>
|
149
|
+
<mrow>
|
150
|
+
<mo>max</mo>
|
151
|
+
</mrow>
|
152
|
+
</msub>
|
153
|
+
</mrow>
|
154
|
+
</mfenced>
|
155
|
+
<mo>=</mo>
|
156
|
+
<munderover>
|
157
|
+
<mrow>
|
158
|
+
<mo>∑</mo>
|
159
|
+
</mrow>
|
160
|
+
<mrow>
|
161
|
+
<mrow>
|
162
|
+
<mi>j</mi>
|
163
|
+
<mo>=</mo>
|
164
|
+
<msub>
|
165
|
+
<mrow>
|
166
|
+
<mi>X</mi>
|
167
|
+
</mrow>
|
168
|
+
<mrow>
|
169
|
+
<mo>max</mo>
|
170
|
+
</mrow>
|
171
|
+
</msub>
|
172
|
+
</mrow>
|
173
|
+
</mrow>
|
174
|
+
<mrow>
|
175
|
+
<mn>1000</mn>
|
176
|
+
</mrow>
|
177
|
+
</munderover>
|
178
|
+
<mfenced open="(" close=")">
|
179
|
+
<mtable>
|
180
|
+
<mtr>
|
181
|
+
<mtd>
|
182
|
+
<mn>1000</mn>
|
183
|
+
</mtd>
|
184
|
+
</mtr>
|
185
|
+
<mtr>
|
186
|
+
<mtd>
|
187
|
+
<mi>j</mi>
|
188
|
+
</mtd>
|
189
|
+
</mtr>
|
190
|
+
</mtable>
|
191
|
+
</mfenced>
|
192
|
+
<msup>
|
193
|
+
<mrow>
|
194
|
+
<mi>p</mi>
|
195
|
+
</mrow>
|
196
|
+
<mrow>
|
197
|
+
<mi>j</mi>
|
198
|
+
</mrow>
|
199
|
+
</msup>
|
200
|
+
<msup>
|
201
|
+
<mrow>
|
202
|
+
<mfenced open="(" close=")">
|
203
|
+
<mrow>
|
204
|
+
<mn>1</mn>
|
205
|
+
<mo>−</mo>
|
206
|
+
<mi>p</mi>
|
207
|
+
</mrow>
|
208
|
+
</mfenced>
|
209
|
+
</mrow>
|
210
|
+
<mrow>
|
211
|
+
<mrow>
|
212
|
+
<mn>1.003</mn>
|
213
|
+
<mo>−</mo>
|
214
|
+
<mi>j</mi>
|
215
|
+
</mrow>
|
216
|
+
</mrow>
|
217
|
+
</msup>
|
218
|
+
<msup>
|
219
|
+
<mrow>
|
220
|
+
<mfenced open="(" close=")">
|
221
|
+
<mrow>
|
222
|
+
<mn>1</mn>
|
223
|
+
<mo>−</mo>
|
224
|
+
<mi>p</mi>
|
225
|
+
</mrow>
|
226
|
+
</mfenced>
|
227
|
+
</mrow>
|
228
|
+
<mrow>
|
229
|
+
<mrow>
|
230
|
+
<mn>459384.123456789</mn>
|
231
|
+
<mo>−</mo>
|
232
|
+
<mi>j</mi>
|
233
|
+
</mrow>
|
234
|
+
</mrow>
|
235
|
+
</msup>
|
236
|
+
</math></stem>
|
237
|
+
</p>
|
238
|
+
</preface>
|
239
|
+
</iso-standard>
|
240
|
+
INPUT
|
241
|
+
end
|
242
|
+
let(:output) do
|
243
|
+
<<~OUTPUT
|
244
|
+
<iso-standard xmlns='http://riboseinc.com/isoxml' type='presentation'>
|
245
|
+
<bibdata>
|
246
|
+
<title language='en'>test</title>
|
247
|
+
</bibdata>
|
248
|
+
|
249
|
+
<preface>
|
250
|
+
<p>
|
251
|
+
<stem type='MathML'>30,000</stem>
|
252
|
+
<stem type='MathML'>
|
253
|
+
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
254
|
+
<mi>P</mi>
|
255
|
+
<mfenced open='(' close=')'>
|
256
|
+
<mrow>
|
257
|
+
<mi>X</mi>
|
258
|
+
<mo>≥</mo>
|
259
|
+
<msub>
|
260
|
+
<mrow>
|
261
|
+
<mi>X</mi>
|
262
|
+
</mrow>
|
263
|
+
<mrow>
|
264
|
+
<mo>max</mo>
|
265
|
+
</mrow>
|
266
|
+
</msub>
|
267
|
+
</mrow>
|
268
|
+
</mfenced>
|
269
|
+
<mo>=</mo>
|
270
|
+
<munderover>
|
271
|
+
<mrow>
|
272
|
+
<mo>∑</mo>
|
273
|
+
</mrow>
|
274
|
+
<mrow>
|
275
|
+
<mrow>
|
276
|
+
<mi>j</mi>
|
277
|
+
<mo>=</mo>
|
278
|
+
<msub>
|
279
|
+
<mrow>
|
280
|
+
<mi>X</mi>
|
281
|
+
</mrow>
|
282
|
+
<mrow>
|
283
|
+
<mo>max</mo>
|
284
|
+
</mrow>
|
285
|
+
</msub>
|
286
|
+
</mrow>
|
287
|
+
</mrow>
|
288
|
+
<mrow>
|
289
|
+
<mn>1,000</mn>
|
290
|
+
</mrow>
|
291
|
+
</munderover>
|
292
|
+
<mfenced open='(' close=')'>
|
293
|
+
<mtable>
|
294
|
+
<mtr>
|
295
|
+
<mtd>
|
296
|
+
<mn>1,000</mn>
|
297
|
+
</mtd>
|
298
|
+
</mtr>
|
299
|
+
<mtr>
|
300
|
+
<mtd>
|
301
|
+
<mi>j</mi>
|
302
|
+
</mtd>
|
303
|
+
</mtr>
|
304
|
+
</mtable>
|
305
|
+
</mfenced>
|
306
|
+
<msup>
|
307
|
+
<mrow>
|
308
|
+
<mi>p</mi>
|
309
|
+
</mrow>
|
310
|
+
<mrow>
|
311
|
+
<mi>j</mi>
|
312
|
+
</mrow>
|
313
|
+
</msup>
|
314
|
+
<msup>
|
315
|
+
<mrow>
|
316
|
+
<mfenced open='(' close=')'>
|
317
|
+
<mrow>
|
318
|
+
<mn>1</mn>
|
319
|
+
<mo>−</mo>
|
320
|
+
<mi>p</mi>
|
321
|
+
</mrow>
|
322
|
+
</mfenced>
|
323
|
+
</mrow>
|
324
|
+
<mrow>
|
325
|
+
<mrow>
|
326
|
+
<mn>1.00'3</mn>
|
327
|
+
<mo>−</mo>
|
328
|
+
<mi>j</mi>
|
329
|
+
</mrow>
|
330
|
+
</mrow>
|
331
|
+
</msup>
|
332
|
+
<msup>
|
333
|
+
<mrow>
|
334
|
+
<mfenced open='(' close=')'>
|
335
|
+
<mrow>
|
336
|
+
<mn>1</mn>
|
337
|
+
<mo>−</mo>
|
338
|
+
<mi>p</mi>
|
339
|
+
</mrow>
|
340
|
+
</mfenced>
|
341
|
+
</mrow>
|
342
|
+
<mrow>
|
343
|
+
<mrow>
|
344
|
+
<mn>459,384.12'34'56</mn>
|
345
|
+
<mo>−</mo>
|
346
|
+
<mi>j</mi>
|
347
|
+
</mrow>
|
348
|
+
</mrow>
|
349
|
+
</msup>
|
350
|
+
</math>
|
351
|
+
</stem>
|
352
|
+
</p>
|
353
|
+
</preface>
|
354
|
+
</iso-standard>
|
355
|
+
OUTPUT
|
356
|
+
end
|
357
|
+
let(:additional_symbols) do
|
358
|
+
{
|
359
|
+
fraction_group_digits: 2,
|
360
|
+
fraction_group: "'",
|
361
|
+
precision: 5
|
362
|
+
}
|
363
|
+
end
|
364
|
+
|
365
|
+
before do
|
366
|
+
allow_any_instance_of(IsoDoc::PresentationXMLConvert)
|
367
|
+
.to(receive(:twitter_cldr_localiser_symbols).and_return(additional_symbols))
|
368
|
+
end
|
369
|
+
|
370
|
+
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, ""))
|
373
|
+
.to(be_equivalent_to(xmlpp(output)))
|
374
|
+
end
|
375
|
+
end
|
376
|
+
|
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><stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mn>30000</mn></math></stem>
|
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
|
+
<stem type='MathML'>30 000</stem>
|
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>≥</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>∑</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 000</mn>
|
437
|
+
</mrow>
|
438
|
+
</munderover>
|
439
|
+
<mfenced open='(' close=')'>
|
440
|
+
<mtable>
|
441
|
+
<mtr>
|
442
|
+
<mtd>
|
443
|
+
<mn>1 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>−</mo>
|
467
|
+
<mi>p</mi>
|
468
|
+
</mrow>
|
469
|
+
</mfenced>
|
470
|
+
</mrow>
|
471
|
+
<mrow>
|
472
|
+
<mrow>
|
473
|
+
<mn>1,003</mn>
|
474
|
+
<mo>−</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
|
486
|
+
|
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>
|
506
|
+
|
507
|
+
<preface>
|
508
|
+
<p>
|
509
|
+
<stem type='MathML'>30'000</stem>
|
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>≥</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>∑</mo>
|
531
|
+
</mrow>
|
532
|
+
<mrow>
|
533
|
+
<mrow>
|
534
|
+
<mi>j</mi>
|
535
|
+
<mo>=</mo>
|
536
|
+
<msub>
|
537
|
+
<mrow>
|
538
|
+
<mi>X</mi>
|
539
|
+
</mrow>
|
540
|
+
<mrow>
|
541
|
+
<mo>max</mo>
|
542
|
+
</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>−</mo>
|
578
|
+
<mi>p</mi>
|
579
|
+
</mrow>
|
580
|
+
</mfenced>
|
581
|
+
</mrow>
|
582
|
+
<mrow>
|
583
|
+
<mrow>
|
584
|
+
<mn>1,003</mn>
|
585
|
+
<mo>−</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
|
597
|
+
|
598
|
+
private
|
599
|
+
|
600
|
+
def mock_symbols
|
601
|
+
allow_any_instance_of(::IsoDoc::PresentationXMLConvert).to receive(:twitter_cldr_localiser_symbols).and_return(group: "'")
|
602
|
+
end
|
20
603
|
end
|