isodoc 1.0.6 → 1.0.7
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/Gemfile.lock +5 -5
- data/README.adoc +4 -3
- data/lib/isodoc/base_style/blocks.scss +17 -0
- data/lib/isodoc/function/blocks.rb +14 -0
- data/lib/isodoc/function/inline.rb +3 -10
- data/lib/isodoc/function/lists.rb +0 -1
- data/lib/isodoc/function/terms.rb +0 -2
- data/lib/isodoc/function/xref_gen.rb +4 -5
- data/lib/isodoc/version.rb +1 -1
- data/lib/isodoc/word_function/postprocess.rb +32 -12
- data/spec/isodoc/blocks_spec.rb +73 -25
- data/spec/isodoc/cleanup_spec.rb +10 -10
- data/spec/isodoc/footnotes_spec.rb +4 -4
- data/spec/isodoc/i18n_spec.rb +4 -4
- data/spec/isodoc/inline_spec.rb +9 -9
- data/spec/isodoc/lists_spec.rb +5 -5
- data/spec/isodoc/postproc_spec.rb +81 -22
- data/spec/isodoc/ref_spec.rb +1 -1
- data/spec/isodoc/section_spec.rb +8 -8
- data/spec/isodoc/table_spec.rb +4 -4
- data/spec/isodoc/terms_spec.rb +2 -3
- data/spec/isodoc/xref_spec.rb +27 -19
- data/spec/spec_helper.rb +9 -0
- metadata +2 -2
data/spec/isodoc/cleanup_spec.rb
CHANGED
@@ -3,7 +3,7 @@ require "nokogiri"
|
|
3
3
|
|
4
4
|
RSpec.describe IsoDoc do
|
5
5
|
it "cleans up admonitions" do
|
6
|
-
expect(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s).to be_equivalent_to <<~"OUTPUT"
|
6
|
+
expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
7
7
|
<html>
|
8
8
|
<body>
|
9
9
|
<div class="Admonition">
|
@@ -26,7 +26,7 @@ RSpec.describe IsoDoc do
|
|
26
26
|
end
|
27
27
|
|
28
28
|
it "cleans up figures" do
|
29
|
-
expect(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s).to be_equivalent_to <<~"OUTPUT"
|
29
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
30
30
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
31
31
|
<body>
|
32
32
|
<div class="figure">
|
@@ -53,7 +53,7 @@ RSpec.describe IsoDoc do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
it "cleans up figures (Word)" do
|
56
|
-
expect(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s).to be_equivalent_to <<~"OUTPUT"
|
56
|
+
expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
57
57
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
58
58
|
<body>
|
59
59
|
<div class="figure">
|
@@ -80,7 +80,7 @@ RSpec.describe IsoDoc do
|
|
80
80
|
end
|
81
81
|
|
82
82
|
it "cleans up inline headers" do
|
83
|
-
expect(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s).to be_equivalent_to <<~"OUTPUT"
|
83
|
+
expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
84
84
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
85
85
|
<head>
|
86
86
|
<title>test</title>
|
@@ -149,7 +149,7 @@ RSpec.describe IsoDoc do
|
|
149
149
|
end
|
150
150
|
|
151
151
|
it "cleans up footnotes" do
|
152
|
-
expect(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s).to be_equivalent_to <<~"OUTPUT"
|
152
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
153
153
|
#{HTML_HDR}
|
154
154
|
<br/>
|
155
155
|
<div>
|
@@ -191,7 +191,7 @@ RSpec.describe IsoDoc do
|
|
191
191
|
end
|
192
192
|
|
193
193
|
it "cleans up footnotes (Word)" do
|
194
|
-
expect(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s).to be_equivalent_to <<~"OUTPUT"
|
194
|
+
expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
195
195
|
<html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
|
196
196
|
<head/>
|
197
197
|
<body lang="EN-US" link="blue" vlink="#954F72">
|
@@ -262,7 +262,7 @@ RSpec.describe IsoDoc do
|
|
262
262
|
end
|
263
263
|
|
264
264
|
it "cleans up tables with tfoot" do
|
265
|
-
expect(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s).to be_equivalent_to <<~"OUTPUT"
|
265
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
266
266
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
267
267
|
<head>
|
268
268
|
<title>test</title>
|
@@ -419,7 +419,7 @@ INPUT
|
|
419
419
|
end
|
420
420
|
|
421
421
|
it "cleans up tables with tfoot (Word)" do
|
422
|
-
expect(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s).to be_equivalent_to <<~"OUTPUT"
|
422
|
+
expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
423
423
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
424
424
|
<head>
|
425
425
|
<title>test</title>
|
@@ -577,7 +577,7 @@ INPUT
|
|
577
577
|
|
578
578
|
|
579
579
|
it "cleans up tables without tfoot" do
|
580
|
-
expect(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s).to be_equivalent_to <<~"OUTPUT"
|
580
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
581
581
|
<html xmlns:epub="http://www.idpf.org/2007/ops">
|
582
582
|
<head>
|
583
583
|
<title>test</title>
|
@@ -716,7 +716,7 @@ INPUT
|
|
716
716
|
end
|
717
717
|
|
718
718
|
it "cleans up symbols lists" do
|
719
|
-
expect(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s).to be_equivalent_to <<~"OUTPUT"
|
719
|
+
expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
720
720
|
<div id="L" class="Symbols">
|
721
721
|
<h1>4.<span style="mso-tab-count:1">  </span>Symbols and Abbreviated Terms</h1>
|
722
722
|
<dl>
|
@@ -3,7 +3,7 @@ require "fileutils"
|
|
3
3
|
|
4
4
|
RSpec.describe IsoDoc do
|
5
5
|
it "processes IsoXML footnotes" do
|
6
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
6
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
7
7
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
8
8
|
<preface>
|
9
9
|
<foreword>
|
@@ -42,7 +42,7 @@ RSpec.describe IsoDoc do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it "processes IsoXML footnotes (Word)" do
|
45
|
-
expect(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
45
|
+
expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
46
46
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
47
47
|
<preface>
|
48
48
|
<foreword>
|
@@ -114,7 +114,7 @@ RSpec.describe IsoDoc do
|
|
114
114
|
</iso-standard>
|
115
115
|
INPUT
|
116
116
|
html = File.read("test.html").sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")
|
117
|
-
expect(html).to be_equivalent_to <<~"OUTPUT"
|
117
|
+
expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
118
118
|
<body lang="en" xml:lang="en">
|
119
119
|
<div class="title-section">
|
120
120
|
<p> </p>
|
@@ -168,7 +168,7 @@ RSpec.describe IsoDoc do
|
|
168
168
|
</iso-standard>
|
169
169
|
INPUT
|
170
170
|
html = File.read("test.doc").sub(/^.*<body/m, "<body").sub(%r{</body>.*$}m, "</body>")
|
171
|
-
expect(html).to be_equivalent_to <<~"OUTPUT"
|
171
|
+
expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
172
172
|
<body lang="EN-US" link="blue" vlink="#954F72" xml:lang="EN-US">
|
173
173
|
<div class="WordSection1">
|
174
174
|
<p class="MsoNormal"> </p>
|
data/spec/isodoc/i18n_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes English" do
|
5
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
5
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<bibdata>
|
8
8
|
<language>en</language>
|
@@ -138,7 +138,7 @@ RSpec.describe IsoDoc do
|
|
138
138
|
end
|
139
139
|
|
140
140
|
it "defaults to English" do
|
141
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
141
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
142
142
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
143
143
|
<bibdata>
|
144
144
|
<language>tlh</language>
|
@@ -274,7 +274,7 @@ RSpec.describe IsoDoc do
|
|
274
274
|
end
|
275
275
|
|
276
276
|
it "processes French" do
|
277
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
277
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
278
278
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
279
279
|
<bibdata>
|
280
280
|
<language>fr</language>
|
@@ -410,7 +410,7 @@ RSpec.describe IsoDoc do
|
|
410
410
|
end
|
411
411
|
|
412
412
|
it "processes Simplified Chinese" do
|
413
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
413
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
414
414
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
415
415
|
<bibdata>
|
416
416
|
<language>zh</language>
|
data/spec/isodoc/inline_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes inline formatting" do
|
5
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
5
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface><foreword>
|
8
8
|
<p>
|
@@ -32,7 +32,7 @@ RSpec.describe IsoDoc do
|
|
32
32
|
end
|
33
33
|
|
34
34
|
it "processes embedded inline formatting" do
|
35
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
35
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
36
36
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
37
37
|
<preface><foreword>
|
38
38
|
<p>
|
@@ -58,7 +58,7 @@ RSpec.describe IsoDoc do
|
|
58
58
|
end
|
59
59
|
|
60
60
|
it "processes links" do
|
61
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
61
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
62
62
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
63
63
|
<preface><foreword>
|
64
64
|
<p>
|
@@ -92,7 +92,7 @@ RSpec.describe IsoDoc do
|
|
92
92
|
end
|
93
93
|
|
94
94
|
it "processes unrecognised markup" do
|
95
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
95
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
96
96
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
97
97
|
<preface><foreword>
|
98
98
|
<p>
|
@@ -118,7 +118,7 @@ RSpec.describe IsoDoc do
|
|
118
118
|
end
|
119
119
|
|
120
120
|
it "processes AsciiMath and MathML" do
|
121
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
121
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true).sub(/<html/, "<html xmlns:m='m'"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
122
122
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
123
123
|
<preface><foreword>
|
124
124
|
<p>
|
@@ -130,7 +130,7 @@ RSpec.describe IsoDoc do
|
|
130
130
|
<sections>
|
131
131
|
</iso-standard>
|
132
132
|
INPUT
|
133
|
-
#{HTML_HDR}
|
133
|
+
#{HTML_HDR.sub(/<html/, "<html xmlns:m='m'")}
|
134
134
|
<br/>
|
135
135
|
<div>
|
136
136
|
<h1 class="ForewordTitle">Foreword</h1>
|
@@ -150,7 +150,7 @@ RSpec.describe IsoDoc do
|
|
150
150
|
end
|
151
151
|
|
152
152
|
it "overrides AsciiMath delimiters" do
|
153
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
153
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
154
154
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
155
155
|
<preface><foreword>
|
156
156
|
<p>
|
@@ -178,7 +178,7 @@ RSpec.describe IsoDoc do
|
|
178
178
|
end
|
179
179
|
|
180
180
|
it "processes eref types" do
|
181
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
181
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
182
182
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
183
183
|
<preface><foreword>
|
184
184
|
<p>
|
@@ -222,7 +222,7 @@ RSpec.describe IsoDoc do
|
|
222
222
|
end
|
223
223
|
|
224
224
|
it "processes eref content" do
|
225
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
225
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
226
226
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
227
227
|
<preface><foreword>
|
228
228
|
<p>
|
data/spec/isodoc/lists_spec.rb
CHANGED
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
RSpec.describe IsoDoc do
|
4
4
|
it "processes unordered lists" do
|
5
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
5
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
6
6
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
7
7
|
<preface><foreword>
|
8
8
|
<ul id="_61961034-0fb1-436b-b281-828857a59ddb">
|
@@ -37,7 +37,7 @@ RSpec.describe IsoDoc do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "processes ordered lists" do
|
40
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
40
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
41
41
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
42
42
|
<preface><foreword>
|
43
43
|
<ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="alphabet">
|
@@ -86,7 +86,7 @@ RSpec.describe IsoDoc do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
it "processes Roman Upper ordered lists" do
|
89
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
89
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
90
90
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
91
91
|
<preface><foreword>
|
92
92
|
<ol id="_ae34a226-aab4-496d-987b-1aa7b6314026" type="roman_upper">
|
@@ -127,7 +127,7 @@ RSpec.describe IsoDoc do
|
|
127
127
|
end
|
128
128
|
|
129
129
|
it "processes definition lists" do
|
130
|
-
expect(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
130
|
+
expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
131
131
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
132
132
|
<preface><foreword>
|
133
133
|
<dl id="_732d3f57-4f88-40bf-9ae9-633891edc395">
|
@@ -176,7 +176,7 @@ RSpec.describe IsoDoc do
|
|
176
176
|
end
|
177
177
|
|
178
178
|
it "processes definition lists (Word)" do
|
179
|
-
expect(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true)).to be_equivalent_to <<~"OUTPUT"
|
179
|
+
expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
180
180
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
181
181
|
<preface><foreword>
|
182
182
|
<dl id="_732d3f57-4f88-40bf-9ae9-633891edc395">
|
@@ -208,7 +208,7 @@ RSpec.describe IsoDoc do
|
|
208
208
|
INPUT
|
209
209
|
word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
|
210
210
|
sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
|
211
|
-
expect(word).to be_equivalent_to <<~"OUTPUT"
|
211
|
+
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
212
212
|
<div class="WordSection2">
|
213
213
|
<p class="MsoNormal"><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
|
214
214
|
<div>
|
@@ -257,7 +257,7 @@ RSpec.describe IsoDoc do
|
|
257
257
|
INPUT
|
258
258
|
word = File.read("test.doc").sub(/^.*<div class="WordSection3">/m, '<div class="WordSection3">').
|
259
259
|
sub(%r{<div style="mso-element:footnote-list"/>.*$}m, "")
|
260
|
-
expect(word).to be_equivalent_to <<~"OUTPUT"
|
260
|
+
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
261
261
|
<div class="WordSection3">
|
262
262
|
<p class="zzSTDTitle1"></p>
|
263
263
|
<div><a name="_terms_and_definitions" id="_terms_and_definitions"></a><h1>1.<span style="mso-tab-count:1">  </span>Terms and definitions</h1>
|
@@ -320,7 +320,7 @@ ICAgICAgIDogRU5EIERPQyBJRAoKRklMRU5BTUU6IHRlc3QKCg==
|
|
320
320
|
INPUT
|
321
321
|
word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
|
322
322
|
sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
|
323
|
-
expect(word.gsub(/_Toc\d\d+/, "_Toc")).to be_equivalent_to <<~'OUTPUT'
|
323
|
+
expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc"))).to be_equivalent_to xmlpp(<<~'OUTPUT')
|
324
324
|
<div class="WordSection2">
|
325
325
|
/* an empty word intro page */
|
326
326
|
|
@@ -402,7 +402,7 @@ ICAgICAgIDogRU5EIERPQyBJRAoKRklMRU5BTUU6IHRlc3QKCg==
|
|
402
402
|
INPUT
|
403
403
|
word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
|
404
404
|
sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
|
405
|
-
expect(word.gsub(/_Toc\d\d+/, "_Toc")).to be_equivalent_to <<~'OUTPUT'
|
405
|
+
expect(xmlpp(word.gsub(/_Toc\d\d+/, "_Toc"))).to be_equivalent_to xmlpp(<<~'OUTPUT')
|
406
406
|
<div class="WordSection2">
|
407
407
|
/* an empty word intro page */
|
408
408
|
|
@@ -512,10 +512,10 @@ TOCLEVEL
|
|
512
512
|
</sections>
|
513
513
|
</iso-standard>
|
514
514
|
INPUT
|
515
|
-
html = File.read("test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
|
515
|
+
html = File.read("test.html").sub(/^.*<main class="main-section">/m, '<main xmlns:epub="epub" class="main-section">').
|
516
516
|
sub(%r{</main>.*$}m, "</main>")
|
517
|
-
expect(html).to be_equivalent_to <<~"OUTPUT"
|
518
|
-
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
517
|
+
expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
518
|
+
<main xmlns:epub="epub" class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
519
519
|
<p class="zzSTDTitle1"></p>
|
520
520
|
<div>
|
521
521
|
<h1>1.  Clause 4</h1>
|
@@ -563,7 +563,7 @@ TOCLEVEL
|
|
563
563
|
html = File.read("test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
|
564
564
|
sub(%r{</main>.*$}m, "</main>")
|
565
565
|
expect(`ls test_htmlimages`).to match(/\.png$/)
|
566
|
-
expect(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")).to be_equivalent_to <<~"OUTPUT"
|
566
|
+
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
567
567
|
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
568
568
|
<br />
|
569
569
|
<div>
|
@@ -599,7 +599,7 @@ TOCLEVEL
|
|
599
599
|
html = File.read("spec/test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
|
600
600
|
sub(%r{</main>.*$}m, "</main>")
|
601
601
|
expect(`ls test_htmlimages`).to match(/\.png$/)
|
602
|
-
expect(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png")).to be_equivalent_to <<~"OUTPUT"
|
602
|
+
expect(xmlpp(html.gsub(/\/[0-9a-f-]+\.png/, "/_.png"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
603
603
|
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
604
604
|
<br />
|
605
605
|
<div>
|
@@ -631,7 +631,7 @@ TOCLEVEL
|
|
631
631
|
INPUT
|
632
632
|
html = File.read("test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
|
633
633
|
sub(%r{</main>.*$}m, "</main>")
|
634
|
-
expect(html.gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"})).to be_equivalent_to <<~"OUTPUT"
|
634
|
+
expect(xmlpp(html.gsub(%r{src="data:image/png;base64,[^"]+"}, %{src="data:image/png;base64,_"}))).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
635
635
|
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
636
636
|
<br />
|
637
637
|
<div>
|
@@ -770,10 +770,10 @@ TOCLEVEL
|
|
770
770
|
</foreword></preface>
|
771
771
|
</iso-standard>
|
772
772
|
INPUT
|
773
|
-
word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
|
773
|
+
word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">').
|
774
774
|
sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
|
775
|
-
expect(word).to be_equivalent_to <<~"OUTPUT"
|
776
|
-
<div class="WordSection2">
|
775
|
+
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
776
|
+
<div class="WordSection2" xmlns:m="m">
|
777
777
|
<p class="MsoNormal">
|
778
778
|
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
779
779
|
</p>
|
@@ -818,7 +818,7 @@ TOCLEVEL
|
|
818
818
|
INPUT
|
819
819
|
html = File.read("test.html").sub(/^.*<main class="main-section">/m, '<main class="main-section">').
|
820
820
|
sub(%r{</main>.*$}m, "</main>")
|
821
|
-
expect(html).to be_equivalent_to <<~"OUTPUT"
|
821
|
+
expect(xmlpp(html)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
822
822
|
<main class="main-section"><button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>
|
823
823
|
<br />
|
824
824
|
<div>
|
@@ -846,7 +846,7 @@ TOCLEVEL
|
|
846
846
|
INPUT
|
847
847
|
word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
|
848
848
|
sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
|
849
|
-
expect(word).to be_equivalent_to <<~"OUTPUT"
|
849
|
+
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
850
850
|
<div class="WordSection2">
|
851
851
|
<p class="MsoNormal">
|
852
852
|
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
@@ -875,7 +875,7 @@ TOCLEVEL
|
|
875
875
|
INPUT
|
876
876
|
word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
|
877
877
|
sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "")
|
878
|
-
expect(word).to be_equivalent_to <<~"OUTPUT"
|
878
|
+
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
879
879
|
<div class="WordSection2">
|
880
880
|
<p class="MsoNormal">
|
881
881
|
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
@@ -907,7 +907,7 @@ FileUtils.rm_f "test.doc"
|
|
907
907
|
word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
|
908
908
|
sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "").
|
909
909
|
sub(/src="[^"]+"/, 'src="_"')
|
910
|
-
expect(word).to be_equivalent_to <<~"OUTPUT"
|
910
|
+
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
911
911
|
<div class="WordSection2">
|
912
912
|
<p class="MsoNormal">
|
913
913
|
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
@@ -932,7 +932,7 @@ FileUtils.rm_f "test.doc"
|
|
932
932
|
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
933
933
|
<preface><foreword>
|
934
934
|
<table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
|
935
|
-
<td rowspan="2"
|
935
|
+
<td rowspan="2">
|
936
936
|
<p id="_c47d9b39-adb2-431d-9320-78cb148fdb56">Output wavelength <stem type="MathML"><math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mo>(</mo><mi>μ</mi><mi>m</mi><mo>)</mo></mrow></math></stem></p>
|
937
937
|
</td>
|
938
938
|
<th colspan="3" align="left">Predictive wavelengths</th>
|
@@ -942,11 +942,11 @@ FileUtils.rm_f "test.doc"
|
|
942
942
|
</preface>
|
943
943
|
</iso-standard>
|
944
944
|
INPUT
|
945
|
-
word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2">').
|
945
|
+
word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">').
|
946
946
|
sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "").
|
947
947
|
sub(/src="[^"]+"/, 'src="_"')
|
948
|
-
expect(word).to be_equivalent_to <<~"OUTPUT"
|
949
|
-
<div class="WordSection2">
|
948
|
+
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
949
|
+
<div class="WordSection2" xmlns:m="m">
|
950
950
|
<p class="MsoNormal">
|
951
951
|
<br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
|
952
952
|
</p>
|
@@ -957,7 +957,7 @@ word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="
|
|
957
957
|
<table class="MsoISOTable" style="mso-table-lspace:15.0cm;margin-left:423.0pt;mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-bspace:14.2pt;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;"><a name="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7"></a>
|
958
958
|
<thead>
|
959
959
|
<tr>
|
960
|
-
<td rowspan="2"
|
960
|
+
<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;">
|
961
961
|
<p class="MsoNormal"><a name="_c47d9b39-adb2-431d-9320-78cb148fdb56" id="_c47d9b39-adb2-431d-9320-78cb148fdb56"></a>Output wavelength <span class="stem"><m:oMath>
|
962
962
|
|
963
963
|
<m:r><m:t>(μm)</m:t></m:r>
|
@@ -979,5 +979,64 @@ word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="
|
|
979
979
|
OUTPUT
|
980
980
|
end
|
981
981
|
|
982
|
+
it "propagates alignment of table cells (Word)" do
|
983
|
+
FileUtils.rm_f "test.doc"
|
984
|
+
FileUtils.rm_f "test.html"
|
985
|
+
IsoDoc::WordConvert.new({wordstylesheet: "spec/assets/word.css", htmlstylesheet: "spec/assets/html.css"}).convert("test", <<~"INPUT", false)
|
986
|
+
<iso-standard xmlns="http://riboseinc.com/isoxml">
|
987
|
+
<preface><foreword>
|
988
|
+
<table id="_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7" unnumbered="true"><thead><tr>
|
989
|
+
<td rowspan="2" align="left">
|
990
|
+
<p id="_c47d9b39-adb2-431d-9320-78cb148fdb56">Output wavelength</p>
|
991
|
+
<p id="_c47d9b39-adb2-431d-9320-78cb148fdb57">Output wavelength</p>
|
992
|
+
</td>
|
993
|
+
<th colspan="3" align="right"><p id="_c47d9b39-adb2-431d-9320-78cb148fdb58">Predictive wavelengths</p></th>
|
994
|
+
</tr>
|
995
|
+
</thead>
|
996
|
+
</table>
|
997
|
+
</preface>
|
998
|
+
</iso-standard>
|
999
|
+
INPUT
|
1000
|
+
word = File.read("test.doc").sub(/^.*<div class="WordSection2">/m, '<div class="WordSection2" xmlns:m="m">').
|
1001
|
+
sub(%r{<p class="MsoNormal">\s*<br clear="all" class="section"/>\s*</p>\s*<div class="WordSection3">.*$}m, "").
|
1002
|
+
sub(/src="[^"]+"/, 'src="_"')
|
1003
|
+
expect(xmlpp(word)).to be_equivalent_to xmlpp(<<~"OUTPUT")
|
1004
|
+
<div class='WordSection2' xmlns:m='m'>
|
1005
|
+
<p class='MsoNormal'>
|
1006
|
+
<br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
|
1007
|
+
</p>
|
1008
|
+
<div>
|
1009
|
+
<h1 class='ForewordTitle'>Foreword</h1>
|
1010
|
+
<p class='TableTitle' style='text-align:center;font-size:0pt;'> </p>
|
1011
|
+
<div align='center'>
|
1012
|
+
<table class='MsoISOTable' style='mso-table-lspace:15.0cm;margin-left:423.0pt;mso-table-rspace:15.0cm;margin-right:423.0pt;mso-table-bspace:14.2pt;mso-table-anchor-vertical:paragraph;mso-table-anchor-horizontal:column;mso-table-overlap:never;border-spacing:0;border-width:1px;'>
|
1013
|
+
<a name='_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7' id='_fe12b8f8-6858-4cd6-af7d-d4b6f3ebd1a7'/>
|
1014
|
+
<thead>
|
1015
|
+
<tr>
|
1016
|
+
<td rowspan='2' align='left' 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;'>
|
1017
|
+
<p style='text-align: left' class='MsoNormal'>
|
1018
|
+
<a name='_c47d9b39-adb2-431d-9320-78cb148fdb56' id='_c47d9b39-adb2-431d-9320-78cb148fdb56'/>
|
1019
|
+
Output wavelength
|
1020
|
+
</p>
|
1021
|
+
<p style='text-align: left' class='MsoNormal'>
|
1022
|
+
<a name='_c47d9b39-adb2-431d-9320-78cb148fdb57' id='_c47d9b39-adb2-431d-9320-78cb148fdb57'/>
|
1023
|
+
Output wavelength
|
1024
|
+
</p>
|
1025
|
+
</td>
|
1026
|
+
<th colspan='3' align='right' 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;'>
|
1027
|
+
<p style='text-align: right' class='MsoNormal'>
|
1028
|
+
<a name='_c47d9b39-adb2-431d-9320-78cb148fdb58' id='_c47d9b39-adb2-431d-9320-78cb148fdb58'/>
|
1029
|
+
Predictive wavelengths
|
1030
|
+
</p>
|
1031
|
+
</th>
|
1032
|
+
</tr>
|
1033
|
+
</thead>
|
1034
|
+
</table>
|
1035
|
+
</div>
|
1036
|
+
</div>
|
1037
|
+
<p class='MsoNormal'> </p>
|
1038
|
+
</div>
|
1039
|
+
OUTPUT
|
1040
|
+
end
|
982
1041
|
|
983
1042
|
end
|