isodoc 1.2.3 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/rake.yml +69 -0
- data/README.adoc +1 -3
- data/isodoc.gemspec +3 -1
- data/lib/isodoc-yaml/i18n-en.yaml +1 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +9 -8
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc/base_style/all.css +5 -1
- data/lib/isodoc/base_style/metanorma_word.css +6 -0
- data/lib/isodoc/base_style/metanorma_word.scss +6 -0
- data/lib/isodoc/base_style/reset.css +5 -1
- data/lib/isodoc/base_style/reset.scss +6 -1
- data/lib/isodoc/convert.rb +1 -14
- data/lib/isodoc/function/blocks.rb +1 -0
- data/lib/isodoc/function/inline.rb +0 -33
- data/lib/isodoc/function/references.rb +5 -3
- data/lib/isodoc/function/table.rb +1 -0
- data/lib/isodoc/function/to_word_html.rb +3 -2
- data/lib/isodoc/function/utils.rb +1 -1
- data/lib/isodoc/html_function/postprocess.rb +1 -0
- data/lib/isodoc/i18n.rb +23 -52
- data/lib/isodoc/metadata.rb +44 -111
- data/lib/isodoc/metadata_contributor.rb +90 -0
- data/lib/isodoc/metadata_date.rb +11 -0
- data/lib/isodoc/presentation_function/bibdata.rb +96 -0
- data/lib/isodoc/presentation_function/block.rb +28 -9
- data/lib/isodoc/presentation_function/inline.rb +149 -34
- data/lib/isodoc/presentation_xml_convert.rb +7 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/body.rb +12 -0
- data/lib/isodoc/word_function/postprocess.rb +2 -2
- data/lib/isodoc/word_function/table.rb +3 -2
- data/lib/isodoc/xref.rb +1 -0
- data/lib/isodoc/xref/xref_anchor.rb +8 -3
- data/lib/isodoc/xref/xref_counter.rb +21 -7
- data/lib/isodoc/xref/xref_gen.rb +29 -6
- data/lib/isodoc/xref/xref_sect_gen.rb +1 -1
- data/lib/isodoc/xslfo_convert.rb +6 -1
- data/spec/assets/i18n.yaml +22 -5
- data/spec/isodoc/blocks_spec.rb +331 -215
- data/spec/isodoc/footnotes_spec.rb +4 -5
- data/spec/isodoc/i18n_spec.rb +89 -16
- data/spec/isodoc/inline_spec.rb +185 -163
- data/spec/isodoc/metadata_spec.rb +69 -19
- data/spec/isodoc/postproc_spec.rb +40 -3
- data/spec/isodoc/presentation_xml_spec.rb +584 -1
- data/spec/isodoc/ref_spec.rb +5 -5
- data/spec/isodoc/section_spec.rb +9 -9
- data/spec/isodoc/table_spec.rb +306 -207
- data/spec/isodoc/terms_spec.rb +1 -1
- data/spec/isodoc/xref_spec.rb +46 -18
- data/spec/spec_helper.rb +6 -0
- metadata +35 -7
- data/.github/workflows/macos.yml +0 -42
- data/.github/workflows/ubuntu.yml +0 -62
- data/.github/workflows/windows.yml +0 -44
@@ -7,7 +7,7 @@ RSpec.describe IsoDoc do
|
|
7
7
|
arr = c.convert_init(<<~"INPUT", "test", false)
|
8
8
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
9
9
|
INPUT
|
10
|
-
expect(
|
10
|
+
expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
|
11
11
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
12
12
|
<bibdata type="standard">
|
13
13
|
<title>The Incredible Mr Ripley</title>
|
@@ -18,6 +18,8 @@ RSpec.describe IsoDoc do
|
|
18
18
|
<uri type="pdf">URL D</uri>
|
19
19
|
<uri type="doc">URL E</uri>
|
20
20
|
<docidentifier>17301-1</docidentifier>
|
21
|
+
<docidentifier type="ISBN">ISBN 13</docidentifier>
|
22
|
+
<docidentifier type="ISBN10">ISBN 10</docidentifier>
|
21
23
|
<docnumber>17301</docnumber>
|
22
24
|
<date type="published"><on>2011</on></date>
|
23
25
|
<date type="accessed"><on>2012</on></date>
|
@@ -73,6 +75,9 @@ RSpec.describe IsoDoc do
|
|
73
75
|
</name>
|
74
76
|
</person>
|
75
77
|
</contributor>
|
78
|
+
<note type="title-footnote"><p>A footnote</p></note>
|
79
|
+
<note type="iso"><p>A note</p></note>
|
80
|
+
<note type="title-footnote"><p>Another footnote</p></note>
|
76
81
|
<language>en</language>
|
77
82
|
<script>Latn</script>
|
78
83
|
<status>
|
@@ -111,25 +116,32 @@ INPUT
|
|
111
116
|
:docnumeric=>"17301",
|
112
117
|
:doctitle=>"Cereals and pulses",
|
113
118
|
:doctype=>"International Standard",
|
119
|
+
:doctype_display=>"International Standard",
|
114
120
|
:docyear=>"2016",
|
115
121
|
:draft=>"0.4",
|
116
122
|
:draftinfo=>" (draft 0.4, 2016-05-01)",
|
117
123
|
:edition=>"2",
|
118
124
|
:html=>"URL B",
|
119
125
|
:implementeddate=>"XXX",
|
126
|
+
:isbn=>"ISBN 13",
|
127
|
+
:isbn10=>"ISBN 10",
|
120
128
|
:issueddate=>"XXX",
|
121
129
|
:iteration=>"2",
|
122
130
|
:keywords=>["KW2", "KW1", "KW3"],
|
131
|
+
:lang=>"en",
|
123
132
|
:obsoleteddate=>"2014",
|
124
133
|
:pdf=>"URL D",
|
125
134
|
:publisheddate=>"2011",
|
126
|
-
:publisher=>"",
|
127
135
|
:receiveddate=>"XXX",
|
128
136
|
:revdate=>"2016-05-01",
|
129
137
|
:revdate_monthyear=>"May 2016",
|
130
|
-
:
|
138
|
+
:script=>"Latn",
|
139
|
+
:stage=>"Committee Draft",
|
140
|
+
:stage_display=>"Committee Draft",
|
131
141
|
:stageabbr=>"CD",
|
132
142
|
:substage=>"Withdrawn",
|
143
|
+
:substage_display=>"Withdrawn",
|
144
|
+
:title_footnote=>["A footnote", "Another footnote"],
|
133
145
|
:transmitteddate=>"2020",
|
134
146
|
:unchangeddate=>"2019",
|
135
147
|
:unpublished=>true,
|
@@ -146,7 +158,7 @@ OUTPUT
|
|
146
158
|
arr = c.convert_init(<<~"INPUT", "test", false)
|
147
159
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
148
160
|
INPUT
|
149
|
-
expect(
|
161
|
+
expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
|
150
162
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
151
163
|
<bibdata type="standard">
|
152
164
|
<title language="fr" format="text/plain">Céréales et légumineuses</ti>
|
@@ -167,7 +179,15 @@ OUTPUT
|
|
167
179
|
<role type="publisher"/>
|
168
180
|
<organization>
|
169
181
|
<name>International Organization for Standardization</name>
|
182
|
+
<subdivision>Subdivision</subdivision>
|
170
183
|
<abbreviation>ISO</abbreviation>
|
184
|
+
<address>
|
185
|
+
<formattedAddress>1 Infinity Loop + California</formattedAddress>
|
186
|
+
</address>
|
187
|
+
<phone>3333333</phone>
|
188
|
+
<phone type='fax'>4444444</phone>
|
189
|
+
<email>x@example.com</email>
|
190
|
+
<uri>http://www.example.com</uri>
|
171
191
|
</organization>
|
172
192
|
</contributor>
|
173
193
|
<contributor>
|
@@ -213,8 +233,6 @@ OUTPUT
|
|
213
233
|
INPUT
|
214
234
|
{:accesseddate=>"XXX",
|
215
235
|
:agency=>"ISO/IEC/IEEE",
|
216
|
-
:authors=>[],
|
217
|
-
:authors_affiliations=>{},
|
218
236
|
:circulateddate=>"XXX",
|
219
237
|
:confirmeddate=>"XXX",
|
220
238
|
:copieddate=>"XXX",
|
@@ -223,23 +241,31 @@ INPUT
|
|
223
241
|
:docnumeric=>"17301",
|
224
242
|
:doctitle=>"Cereals and pulses",
|
225
243
|
:doctype=>"International Standard",
|
244
|
+
:doctype_display=>"International Standard",
|
226
245
|
:docyear=>"2016",
|
227
246
|
:draft=>"12",
|
228
247
|
:draftinfo=>" (draft 12, 2016-05)",
|
229
|
-
:edition=>nil,
|
230
248
|
:implementeddate=>"XXX",
|
231
249
|
:issueddate=>"XXX",
|
232
|
-
:
|
250
|
+
:lang=>"en",
|
233
251
|
:obsoleteddate=>"XXX",
|
234
252
|
:obsoletes=>"IEC 8121",
|
235
253
|
:obsoletes_part=>"3.1",
|
236
254
|
:partof=>"IEC 8122",
|
255
|
+
:pub_address=>"1 Infinity Loop + California",
|
256
|
+
:pub_email=>"x@example.com",
|
257
|
+
:pub_fax=>"4444444",
|
258
|
+
:pub_phone=>"3333333",
|
259
|
+
:pub_uri=>"http://www.example.com",
|
237
260
|
:publisheddate=>"2011-01",
|
238
261
|
:publisher=>"International Organization for Standardization, International Electrotechnical Commission and Institute of Electrical and Electronics Engineers",
|
239
262
|
:receiveddate=>"XXX",
|
240
263
|
:revdate=>"2016-05",
|
241
264
|
:revdate_monthyear=>"May 2016",
|
265
|
+
:script=>"Latn",
|
242
266
|
:stage=>"Published",
|
267
|
+
:stage_display=>"Published",
|
268
|
+
:subdivision=>"Subdivision",
|
243
269
|
:transmitteddate=>"XXX",
|
244
270
|
:unchangeddate=>"XXX",
|
245
271
|
:unpublished=>false,
|
@@ -256,10 +282,21 @@ OUTPUT
|
|
256
282
|
<bibdata type="standard">
|
257
283
|
<language>fr</language>
|
258
284
|
<script>Latn</script>
|
285
|
+
<status>
|
286
|
+
<stage lang="">Committee Draft</stage>
|
287
|
+
<stage lang=fr">Projet de comité</stage>
|
288
|
+
<substage lang="">Withdrawn</substage>
|
289
|
+
<substage lang="fr">Rétiré</substage>
|
290
|
+
<iteration>2</iteration>
|
291
|
+
</status>
|
292
|
+
<ext>
|
293
|
+
<doctype lang="">international-standard</doctype>
|
294
|
+
<doctype lang="fr">Standard international</doctype>
|
295
|
+
</ext>
|
259
296
|
</bibdata>
|
260
297
|
</iso-standard>
|
261
298
|
INPUT
|
262
|
-
expect(
|
299
|
+
expect(metadata(c.info(Nokogiri::XML(<<~"INPUT"), nil))).to be_equivalent_to <<~"OUTPUT"
|
263
300
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
264
301
|
<bibdata type="standard">
|
265
302
|
<title language="fr" format="text/plain">Céréales et légumineuses</ti>
|
@@ -292,7 +329,13 @@ OUTPUT
|
|
292
329
|
</contributor>
|
293
330
|
<language>fr</language>
|
294
331
|
<script>Latn</script>
|
295
|
-
<status
|
332
|
+
<status>
|
333
|
+
<stage language="">Committee Draft</stage>
|
334
|
+
<stage language="fr">Projet de comité</stage>
|
335
|
+
<substage language="">Withdrawn</substage>
|
336
|
+
<substage language="fr">Rétiré</substage>
|
337
|
+
<iteration>2</iteration>
|
338
|
+
</status>
|
296
339
|
<copyright>
|
297
340
|
<from>2016</from>
|
298
341
|
<owner>
|
@@ -301,37 +344,44 @@ OUTPUT
|
|
301
344
|
</organization>
|
302
345
|
</owner>
|
303
346
|
</copyright>
|
347
|
+
<ext>
|
348
|
+
<doctype language="">international-standard</doctype>
|
349
|
+
<doctype language="fr">Standard international</doctype>
|
350
|
+
</ext>
|
304
351
|
</bibdata>
|
305
352
|
</iso-standard>
|
306
353
|
INPUT
|
307
354
|
{:accesseddate=>"XXX",
|
308
355
|
:agency=>"ISO/IEC",
|
309
|
-
:authors=>[],
|
310
|
-
:authors_affiliations=>{},
|
311
356
|
:circulateddate=>"XXX",
|
312
357
|
:confirmeddate=>"XXX",
|
313
358
|
:copieddate=>"XXX",
|
314
359
|
:createddate=>"XXX",
|
315
360
|
:docnumber=>"17301-1-3",
|
316
361
|
:docnumeric=>"17301",
|
317
|
-
:doctitle=>"
|
362
|
+
:doctitle=>"Céréales et légumineuses",
|
363
|
+
:doctype=>"International Standard",
|
364
|
+
:doctype_display=>"Standard International",
|
318
365
|
:docyear=>"2016",
|
319
|
-
:draft=>nil,
|
320
|
-
:draftinfo=>"",
|
321
|
-
:edition=>nil,
|
322
366
|
:implementeddate=>"XXX",
|
323
367
|
:issueddate=>"XXX",
|
324
|
-
:
|
368
|
+
:iteration=>"2",
|
369
|
+
:lang=>"fr",
|
325
370
|
:obsoleteddate=>"XXX",
|
326
371
|
:publisheddate=>"2011-01",
|
327
372
|
:publisher=>"International Organization for Standardization et International Electrotechnical Commission",
|
328
373
|
:receiveddate=>"XXX",
|
329
374
|
:revdate=>"2016-05",
|
330
375
|
:revdate_monthyear=>"Mai 2016",
|
331
|
-
:
|
376
|
+
:script=>"Latn",
|
377
|
+
:stage=>"Committee Draft",
|
378
|
+
:stage_display=>"Projet De Comité",
|
379
|
+
:stageabbr=>"CD",
|
380
|
+
:substage=>"Withdrawn",
|
381
|
+
:substage_display=>"Rétiré",
|
332
382
|
:transmitteddate=>"XXX",
|
333
383
|
:unchangeddate=>"XXX",
|
334
|
-
:unpublished=>
|
384
|
+
:unpublished=>true,
|
335
385
|
:updateddate=>"XXX",
|
336
386
|
:vote_endeddate=>"XXX",
|
337
387
|
:vote_starteddate=>"XXX"}
|
@@ -846,6 +846,14 @@ TOCLEVEL
|
|
846
846
|
<formula id="_5fc1ef0f-75d2-4b54-802c-b1bad4a53b62">
|
847
847
|
<stem type="AsciiMath">D1</stem>
|
848
848
|
</formula>
|
849
|
+
<dl id="_f8fb7ed7-7874-44a8-933f-06e0e86fb264">
|
850
|
+
<dt>
|
851
|
+
<em>n</em>
|
852
|
+
</dt>
|
853
|
+
<dd>
|
854
|
+
<p id="_a27281a4-b20e-4d0b-a780-bab9e851b03e">is the number of coating layers</p>
|
855
|
+
</dd>
|
856
|
+
</dl>
|
849
857
|
</ul></li>
|
850
858
|
</ol>
|
851
859
|
</foreword></preface>
|
@@ -897,10 +905,28 @@ TOCLEVEL
|
|
897
905
|
</m:r>
|
898
906
|
</m:oMath>
|
899
907
|
</span>
|
908
|
+
<span style='mso-tab-count:1'>  </span>
|
900
909
|
</p>
|
901
910
|
</div>
|
902
911
|
</div>
|
903
912
|
</div>
|
913
|
+
<div class='ListContLevel2'>
|
914
|
+
<table class='dl'>
|
915
|
+
<tr>
|
916
|
+
<td valign='top' align='left'>
|
917
|
+
<p align='left' style='margin-left:0pt;text-align:left;' class='MsoNormal'>
|
918
|
+
<i>n</i>
|
919
|
+
</p>
|
920
|
+
</td>
|
921
|
+
<td valign='top'>
|
922
|
+
<p class='MsoNormal'>
|
923
|
+
<a name='_a27281a4-b20e-4d0b-a780-bab9e851b03e' id='_a27281a4-b20e-4d0b-a780-bab9e851b03e'/>
|
924
|
+
is the number of coating layers
|
925
|
+
</p>
|
926
|
+
</td>
|
927
|
+
</tr>
|
928
|
+
</table>
|
929
|
+
</div>
|
904
930
|
</p>
|
905
931
|
</div>
|
906
932
|
<p class='MsoNormal'> </p>
|
@@ -1062,9 +1088,20 @@ word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="
|
|
1062
1088
|
<thead>
|
1063
1089
|
<tr>
|
1064
1090
|
<td rowspan="2" style="border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;mso-border-bottom-alt:solid windowtext 1.0pt;">
|
1065
|
-
<p class="MsoNormal"><a name="_c47d9b39-adb2-431d-9320-78cb148fdb56" id="_c47d9b39-adb2-431d-9320-78cb148fdb56"></a>Output wavelength <span class="stem"
|
1066
|
-
|
1067
|
-
|
1091
|
+
<p class="MsoNormal"><a name="_c47d9b39-adb2-431d-9320-78cb148fdb56" id="_c47d9b39-adb2-431d-9320-78cb148fdb56"></a>Output wavelength <span class="stem">
|
1092
|
+
<m:oMath>
|
1093
|
+
<span style='font-style:normal;'>
|
1094
|
+
<m:r>
|
1095
|
+
<m:rPr>
|
1096
|
+
<m:sty m:val='p'/>
|
1097
|
+
</m:rPr>
|
1098
|
+
<m:t>(</m:t>
|
1099
|
+
</m:r>
|
1100
|
+
</span>
|
1101
|
+
<m:r>
|
1102
|
+
<m:t>μm)</m:t>
|
1103
|
+
</m:r>
|
1104
|
+
</m:oMath>
|
1068
1105
|
</span></p>
|
1069
1106
|
</td>
|
1070
1107
|
<th colspan="3" align="left" style="font-weight:bold;border-top:solid windowtext 1.5pt;mso-border-top-alt:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;">Predictive wavelengths</th>
|
@@ -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>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>
|
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>1</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
|