isodoc 1.6.3 → 1.6.7.1
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 +4 -6
- data/isodoc.gemspec +3 -2
- data/lib/isodoc-yaml/i18n-en.yaml +1 -0
- data/lib/isodoc-yaml/i18n-fr.yaml +1 -0
- data/lib/isodoc-yaml/i18n-zh-Hans.yaml +1 -0
- data/lib/isodoc.rb +0 -2
- data/lib/isodoc/convert.rb +7 -1
- data/lib/isodoc/function/blocks.rb +5 -4
- data/lib/isodoc/function/cleanup.rb +52 -43
- data/lib/isodoc/function/inline.rb +7 -7
- data/lib/isodoc/function/references.rb +33 -52
- data/lib/isodoc/function/section.rb +28 -16
- data/lib/isodoc/function/table.rb +21 -22
- data/lib/isodoc/function/terms.rb +6 -7
- data/lib/isodoc/function/to_word_html.rb +6 -3
- data/lib/isodoc/function/utils.rb +181 -163
- data/lib/isodoc/gem_tasks.rb +8 -9
- data/lib/isodoc/headlesshtml_convert.rb +8 -7
- data/lib/isodoc/html_convert.rb +5 -1
- data/lib/isodoc/html_function/comments.rb +14 -12
- data/lib/isodoc/html_function/footnotes.rb +14 -7
- data/lib/isodoc/html_function/html.rb +30 -26
- data/lib/isodoc/html_function/postprocess.rb +191 -182
- data/lib/isodoc/html_function/sectionsplit.rb +230 -0
- data/lib/isodoc/metadata.rb +22 -20
- data/lib/isodoc/metadata_contributor.rb +31 -28
- data/lib/isodoc/pdf_convert.rb +11 -13
- data/lib/isodoc/presentation_function/bibdata.rb +50 -22
- data/lib/isodoc/presentation_function/inline.rb +20 -15
- data/lib/isodoc/presentation_function/section.rb +38 -1
- data/lib/isodoc/presentation_xml_convert.rb +2 -0
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/postprocess.rb +50 -36
- data/lib/isodoc/xref.rb +2 -0
- data/lib/isodoc/xref/xref_gen_seq.rb +60 -35
- data/lib/isodoc/xref/xref_sect_gen.rb +4 -4
- data/spec/assets/scripts_override.html +3 -0
- data/spec/isodoc/blocks_spec.rb +373 -685
- data/spec/isodoc/cleanup_spec.rb +40 -42
- data/spec/isodoc/i18n_spec.rb +694 -821
- data/spec/isodoc/inline_spec.rb +482 -328
- data/spec/isodoc/metadata_spec.rb +384 -379
- data/spec/isodoc/postproc_spec.rb +163 -55
- data/spec/isodoc/presentation_xml_spec.rb +355 -278
- data/spec/isodoc/ref_spec.rb +5 -5
- data/spec/isodoc/section_spec.rb +216 -199
- data/spec/isodoc/sectionsplit_spec.rb +190 -0
- data/spec/isodoc/table_spec.rb +41 -42
- data/spec/isodoc/terms_spec.rb +84 -84
- data/spec/isodoc/xref_spec.rb +974 -932
- metadata +22 -5
@@ -3,7 +3,7 @@
|
|
3
3
|
require "spec_helper"
|
4
4
|
require "fileutils"
|
5
5
|
|
6
|
-
|
6
|
+
options = { wordstylesheet: "spec/assets/word.css",
|
7
7
|
htmlstylesheet: "spec/assets/html.scss" }
|
8
8
|
|
9
9
|
RSpec.describe IsoDoc do
|
@@ -191,6 +191,7 @@ RSpec.describe IsoDoc do
|
|
191
191
|
htmlcoverpage: "spec/assets/htmlcover.html",
|
192
192
|
htmlintropage: "spec/assets/htmlintro.html",
|
193
193
|
scripts: "spec/assets/scripts.html",
|
194
|
+
scripts_override: "spec/assets/scripts_override.html",
|
194
195
|
i18nyaml: "spec/assets/i18n.yaml",
|
195
196
|
ulstyle: "l1",
|
196
197
|
olstyle: "l2" },
|
@@ -215,6 +216,7 @@ RSpec.describe IsoDoc do
|
|
215
216
|
expect(html).to match(/an empty html cover page/)
|
216
217
|
expect(html).to match(/an empty html intro page/)
|
217
218
|
expect(html).to match(/This is > a script/)
|
219
|
+
expect(html).to match(/This is > also a script/)
|
218
220
|
expect(html).not_to match(/CDATA/)
|
219
221
|
expect(html).to match(%r{Antaŭparolo</h1>})
|
220
222
|
expect(html).to match(%r{html-override})
|
@@ -957,7 +959,9 @@ RSpec.describe IsoDoc do
|
|
957
959
|
it "moves images in HTML, using relative file location" do
|
958
960
|
FileUtils.rm_f "spec/test.html"
|
959
961
|
FileUtils.rm_rf "spec/test_htmlimages"
|
960
|
-
IsoDoc::HtmlConvert
|
962
|
+
IsoDoc::HtmlConvert
|
963
|
+
.new(wordstylesheet: "assets/word.css",
|
964
|
+
htmlstylesheet: "assets/html.scss")
|
961
965
|
.convert("spec/test", <<~"INPUT", false)
|
962
966
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
963
967
|
<preface><foreword>
|
@@ -996,14 +1000,15 @@ RSpec.describe IsoDoc do
|
|
996
1000
|
it "encodes images in HTML as data URIs" do
|
997
1001
|
FileUtils.rm_f "test.html"
|
998
1002
|
FileUtils.rm_rf "test_htmlimages"
|
999
|
-
IsoDoc::HtmlConvert
|
1003
|
+
IsoDoc::HtmlConvert
|
1004
|
+
.new(htmlstylesheet: "spec/assets/html.scss", datauriimage: true)
|
1000
1005
|
.convert("test", <<~"INPUT", false)
|
1001
1006
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1002
1007
|
<preface><foreword>
|
1003
1008
|
<figure id="_">
|
1004
1009
|
<name>Split-it-right sample divider</name>
|
1005
|
-
|
1006
|
-
|
1010
|
+
<image src="#{File.expand_path(File.join(File.dirname(__FILE__), '..', 'assets/rice_image1.png'))}" id="_" mimetype="image/png"/>
|
1011
|
+
<image src="spec/assets/rice_image1.png" id="_" mimetype="image/png"/>
|
1007
1012
|
</figure>
|
1008
1013
|
</foreword></preface>
|
1009
1014
|
</iso-standard>
|
@@ -1011,7 +1016,8 @@ RSpec.describe IsoDoc do
|
|
1011
1016
|
html = File.read("test.html")
|
1012
1017
|
.sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
1013
1018
|
.sub(%r{</main>.*$}m, "</main>")
|
1014
|
-
expect(xmlpp(html
|
1019
|
+
expect(xmlpp(html
|
1020
|
+
.gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"})))
|
1015
1021
|
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1016
1022
|
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
1017
1023
|
<br />
|
@@ -1030,7 +1036,8 @@ RSpec.describe IsoDoc do
|
|
1030
1036
|
it "encodes images in HTML as data URIs, using relative file location" do
|
1031
1037
|
FileUtils.rm_f "spec/test.html"
|
1032
1038
|
FileUtils.rm_rf "spec/test_htmlimages"
|
1033
|
-
IsoDoc::HtmlConvert
|
1039
|
+
IsoDoc::HtmlConvert
|
1040
|
+
.new({ htmlstylesheet: "assets/html.scss", datauriimage: true })
|
1034
1041
|
.convert("spec/test", <<~"INPUT", false)
|
1035
1042
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1036
1043
|
<preface><foreword>
|
@@ -1045,7 +1052,8 @@ RSpec.describe IsoDoc do
|
|
1045
1052
|
html = File.read("spec/test.html")
|
1046
1053
|
.sub(/^.*<main class="main-section">/m, '<main class="main-section">')
|
1047
1054
|
.sub(%r{</main>.*$}m, "</main>")
|
1048
|
-
expect(xmlpp(html
|
1055
|
+
expect(xmlpp(html
|
1056
|
+
.gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"})))
|
1049
1057
|
.to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1050
1058
|
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
1051
1059
|
<br />
|
@@ -1064,7 +1072,7 @@ RSpec.describe IsoDoc do
|
|
1064
1072
|
it "processes IsoXML terms for HTML" do
|
1065
1073
|
FileUtils.rm_f "test.html"
|
1066
1074
|
FileUtils.rm_f "test.doc"
|
1067
|
-
IsoDoc::HtmlConvert.new(
|
1075
|
+
IsoDoc::HtmlConvert.new(options)
|
1068
1076
|
.convert("test", <<~"INPUT", false)
|
1069
1077
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1070
1078
|
<sections>
|
@@ -1121,7 +1129,7 @@ RSpec.describe IsoDoc do
|
|
1121
1129
|
it "processes empty term modifications" do
|
1122
1130
|
FileUtils.rm_f "test.html"
|
1123
1131
|
FileUtils.rm_f "test.doc"
|
1124
|
-
IsoDoc::HtmlConvert.new(
|
1132
|
+
IsoDoc::HtmlConvert.new(options)
|
1125
1133
|
.convert("test", <<~"INPUT", false)
|
1126
1134
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1127
1135
|
<sections>
|
@@ -1158,7 +1166,7 @@ RSpec.describe IsoDoc do
|
|
1158
1166
|
it "creates continuation styles for multiparagraph list items in Word" do
|
1159
1167
|
FileUtils.rm_f "test.doc"
|
1160
1168
|
FileUtils.rm_f "test.html"
|
1161
|
-
IsoDoc::WordConvert.new(
|
1169
|
+
IsoDoc::WordConvert.new(options)
|
1162
1170
|
.convert("test", <<~"INPUT", false)
|
1163
1171
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1164
1172
|
<preface><foreword>
|
@@ -1269,7 +1277,7 @@ RSpec.describe IsoDoc do
|
|
1269
1277
|
it "does not lose HTML escapes in postprocessing" do
|
1270
1278
|
FileUtils.rm_f "test.doc"
|
1271
1279
|
FileUtils.rm_f "test.html"
|
1272
|
-
IsoDoc::HtmlConvert.new(
|
1280
|
+
IsoDoc::HtmlConvert.new(options)
|
1273
1281
|
.convert("test", <<~"INPUT", false)
|
1274
1282
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1275
1283
|
<preface><foreword>
|
@@ -1300,7 +1308,7 @@ RSpec.describe IsoDoc do
|
|
1300
1308
|
it "does not lose HTML escapes in postprocessing (Word)" do
|
1301
1309
|
FileUtils.rm_f "test.doc"
|
1302
1310
|
FileUtils.rm_f "test.html"
|
1303
|
-
IsoDoc::WordConvert.new(
|
1311
|
+
IsoDoc::WordConvert.new(options)
|
1304
1312
|
.convert("test", <<~"INPUT", false)
|
1305
1313
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1306
1314
|
<preface><foreword>
|
@@ -1331,7 +1339,7 @@ RSpec.describe IsoDoc do
|
|
1331
1339
|
it "propagates example style to paragraphs in postprocessing (Word)" do
|
1332
1340
|
FileUtils.rm_f "test.doc"
|
1333
1341
|
FileUtils.rm_f "test.html"
|
1334
|
-
IsoDoc::WordConvert.new(
|
1342
|
+
IsoDoc::WordConvert.new(options).convert("test", <<~"INPUT", false)
|
1335
1343
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1336
1344
|
<preface><foreword>
|
1337
1345
|
<example id="samplecode">
|
@@ -1362,7 +1370,7 @@ RSpec.describe IsoDoc do
|
|
1362
1370
|
it "deals with image captions (Word)" do
|
1363
1371
|
FileUtils.rm_f "test.doc"
|
1364
1372
|
FileUtils.rm_f "test.html"
|
1365
|
-
IsoDoc::WordConvert.new(
|
1373
|
+
IsoDoc::WordConvert.new(options)
|
1366
1374
|
.convert("test", <<~"INPUT", false)
|
1367
1375
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1368
1376
|
<preface><foreword>
|
@@ -1396,7 +1404,7 @@ RSpec.describe IsoDoc do
|
|
1396
1404
|
it "deals with empty table titles (Word)" do
|
1397
1405
|
FileUtils.rm_f "test.doc"
|
1398
1406
|
FileUtils.rm_f "test.html"
|
1399
|
-
IsoDoc::WordConvert.new(
|
1407
|
+
IsoDoc::WordConvert.new(options)
|
1400
1408
|
.convert("test", <<~"INPUT", false)
|
1401
1409
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1402
1410
|
<preface><foreword>
|
@@ -1457,22 +1465,21 @@ RSpec.describe IsoDoc do
|
|
1457
1465
|
it "propagates alignment of table cells (Word)" do
|
1458
1466
|
FileUtils.rm_f "test.doc"
|
1459
1467
|
FileUtils.rm_f "test.html"
|
1460
|
-
IsoDoc::WordConvert.new(
|
1468
|
+
IsoDoc::WordConvert.new(options)
|
1461
1469
|
.convert("test", <<~"INPUT", false)
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
</iso-standard>
|
1470
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
1471
|
+
<preface><foreword>
|
1472
|
+
<table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
|
1473
|
+
<td rowspan="2" align="left">
|
1474
|
+
<p id="_c47d9b39-adb2-431d-9320-78cb148fdb56">Output wavelength</p>
|
1475
|
+
<p id="_c47d9b39-adb2-431d-9320-78cb148fdb57">Output wavelength</p>
|
1476
|
+
</td>
|
1477
|
+
<th colspan="3" align="right"><p id="_c47d9b39-adb2-431d-9320-78cb148fdb58">Predictive wavelengths</p></th>
|
1478
|
+
</tr>
|
1479
|
+
</thead>
|
1480
|
+
</table>
|
1481
|
+
</preface>
|
1482
|
+
</iso-standard>
|
1476
1483
|
INPUT
|
1477
1484
|
word = File.read("test.doc")
|
1478
1485
|
.sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">')
|
@@ -1517,7 +1524,7 @@ RSpec.describe IsoDoc do
|
|
1517
1524
|
end
|
1518
1525
|
|
1519
1526
|
it "cleans up boilerplate" do
|
1520
|
-
|
1527
|
+
input = <<~INPUT
|
1521
1528
|
<html>
|
1522
1529
|
<head/>
|
1523
1530
|
<body>
|
@@ -1535,6 +1542,7 @@ RSpec.describe IsoDoc do
|
|
1535
1542
|
</body>
|
1536
1543
|
</html>
|
1537
1544
|
INPUT
|
1545
|
+
html = <<~OUTPUT
|
1538
1546
|
<main class='main-section'>
|
1539
1547
|
<button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
|
1540
1548
|
<hr/>
|
@@ -1552,27 +1560,7 @@ RSpec.describe IsoDoc do
|
|
1552
1560
|
</div>
|
1553
1561
|
</main>
|
1554
1562
|
OUTPUT
|
1555
|
-
|
1556
|
-
|
1557
|
-
it "cleans up boilerplate (Word)" do
|
1558
|
-
expect(xmlpp(IsoDoc::WordConvert.new({ wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.scss", filename: "test" }).word_cleanup(Nokogiri::XML(<<~INPUT)).to_xml).sub(/^.*<main/m, "<main").sub(%r{</main>.*$}m, "</main>")).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1559
|
-
<html>
|
1560
|
-
<head/>
|
1561
|
-
<body>
|
1562
|
-
<div class="main-section">
|
1563
|
-
<div id="boilerplate-copyright"> <h1>Copyright</h1> </div>
|
1564
|
-
<div id="boilerplate-license"> <h1>License</h1> </div>
|
1565
|
-
<div id="boilerplate-legal"> <h1>Legal</h1> </div>
|
1566
|
-
<div id="boilerplate-feedback"> <h1>Feedback</h1> </div>
|
1567
|
-
<hr/>
|
1568
|
-
<div id="boilerplate-feedback-destination"/>
|
1569
|
-
<div id="boilerplate-legal-destination"/>
|
1570
|
-
<div id="boilerplate-license-destination"/>
|
1571
|
-
<div id="boilerplate-copyright-destination"/>
|
1572
|
-
</div>
|
1573
|
-
</body>
|
1574
|
-
</html>
|
1575
|
-
INPUT
|
1563
|
+
doc = <<~OUTPUT
|
1576
1564
|
<html>
|
1577
1565
|
<head/>
|
1578
1566
|
<body>
|
@@ -1594,6 +1582,18 @@ RSpec.describe IsoDoc do
|
|
1594
1582
|
</body>
|
1595
1583
|
</html>
|
1596
1584
|
OUTPUT
|
1585
|
+
expect(xmlpp(IsoDoc::HtmlConvert
|
1586
|
+
.new(wordstylesheet: "spec/assets/word.css",
|
1587
|
+
htmlstylesheet: "spec/assets/html.scss", filename: "test")
|
1588
|
+
.html_preface(Nokogiri::XML(input)).to_xml)
|
1589
|
+
.sub(/^.*<main/m, "<main").sub(%r{</main>.*$}m, "</main>"))
|
1590
|
+
.to be_equivalent_to xmlpp(html)
|
1591
|
+
expect(xmlpp(IsoDoc::WordConvert
|
1592
|
+
.new(wordstylesheet: "spec/assets/word.css",
|
1593
|
+
htmlstylesheet: "spec/assets/html.scss", filename: "test")
|
1594
|
+
.word_cleanup(Nokogiri::XML(input)).to_xml)
|
1595
|
+
.sub(/^.*<main/m, "<main").sub(%r{</main>.*$}m, "</main>"))
|
1596
|
+
.to be_equivalent_to xmlpp(doc)
|
1597
1597
|
end
|
1598
1598
|
|
1599
1599
|
it "deals with landscape and portrait pagebreaks (Word)" do
|
@@ -1796,7 +1796,7 @@ RSpec.describe IsoDoc do
|
|
1796
1796
|
end
|
1797
1797
|
|
1798
1798
|
it "expands out nested tables in Word" do
|
1799
|
-
|
1799
|
+
input = <<~INPUT
|
1800
1800
|
<html>
|
1801
1801
|
<head/>
|
1802
1802
|
<body>
|
@@ -1818,6 +1818,7 @@ RSpec.describe IsoDoc do
|
|
1818
1818
|
</body>
|
1819
1819
|
</html>
|
1820
1820
|
INPUT
|
1821
|
+
output = <<~OUTPUT
|
1821
1822
|
<html>
|
1822
1823
|
<head/>
|
1823
1824
|
<body>
|
@@ -1913,10 +1914,16 @@ RSpec.describe IsoDoc do
|
|
1913
1914
|
</body>
|
1914
1915
|
</html>
|
1915
1916
|
OUTPUT
|
1917
|
+
expect(xmlpp(IsoDoc::WordConvert
|
1918
|
+
.new(wordstylesheet: "spec/assets/word.css",
|
1919
|
+
htmlstylesheet: "spec/assets/html.scss", filename: "test")
|
1920
|
+
.word_cleanup(Nokogiri::XML(input)).to_xml)
|
1921
|
+
.sub(/^.*<main/m, "<main").sub(%r{</main>.*$}m, "</main>"))
|
1922
|
+
.to be_equivalent_to xmlpp(output)
|
1916
1923
|
end
|
1917
1924
|
|
1918
1925
|
it "allocate widths to tables (Word)" do
|
1919
|
-
|
1926
|
+
input = <<~INPUT
|
1920
1927
|
<html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
|
1921
1928
|
<head><style/></head>
|
1922
1929
|
<body lang='EN-US' link='blue' vlink='#954F72'>
|
@@ -2050,6 +2057,7 @@ RSpec.describe IsoDoc do
|
|
2050
2057
|
</body>
|
2051
2058
|
</html>
|
2052
2059
|
INPUT
|
2060
|
+
output = <<~OUTPUT
|
2053
2061
|
<html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
|
2054
2062
|
<head>
|
2055
2063
|
<style/>
|
@@ -2185,5 +2193,105 @@ RSpec.describe IsoDoc do
|
|
2185
2193
|
</body>
|
2186
2194
|
</html>
|
2187
2195
|
OUTPUT
|
2196
|
+
expect(xmlpp(IsoDoc::WordConvert
|
2197
|
+
.new(wordstylesheet: "spec/assets/word.css",
|
2198
|
+
htmlstylesheet: "spec/assets/html.scss", filename: "test")
|
2199
|
+
.word_cleanup(Nokogiri::XML(input)).to_xml)
|
2200
|
+
.sub(/^.*<main/m, "<main").sub(%r{</main>.*$}m, "</main>"))
|
2201
|
+
.to be_equivalent_to xmlpp(output)
|
2202
|
+
end
|
2203
|
+
|
2204
|
+
it "generates bare HTML file" do
|
2205
|
+
FileUtils.rm_f "test.html"
|
2206
|
+
IsoDoc::HtmlConvert.new(
|
2207
|
+
{ bare: true,
|
2208
|
+
htmlstylesheet: "spec/assets/html.scss",
|
2209
|
+
filename: "test" },
|
2210
|
+
).convert("test", <<~"INPUT", false)
|
2211
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
2212
|
+
<bibdata>
|
2213
|
+
<title language="en">test</title>
|
2214
|
+
</bibdata>
|
2215
|
+
<boilerplate>
|
2216
|
+
<feedback-statement>
|
2217
|
+
<clause><title>I am boilerplate</title></clause>
|
2218
|
+
</feedback-statement>
|
2219
|
+
</boilerplate>
|
2220
|
+
<preface><foreword>
|
2221
|
+
<note>
|
2222
|
+
<p id="_f06fd0d1-a203-4f3d-a515-0bdba0f8d83f">These results are based on a study carried out on three different types of kernel.</p>
|
2223
|
+
</note>
|
2224
|
+
</foreword></preface>
|
2225
|
+
</iso-standard>
|
2226
|
+
INPUT
|
2227
|
+
output = <<~OUTPUT
|
2228
|
+
<body lang='en' xml:lang='en'>
|
2229
|
+
<main class='main-section'>
|
2230
|
+
<button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
|
2231
|
+
<br/>
|
2232
|
+
<div>
|
2233
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
2234
|
+
<div class='Note'>
|
2235
|
+
<p>
|
2236
|
+
  These results are based on a study carried out on three
|
2237
|
+
different types of kernel.
|
2238
|
+
</p>
|
2239
|
+
</div>
|
2240
|
+
</div>
|
2241
|
+
<p class='zzSTDTitle1'>test</p>
|
2242
|
+
</main>
|
2243
|
+
<script/>
|
2244
|
+
</body>
|
2245
|
+
OUTPUT
|
2246
|
+
expect(File.exist?("test.html")).to be true
|
2247
|
+
html = File.read("test.html")
|
2248
|
+
.sub(%r{^.*<body}m, "<body")
|
2249
|
+
.sub(%r{</body>.*$}m, "</body>")
|
2250
|
+
.gsub(%r{<script.+?</script>}m, "<script/>")
|
2251
|
+
.sub(%r{(<script/>\s+)+}m, "<script/>")
|
2252
|
+
expect(xmlpp(html)).to be_equivalent_to xmlpp(output)
|
2253
|
+
end
|
2254
|
+
|
2255
|
+
it "cleans up lists (HTML)" do
|
2256
|
+
input = <<~INPUT
|
2257
|
+
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
2258
|
+
<head/>
|
2259
|
+
<body>
|
2260
|
+
<div class="main-section">
|
2261
|
+
<ul>
|
2262
|
+
<div>N1</div>
|
2263
|
+
<li>A</li>
|
2264
|
+
<li>B</li>
|
2265
|
+
<div>N2</div>
|
2266
|
+
<li>C</li>
|
2267
|
+
<div>N3</div>
|
2268
|
+
</div>
|
2269
|
+
</body>
|
2270
|
+
</html>
|
2271
|
+
INPUT
|
2272
|
+
output = <<~OUTPUT
|
2273
|
+
<main class='main-section'>
|
2274
|
+
<button onclick='topFunction()' id='myBtn' title='Go to top'>Top</button>
|
2275
|
+
<ul>
|
2276
|
+
<li>
|
2277
|
+
A
|
2278
|
+
<div>N1</div>
|
2279
|
+
</li>
|
2280
|
+
<li>
|
2281
|
+
B
|
2282
|
+
<div>N2</div>
|
2283
|
+
</li>
|
2284
|
+
<li>
|
2285
|
+
C
|
2286
|
+
<div>N3</div>
|
2287
|
+
</li>
|
2288
|
+
</ul>
|
2289
|
+
</main>
|
2290
|
+
OUTPUT
|
2291
|
+
expect(xmlpp(IsoDoc::HtmlConvert
|
2292
|
+
.new(htmlstylesheet: "spec/assets/html.scss", filename: "test")
|
2293
|
+
.html_cleanup(Nokogiri::XML(input)).to_xml)
|
2294
|
+
.sub(/^.*<main/m, "<main").sub(%r{</main>.*$}m, "</main>"))
|
2295
|
+
.to be_equivalent_to xmlpp(output)
|
2188
2296
|
end
|
2189
2297
|
end
|
@@ -20,36 +20,55 @@ RSpec.describe IsoDoc do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it "localises numbers in MathML" do
|
23
|
-
|
24
|
-
|
25
|
-
|
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'>
|
26
39
|
<bibdata>
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
40
|
+
<title language='en'>test</title>
|
41
|
+
</bibdata>
|
42
|
+
<preface>
|
43
|
+
<p displayorder="1">
|
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>≥</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>∑</mo>
|
67
|
+
</mrow>
|
68
|
+
<mrow>
|
50
69
|
<mrow>
|
51
|
-
<mi>
|
52
|
-
<mo
|
70
|
+
<mi>j</mi>
|
71
|
+
<mo>=</mo>
|
53
72
|
<msub>
|
54
73
|
<mrow>
|
55
74
|
<mi>X</mi>
|
@@ -59,76 +78,61 @@ RSpec.describe IsoDoc do
|
|
59
78
|
</mrow>
|
60
79
|
</msub>
|
61
80
|
</mrow>
|
62
|
-
</
|
63
|
-
<
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
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>
|
70
95
|
<mi>j</mi>
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
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>
|
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=')'>
|
119
111
|
<mrow>
|
120
|
-
<mn>1
|
112
|
+
<mn>1</mn>
|
121
113
|
<mo>−</mo>
|
122
|
-
<mi>
|
114
|
+
<mi>p</mi>
|
123
115
|
</mrow>
|
116
|
+
</mfenced>
|
117
|
+
</mrow>
|
118
|
+
<mrow>
|
119
|
+
<mrow>
|
120
|
+
<mn>1.003</mn>
|
121
|
+
<mo>−</mo>
|
122
|
+
<mi>j</mi>
|
124
123
|
</mrow>
|
125
|
-
</
|
126
|
-
</
|
127
|
-
</
|
128
|
-
</
|
129
|
-
</
|
130
|
-
</
|
131
|
-
|
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)
|
132
136
|
end
|
133
137
|
|
134
138
|
context "when twitter_cldr_localiser_symbols has additional options" do
|
@@ -252,7 +256,7 @@ RSpec.describe IsoDoc do
|
|
252
256
|
</bibdata>
|
253
257
|
|
254
258
|
<preface>
|
255
|
-
<p>
|
259
|
+
<p displayorder="1">
|
256
260
|
30,000
|
257
261
|
<stem type='MathML'>
|
258
262
|
<math xmlns='http://www.w3.org/1998/Math/MathML'>
|
@@ -369,7 +373,8 @@ RSpec.describe IsoDoc do
|
|
369
373
|
|
370
374
|
before do
|
371
375
|
allow_any_instance_of(IsoDoc::PresentationXMLConvert)
|
372
|
-
.to(receive(:twitter_cldr_localiser_symbols)
|
376
|
+
.to(receive(:twitter_cldr_localiser_symbols)
|
377
|
+
.and_return(additional_symbols))
|
373
378
|
end
|
374
379
|
|
375
380
|
it "Supports twitter_cldr_localiser_symbols fraction options" do
|
@@ -381,34 +386,53 @@ RSpec.describe IsoDoc do
|
|
381
386
|
end
|
382
387
|
|
383
388
|
it "localises numbers in MathML in French" do
|
384
|
-
|
385
|
-
|
386
|
-
|
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'>
|
387
403
|
<bibdata>
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
404
|
+
<title language='en'>test</title>
|
405
|
+
<language current='true'>fr</language>
|
406
|
+
</bibdata>
|
407
|
+
<preface>
|
408
|
+
<p displayorder="1">
|
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=')'>
|
414
|
+
<mrow>
|
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>
|
425
|
+
</mrow>
|
426
|
+
</mfenced>
|
427
|
+
<mo>=</mo>
|
428
|
+
<munderover>
|
429
|
+
<mrow>
|
430
|
+
<mo>∑</mo>
|
431
|
+
</mrow>
|
432
|
+
<mrow>
|
409
433
|
<mrow>
|
410
|
-
<mi>
|
411
|
-
<mo
|
434
|
+
<mi>j</mi>
|
435
|
+
<mo>=</mo>
|
412
436
|
<msub>
|
413
437
|
<mrow>
|
414
438
|
<mi>X</mi>
|
@@ -418,109 +442,113 @@ RSpec.describe IsoDoc do
|
|
418
442
|
</mrow>
|
419
443
|
</msub>
|
420
444
|
</mrow>
|
421
|
-
</
|
422
|
-
<
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
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>
|
429
459
|
<mi>j</mi>
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
<mfenced open='(' close=')'>
|
446
|
-
<mtable>
|
447
|
-
<mtr>
|
448
|
-
<mtd>
|
449
|
-
<mn>1 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>−</mo>
|
473
|
-
<mi>p</mi>
|
474
|
-
</mrow>
|
475
|
-
</mfenced>
|
476
|
-
</mrow>
|
477
|
-
<mrow>
|
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=')'>
|
478
475
|
<mrow>
|
479
|
-
<mn>1
|
476
|
+
<mn>1</mn>
|
480
477
|
<mo>−</mo>
|
481
|
-
<mi>
|
478
|
+
<mi>p</mi>
|
482
479
|
</mrow>
|
480
|
+
</mfenced>
|
481
|
+
</mrow>
|
482
|
+
<mrow>
|
483
|
+
<mrow>
|
484
|
+
<mn>1,003</mn>
|
485
|
+
<mo>−</mo>
|
486
|
+
<mi>j</mi>
|
483
487
|
</mrow>
|
484
|
-
</
|
485
|
-
</
|
486
|
-
</
|
487
|
-
</
|
488
|
-
</
|
489
|
-
</
|
490
|
-
|
488
|
+
</mrow>
|
489
|
+
</msup>
|
490
|
+
</math>
|
491
|
+
</stem>
|
492
|
+
</p>
|
493
|
+
</preface>
|
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)
|
491
500
|
end
|
492
501
|
|
493
502
|
it "customises localisation of numbers" do
|
494
503
|
mock_symbols
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
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>
|
501
521
|
</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>
|
513
522
|
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
523
|
+
<preface>
|
524
|
+
<p displayorder="1">
|
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=')'>
|
530
|
+
<mrow>
|
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>
|
541
|
+
</mrow>
|
542
|
+
</mfenced>
|
543
|
+
<mo>=</mo>
|
544
|
+
<munderover>
|
545
|
+
<mrow>
|
546
|
+
<mo>∑</mo>
|
547
|
+
</mrow>
|
548
|
+
<mrow>
|
521
549
|
<mrow>
|
522
|
-
<mi>
|
523
|
-
<mo
|
550
|
+
<mi>j</mi>
|
551
|
+
<mo>=</mo>
|
524
552
|
<msub>
|
525
553
|
<mrow>
|
526
554
|
<mi>X</mi>
|
@@ -530,81 +558,130 @@ RSpec.describe IsoDoc do
|
|
530
558
|
</mrow>
|
531
559
|
</msub>
|
532
560
|
</mrow>
|
533
|
-
</
|
534
|
-
<
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
561
|
+
</mrow>
|
562
|
+
<mrow>
|
563
|
+
<mn>1'000</mn>
|
564
|
+
</mrow>
|
565
|
+
</munderover>
|
566
|
+
<mfenced open='(' close=')'>
|
567
|
+
<mtable>
|
568
|
+
<mtr>
|
569
|
+
<mtd>
|
570
|
+
<mn>1'000</mn>
|
571
|
+
</mtd>
|
572
|
+
</mtr>
|
573
|
+
<mtr>
|
574
|
+
<mtd>
|
541
575
|
<mi>j</mi>
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
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>−</mo>
|
585
|
-
<mi>p</mi>
|
586
|
-
</mrow>
|
587
|
-
</mfenced>
|
588
|
-
</mrow>
|
589
|
-
<mrow>
|
576
|
+
</mtd>
|
577
|
+
</mtr>
|
578
|
+
</mtable>
|
579
|
+
</mfenced>
|
580
|
+
<msup>
|
581
|
+
<mrow>
|
582
|
+
<mi>p</mi>
|
583
|
+
</mrow>
|
584
|
+
<mrow>
|
585
|
+
<mi>j</mi>
|
586
|
+
</mrow>
|
587
|
+
</msup>
|
588
|
+
<msup>
|
589
|
+
<mrow>
|
590
|
+
<mfenced open='(' close=')'>
|
590
591
|
<mrow>
|
591
|
-
<mn>
|
592
|
+
<mn>0,0000032</mn>
|
592
593
|
<mo>−</mo>
|
593
|
-
<mi>
|
594
|
+
<mi>p</mi>
|
594
595
|
</mrow>
|
596
|
+
</mfenced>
|
597
|
+
</mrow>
|
598
|
+
<mrow>
|
599
|
+
<mrow>
|
600
|
+
<mn>1,003</mn>
|
601
|
+
<mo>−</mo>
|
602
|
+
<mi>j</mi>
|
595
603
|
</mrow>
|
596
|
-
</
|
597
|
-
</
|
598
|
-
</
|
599
|
-
</
|
600
|
-
</
|
601
|
-
</
|
602
|
-
|
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)
|
603
679
|
end
|
604
680
|
|
605
681
|
private
|
606
682
|
|
607
683
|
def mock_symbols
|
608
|
-
allow_any_instance_of(::IsoDoc::PresentationXMLConvert)
|
684
|
+
allow_any_instance_of(::IsoDoc::PresentationXMLConvert)
|
685
|
+
.to receive(:twitter_cldr_localiser_symbols).and_return(group: "'")
|
609
686
|
end
|
610
687
|
end
|