isodoc 1.5.3 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +1 -1
  3. data/.rubocop.yml +6 -4
  4. data/Gemfile +2 -2
  5. data/bin/rspec +1 -2
  6. data/isodoc.gemspec +11 -11
  7. data/lib/isodoc-yaml/i18n-ar.yaml +152 -0
  8. data/lib/isodoc-yaml/i18n-de.yaml +149 -0
  9. data/lib/isodoc-yaml/i18n-es.yaml +151 -0
  10. data/lib/isodoc-yaml/i18n-ru.yaml +154 -0
  11. data/lib/isodoc/base_style/all.css +7 -0
  12. data/lib/isodoc/base_style/metanorma_word.css +7 -0
  13. data/lib/isodoc/base_style/metanorma_word.scss +8 -0
  14. data/lib/isodoc/base_style/reset.css +7 -0
  15. data/lib/isodoc/base_style/reset.scss +9 -0
  16. data/lib/isodoc/base_style/scripts.html +187 -0
  17. data/lib/isodoc/class_utils.rb +6 -5
  18. data/lib/isodoc/common.rb +2 -0
  19. data/lib/isodoc/convert.rb +30 -17
  20. data/lib/isodoc/css.rb +42 -28
  21. data/lib/isodoc/function/blocks.rb +25 -4
  22. data/lib/isodoc/function/blocks_example_note.rb +2 -2
  23. data/lib/isodoc/function/cleanup.rb +1 -2
  24. data/lib/isodoc/function/form.rb +51 -0
  25. data/lib/isodoc/function/inline.rb +32 -10
  26. data/lib/isodoc/function/references.rb +55 -42
  27. data/lib/isodoc/function/table.rb +1 -0
  28. data/lib/isodoc/function/to_word_html.rb +29 -27
  29. data/lib/isodoc/function/utils.rb +41 -38
  30. data/lib/isodoc/gem_tasks.rb +30 -31
  31. data/lib/isodoc/html_convert.rb +6 -4
  32. data/lib/isodoc/html_function/form.rb +62 -0
  33. data/lib/isodoc/html_function/postprocess.rb +35 -76
  34. data/lib/isodoc/html_function/postprocess_footnotes.rb +59 -0
  35. data/lib/isodoc/i18n.rb +33 -31
  36. data/lib/isodoc/pdf_convert.rb +1 -3
  37. data/lib/isodoc/presentation_function/block.rb +26 -11
  38. data/lib/isodoc/presentation_function/inline.rb +60 -111
  39. data/lib/isodoc/presentation_function/math.rb +84 -0
  40. data/lib/isodoc/presentation_xml_convert.rb +2 -1
  41. data/lib/isodoc/version.rb +1 -1
  42. data/lib/isodoc/word_function/body.rb +28 -24
  43. data/lib/isodoc/word_function/footnotes.rb +22 -15
  44. data/lib/isodoc/word_function/inline.rb +6 -0
  45. data/lib/isodoc/word_function/postprocess.rb +16 -6
  46. data/lib/isodoc/xref.rb +10 -11
  47. data/lib/isodoc/xref/xref_counter.rb +31 -15
  48. data/lib/isodoc/xref/xref_gen.rb +28 -22
  49. data/lib/isodoc/xref/xref_sect_gen.rb +22 -20
  50. data/lib/isodoc/xslfo_convert.rb +36 -25
  51. data/spec/assets/html_override.css +1 -0
  52. data/spec/assets/word_override.css +1 -0
  53. data/spec/isodoc/blocks_spec.rb +2599 -2503
  54. data/spec/isodoc/cleanup_spec.rb +1107 -1109
  55. data/spec/isodoc/footnotes_spec.rb +1 -16
  56. data/spec/isodoc/form_spec.rb +156 -0
  57. data/spec/isodoc/i18n_spec.rb +984 -972
  58. data/spec/isodoc/inline_spec.rb +984 -920
  59. data/spec/isodoc/lists_spec.rb +316 -315
  60. data/spec/isodoc/postproc_spec.rb +1692 -1538
  61. data/spec/isodoc/presentation_xml_spec.rb +345 -338
  62. data/spec/isodoc/ref_spec.rb +718 -723
  63. data/spec/isodoc/section_spec.rb +910 -902
  64. data/spec/isodoc/table_spec.rb +566 -556
  65. data/spec/isodoc/terms_spec.rb +252 -256
  66. data/spec/isodoc/xref_spec.rb +3040 -2985
  67. data/spec/isodoc/xslfo_convert_spec.rb +39 -0
  68. data/spec/spec_helper.rb +30 -29
  69. metadata +80 -69
  70. data/.rubocop.ribose.yml +0 -65
  71. data/.rubocop.tb.yml +0 -650
@@ -4,1186 +4,1184 @@ require "nokogiri"
4
4
  RSpec.describe IsoDoc do
5
5
  it "cleans up admonitions" do
6
6
  expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
7
- <html>
8
- <body>
9
- <div class="Admonition">
10
- <title>Warning</title>
11
- <p>Text</p>
12
- </div>
13
- </body>
14
- </html>
7
+ <html>
8
+ <body>
9
+ <div class="Admonition">
10
+ <title>Warning</title>
11
+ <p>Text</p>
12
+ </div>
13
+ </body>
14
+ </html>
15
15
  INPUT
16
- <?xml version="1.0"?>
17
- <html>
18
- <body>
19
- <div class="Admonition">
16
+ <?xml version="1.0"?>
17
+ <html>
18
+ <body>
19
+ <div class="Admonition">
20
20
 
21
- <p>Warning&#x2014;Text</p>
22
- </div>
23
- </body>
24
- </html>
21
+ <p>Warning&#x2014;Text</p>
22
+ </div>
23
+ </body>
24
+ </html>
25
25
  OUTPUT
26
26
  end
27
27
 
28
28
  it "cleans up figures" do
29
29
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
30
- <html xmlns:epub="http://www.idpf.org/2007/ops">
31
- <body>
32
- <div class="figure">
33
- <p>Warning</p>
34
- <a href="#tableD-1a" class="TableFootnoteRef">a</a><aside><div id="ftntableD-1a"><span><span id="tableD-1a" class="TableFootnoteRef">a</span>&#160; </span>
35
- <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
36
- </div></aside>
37
- </div>
38
- </body>
39
- </html>
30
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
31
+ <body>
32
+ <div class="figure">
33
+ <p>Warning</p>
34
+ <a href="#tableD-1a" class="TableFootnoteRef">a</a><aside><div id="ftntableD-1a"><span><span id="tableD-1a" class="TableFootnoteRef">a</span>&#160; </span>
35
+ <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
36
+ </div></aside>
37
+ </div>
38
+ </body>
39
+ </html>
40
40
  INPUT
41
- <?xml version="1.0"?>
42
- <html xmlns:epub="http://www.idpf.org/2007/ops">
43
- <body>
44
- <div class="figure">
45
- <p>Warning</p>
46
- <aside><div id="ftntableD-1a">
41
+ <?xml version="1.0"?>
42
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
43
+ <body>
44
+ <div class="figure">
45
+ <p>Warning</p>
46
+ <aside><div id="ftntableD-1a">
47
47
 
48
- </div></aside>
49
- <p><b>Key</b></p><dl><dt><span><span id="tableD-1a" class="TableFootnoteRef">a</span>&#xA0; </span></dt><dd><p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p></dd></dl></div>
50
- </body>
51
- </html>
48
+ </div></aside>
49
+ <p><b>Key</b></p><dl><dt><span><span id="tableD-1a" class="TableFootnoteRef">a</span>&#xA0; </span></dt><dd><p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p></dd></dl></div>
50
+ </body>
51
+ </html>
52
52
  OUTPUT
53
53
  end
54
54
 
55
- it "cleans up figures (Word)" do
55
+ it "cleans up figures (Word)" do
56
56
  expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
57
- <html xmlns:epub="http://www.idpf.org/2007/ops">
58
- <body>
59
- <div class="figure">
60
- <p>Warning</p>
61
- <a href="#tableD-1a" class="TableFootnoteRef">a</a><aside><div id="ftntableD-1a"><span><span id="tableD-1a" class="TableFootnoteRef">a</span><span style="mso-tab-count:1">&#160; </span></span>
62
- <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
63
- </div></aside>
64
- </div>
65
- </body>
66
- </html>
57
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
58
+ <body>
59
+ <div class="figure">
60
+ <p>Warning</p>
61
+ <a href="#tableD-1a" class="TableFootnoteRef">a</a><aside><div id="ftntableD-1a"><span><span id="tableD-1a" class="TableFootnoteRef">a</span><span style="mso-tab-count:1">&#160; </span></span>
62
+ <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
63
+ </div></aside>
64
+ </div>
65
+ </body>
66
+ </html>
67
67
  INPUT
68
- <?xml version="1.0"?>
69
- <html xmlns:epub="http://www.idpf.org/2007/ops">
70
- <body>
71
- <div class="figure">
72
- <p>Warning</p>
73
- <aside><div id="ftntableD-1a">
68
+ <?xml version="1.0"?>
69
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
70
+ <body>
71
+ <div class="figure">
72
+ <p>Warning</p>
73
+ <aside><div id="ftntableD-1a">
74
74
 
75
- </div></aside>
76
- <p><b>Key</b></p><table class="dl"><tr><td valign="top" align="left"><span><span id="tableD-1a" class="TableFootnoteRef">a</span><span style="mso-tab-count:1">&#xA0; </span></span></td><td valign="top"><p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p></td></tr></table></div>
77
- </body>
78
- </html>
75
+ </div></aside>
76
+ <p><b>Key</b></p><table class="dl"><tr><td valign="top" align="left"><span><span id="tableD-1a" class="TableFootnoteRef">a</span><span style="mso-tab-count:1">&#xA0; </span></span></td><td valign="top"><p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p></td></tr></table></div>
77
+ </body>
78
+ </html>
79
79
  OUTPUT
80
80
  end
81
81
 
82
82
  it "cleans up inline headers" do
83
83
  expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
84
- <html xmlns:epub="http://www.idpf.org/2007/ops">
85
- <head>
86
- <title>test</title>
87
- <body lang="EN-US" link="blue" vlink="#954F72">
88
- <div class="WordSection1">
89
- <p>&#160;</p>
90
- </div>
91
- <br clear="all" class="section"/>
92
- <div class="WordSection2">
93
- <p>&#160;</p>
94
- </div>
95
- <br clear="all" class="section"/>
96
- <div class="WordSection3">
97
- <p class="zzSTDTitle1"/>
98
- <div id="M">
99
- <h1>4.<span style="mso-tab-count:1">&#160; </span>Clause 4</h1>
100
- <div id="N">
101
- <h2>4.1. Introduction</h2>
102
- </div>
103
- <div id="O">
104
- <span class="zzMoveToFollowing"><b>4.2. Clause 4.2 </b></span>
105
- </div>
106
- <div id="P">
107
- <span class="zzMoveToFollowing"><b>4.3. Clause 4.3 </b></span>
108
- <p>text</p>
109
- </div>
110
- </div>
111
- </div>
112
- </body>
113
- </head>
114
- </html>
115
- INPUT
116
- <?xml version="1.0"?>
117
- <html xmlns:epub="http://www.idpf.org/2007/ops">
118
- <head>
119
- <title>test</title>
120
- <body lang="EN-US" link="blue" vlink="#954F72">
121
- <div class="WordSection1">
122
- <p>&#xA0;</p>
123
- </div>
124
- <br clear="all" class="section"/>
125
- <div class="WordSection2">
126
- <p>&#xA0;</p>
127
- </div>
128
- <br clear="all" class="section"/>
129
- <div class="WordSection3">
130
- <p class="zzSTDTitle1"/>
131
- <div id="M">
132
- <h1>4.<span style="mso-tab-count:1">&#xA0; </span>Clause 4</h1>
133
- <div id="N">
134
- <h2>4.1. Introduction</h2>
135
- </div>
136
- <div id="O">
137
- <p><b>4.2. Clause 4.2 </b></p>
138
- </div>
139
- <div id="P">
84
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
85
+ <head>
86
+ <title>test</title>
87
+ <body lang="EN-US" link="blue" vlink="#954F72">
88
+ <div class="WordSection1">
89
+ <p>&#160;</p>
90
+ </div>
91
+ <br clear="all" class="section"/>
92
+ <div class="WordSection2">
93
+ <p>&#160;</p>
94
+ </div>
95
+ <br clear="all" class="section"/>
96
+ <div class="WordSection3">
97
+ <p class="zzSTDTitle1"/>
98
+ <div id="M">
99
+ <h1>4.<span style="mso-tab-count:1">&#160; </span>Clause 4</h1>
100
+ <div id="N">
101
+ <h2>4.1. Introduction</h2>
102
+ </div>
103
+ <div id="O">
104
+ <span class="zzMoveToFollowing"><b>4.2. Clause 4.2 </b></span>
105
+ </div>
106
+ <div id="P">
107
+ <span class="zzMoveToFollowing"><b>4.3. Clause 4.3 </b></span>
108
+ <p>text</p>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </body>
113
+ </head>
114
+ </html>
115
+ INPUT
116
+ <?xml version="1.0"?>
117
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
118
+ <head>
119
+ <title>test</title>
120
+ <body lang="EN-US" link="blue" vlink="#954F72">
121
+ <div class="WordSection1">
122
+ <p>&#xA0;</p>
123
+ </div>
124
+ <br clear="all" class="section"/>
125
+ <div class="WordSection2">
126
+ <p>&#xA0;</p>
127
+ </div>
128
+ <br clear="all" class="section"/>
129
+ <div class="WordSection3">
130
+ <p class="zzSTDTitle1"/>
131
+ <div id="M">
132
+ <h1>4.<span style="mso-tab-count:1">&#xA0; </span>Clause 4</h1>
133
+ <div id="N">
134
+ <h2>4.1. Introduction</h2>
135
+ </div>
136
+ <div id="O">
137
+ <p><b>4.2. Clause 4.2 </b></p>
138
+ </div>
139
+ <div id="P">
140
140
 
141
- <p><span><b>4.3. Clause 4.3 </b></span>text</p>
142
- </div>
143
- </div>
144
- </div>
145
- </body>
146
- </head>
147
- </html>
141
+ <p><span><b>4.3. Clause 4.3 </b></span>text</p>
142
+ </div>
143
+ </div>
144
+ </div>
145
+ </body>
146
+ </head>
147
+ </html>
148
148
  OUTPUT
149
149
  end
150
150
 
151
151
  it "cleans up footnotes" do
152
152
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
153
- #{HTML_HDR}
154
- <br/>
155
- <div>
156
- <h1 class="ForewordTitle">Foreword</h1>
157
- <p>A.<a class="FootnoteRef" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
158
- <p>B.<a class="FootnoteRef" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
159
- <p>C.<a class="FootnoteRef" href="#fn:1" epub:type="footnote"><sup>1</sup></a></p>
160
- </div>
161
- <p class="zzSTDTitle1"/>
162
- <aside id="fn:2" class="footnote">
163
- <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Formerly denoted as 15 % (m/m).</p>
164
- </aside>
165
- <aside id="fn:1" class="footnote">
166
- <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Hello! denoted as 15 % (m/m).</p>
167
- </aside>
168
- </div>
169
- </body>
170
- </html>
171
- INPUT
172
- #{HTML_HDR}
173
- <br/>
174
- <div>
175
- <h1 class="ForewordTitle">Foreword</h1>
176
- <p>A.<a class="FootnoteRef" href="#fn:2" epub:type="footnote"><sup>1</sup></a></p>
177
- <p>B.<a class="FootnoteRef" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
178
- <p>C.<a class="FootnoteRef" href="#fn:1" epub:type="footnote"><sup>3</sup></a></p>
179
- </div>
180
- <p class="zzSTDTitle1"/>
181
- <aside id="fn:2" class="footnote">
182
- <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Formerly denoted as 15 % (m/m).</p>
183
- </aside>
184
- <aside id="fn:1" class="footnote">
185
- <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Hello! denoted as 15 % (m/m).</p>
186
- </aside>
187
- </div>
188
- </body>
189
- </html>
190
- OUTPUT
191
- end
192
-
193
- it "cleans up footnotes (Word)" do
194
- expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
195
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
196
- <head/>
197
- <body lang="EN-US" link="blue" vlink="#954F72">
198
- <div class="WordSection1">
199
- <p>&#160;</p>
200
- </div>
201
- <p><br clear="all" class="section"/></p>
202
- <div class="WordSection2">
203
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
204
- <div>
205
- <h1 class="ForewordTitle">Foreword</h1>
206
- <p>A.<a href="#ftn1" epub:type="footnote"><sup>1</sup></a></p>
207
- <p>B.<a href="#ftn2" epub:type="footnote"><sup>2</sup></a></p>
208
- <p>C.<a href="#ftn3" epub:type="footnote"><sup>3</sup></a></p>
209
- </div>
210
- <p>&#160;</p>
211
- </div>
212
- <p><br clear="all" class="section"/></p>
213
- <div class="WordSection3">
214
- <p class="zzSTDTitle1"/>
215
- <aside id="ftn1">
216
- <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Formerly denoted as 15 % (m/m).</p>
217
- </aside>
218
- <aside id="ftn2">
219
- <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Formerly denoted as 15 % (m/m).</p>
220
- </aside>
221
- <aside id="ftn3">
222
- <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Hello! denoted as 15 % (m/m).</p>
223
- </aside>
224
- </div>
225
- </body>
226
- </html>
227
- INPUT
228
- <?xml version="1.0"?>
229
- <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
230
- <head/>
231
- <body lang="EN-US" link="blue" vlink="#954F72">
232
- <div class="WordSection1">
233
- <p>&#xA0;</p>
234
- </div>
235
- <p><br clear="all" class="section"/></p>
236
- <div class="WordSection2">
237
- <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
153
+ #{HTML_HDR}
154
+ <br/>
238
155
  <div>
239
156
  <h1 class="ForewordTitle">Foreword</h1>
240
- <p>A.<a href="#ftn1" epub:type="footnote"><sup>1</sup></a></p>
241
- <p>B.<a href="#ftn2" epub:type="footnote"><sup>2</sup></a></p>
242
- <p>C.<a href="#ftn3" epub:type="footnote"><sup>3</sup></a></p>
157
+ <p>A.<a class="FootnoteRef" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
158
+ <p>B.<a class="FootnoteRef" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
159
+ <p>C.<a class="FootnoteRef" href="#fn:1" epub:type="footnote"><sup>1</sup></a></p>
243
160
  </div>
244
- <p>&#xA0;</p>
161
+ <p class="zzSTDTitle1"/>
162
+ <aside id="fn:2" class="footnote">
163
+ <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Formerly denoted as 15 % (m/m).</p>
164
+ </aside>
165
+ <aside id="fn:1" class="footnote">
166
+ <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Hello! denoted as 15 % (m/m).</p>
167
+ </aside>
245
168
  </div>
246
- <p><br clear="all" class="section"/></p>
247
- <div class="WordSection3">
169
+ </body>
170
+ </html>
171
+ INPUT
172
+ #{HTML_HDR}
173
+ <br/>
174
+ <div>
175
+ <h1 class="ForewordTitle">Foreword</h1>
176
+ <p>A.<a class="FootnoteRef" href="#fn:2" epub:type="footnote"><sup>1</sup></a></p>
177
+ <p>B.<a class="FootnoteRef" href="#fn:2" epub:type="footnote"><sup>2</sup></a></p>
178
+ <p>C.<a class="FootnoteRef" href="#fn:1" epub:type="footnote"><sup>3</sup></a></p>
179
+ </div>
248
180
  <p class="zzSTDTitle1"/>
249
- <aside id="ftn1">
250
- <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Formerly denoted as 15 % (m/m).</p>
251
- </aside>
252
- <aside id="ftn2">
253
- <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Formerly denoted as 15 % (m/m).</p>
254
- </aside>
255
- <aside id="ftn3">
256
- <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Hello! denoted as 15 % (m/m).</p>
257
- </aside>
181
+ <aside id="fn:2" class="footnote">
182
+ <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Formerly denoted as 15 % (m/m).</p>
183
+ </aside>
184
+ <aside id="fn:1" class="footnote">
185
+ <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Hello! denoted as 15 % (m/m).</p>
186
+ </aside>
258
187
  </div>
259
188
  </body>
260
189
  </html>
261
- OUTPUT
190
+ OUTPUT
262
191
  end
263
192
 
264
- it "cleans up tables with tfoot" do
265
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
266
- <html xmlns:epub="http://www.idpf.org/2007/ops">
267
- <head>
268
- <title>test</title>
269
- <body lang="EN-US" link="blue" vlink="#954F72">
270
- <div class="WordSection1">
271
- <p>&#160;</p>
272
- </div>
273
- <br clear="all" class="section"/>
274
- <div class="WordSection2">
275
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
276
- <div>
277
- <h1 class="ForewordTitle">Foreword</h1>
278
- <p class="TableTitle" align="center">
279
- <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
280
- </p>
281
- <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
282
- <thead>
283
- <tr>
284
- <td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
285
- <td colspan="4" align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
286
- </tr>
287
- <tr>
288
- <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Arborio</td>
289
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Drago<a href="#tableD-1a" class="TableFootnoteRef">a</a><aside><div id="ftntableD-1a"><span><span id="tableD-1a" class="TableFootnoteRef">a</span>&#160; </span>
290
- <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
291
- </div></aside></td>
292
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Balilla<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
293
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Thaibonnet</td>
294
- </tr>
295
- </thead>
296
- <tbody>
297
- <tr>
298
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Number of laboratories retained after eliminating outliers</td>
299
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
300
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">11</td>
301
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
302
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
303
- </tr>
304
- <tr>
305
- <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Mean value, g/100 g</td>
306
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,2</td>
307
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">82,0</td>
308
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,8</td>
309
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">77,7</td>
310
- </tr>
311
- </tbody>
312
- <tfoot>
313
- <tr>
314
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Reproducibility limit, <span class="stem">(#(R)#)</span> (= 2,83 <span class="stem">(#(s_R)#)</span>)</td>
315
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">2,89</td>
316
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">0,57</td>
317
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">2,26</td>
318
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">6,06</td>
319
- </tr>
320
- </tfoot>
321
- <dl>
322
- <dt>
323
- <p>Drago</p>
324
- </dt>
325
- <dd>A type of rice</dd>
326
- </dl>
327
- <div id="" class="Note">
328
- <p class="Note">NOTE<span style="mso-tab-count:1">&#160; </span>This is a table about rice</p>
329
- </div>
330
- </table>
331
- </div>
332
- <p>&#160;</p>
333
- </div>
334
- <br clear="all" class="section"/>
335
- <div class="WordSection3">
336
- <p class="zzSTDTitle1"/>
337
- </div>
338
- </body>
339
- </head>
340
- </html>
341
- INPUT
342
- <?xml version="1.0"?>
343
- <html xmlns:epub="http://www.idpf.org/2007/ops">
344
- <head>
345
- <title>test</title>
193
+ it "cleans up footnotes (Word)" do
194
+ expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
195
+ <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
196
+ <head/>
346
197
  <body lang="EN-US" link="blue" vlink="#954F72">
347
198
  <div class="WordSection1">
348
- <p>&#xA0;</p>
199
+ <p>&#160;</p>
349
200
  </div>
350
- <br clear="all" class="section"/>
201
+ <p><br clear="all" class="section"/></p>
351
202
  <div class="WordSection2">
352
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
203
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
353
204
  <div>
354
205
  <h1 class="ForewordTitle">Foreword</h1>
355
- <p class="TableTitle" align="center">
356
- <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
357
- </p>
358
- <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
359
- <thead>
360
- <tr>
361
- <td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
362
- <td colspan="4" align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
363
- </tr>
364
- <tr>
365
- <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Arborio</td>
366
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Drago<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
367
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Balilla<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
368
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Thaibonnet</td>
369
- </tr>
370
- </thead>
371
- <tbody>
372
- <tr>
373
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Number of laboratories retained after eliminating outliers</td>
374
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
375
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">11</td>
376
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
377
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
378
- </tr>
379
- <tr>
380
- <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Mean value, g/100 g</td>
381
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,2</td>
382
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">82,0</td>
383
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,8</td>
384
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">77,7</td>
385
- </tr>
386
- </tbody>
387
- <tfoot>
388
- <tr>
389
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">Reproducibility limit, <span class="stem">(#(R)#)</span> (= 2,83 <span class="stem">(#(s_R)#)</span>)</td>
390
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">2,89</td>
391
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">0,57</td>
392
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">2,26</td>
393
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">6,06</td>
394
- </tr>
395
- <tr><td colspan="5" style="border-top:0pt;border-bottom:solid windowtext 1.5pt;"><div id="" class="Note">
396
- <p class="Note">NOTE<span style="mso-tab-count:1">&#xA0; </span>This is a table about rice</p>
397
- </div><div class="TableFootnote"><div id="ftntableD-1a">
398
- <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55" class="TableFootnote"><span><span id="tableD-1a" class="TableFootnoteRef">a</span>&#xA0; </span>Parboiled rice.</p>
399
- </div></div></td></tr></tfoot>
400
- <dl>
401
- <dt>
402
- <p>Drago</p>
403
- </dt>
404
- <dd>A type of rice</dd>
405
- </dl>
406
-
407
- </table>
206
+ <p>A.<a href="#ftn1" epub:type="footnote"><sup>1</sup></a></p>
207
+ <p>B.<a href="#ftn2" epub:type="footnote"><sup>2</sup></a></p>
208
+ <p>C.<a href="#ftn3" epub:type="footnote"><sup>3</sup></a></p>
408
209
  </div>
409
- <p>&#xA0;</p>
210
+ <p>&#160;</p>
410
211
  </div>
411
- <br clear="all" class="section"/>
212
+ <p><br clear="all" class="section"/></p>
412
213
  <div class="WordSection3">
413
214
  <p class="zzSTDTitle1"/>
215
+ <aside id="ftn1">
216
+ <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Formerly denoted as 15 % (m/m).</p>
217
+ </aside>
218
+ <aside id="ftn2">
219
+ <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Formerly denoted as 15 % (m/m).</p>
220
+ </aside>
221
+ <aside id="ftn3">
222
+ <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Hello! denoted as 15 % (m/m).</p>
223
+ </aside>
414
224
  </div>
415
225
  </body>
416
- </head>
417
226
  </html>
227
+ INPUT
228
+ <?xml version="1.0"?>
229
+ <html xmlns:epub="http://www.idpf.org/2007/ops" lang="en">
230
+ <head/>
231
+ <body lang="EN-US" link="blue" vlink="#954F72">
232
+ <div class="WordSection1">
233
+ <p>&#xA0;</p>
234
+ </div>
235
+ <p><br clear="all" class="section"/></p>
236
+ <div class="WordSection2">
237
+ <p><br clear="all" style="mso-special-character:line-break;page-break-before:always"/></p>
238
+ <div>
239
+ <h1 class="ForewordTitle">Foreword</h1>
240
+ <p>A.<a href="#ftn1" epub:type="footnote"><sup>1</sup></a></p>
241
+ <p>B.<a href="#ftn2" epub:type="footnote"><sup>2</sup></a></p>
242
+ <p>C.<a href="#ftn3" epub:type="footnote"><sup>3</sup></a></p>
243
+ </div>
244
+ <p>&#xA0;</p>
245
+ </div>
246
+ <p><br clear="all" class="section"/></p>
247
+ <div class="WordSection3">
248
+ <p class="zzSTDTitle1"/>
249
+ <aside id="ftn1">
250
+ <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Formerly denoted as 15 % (m/m).</p>
251
+ </aside>
252
+ <aside id="ftn2">
253
+ <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Formerly denoted as 15 % (m/m).</p>
254
+ </aside>
255
+ <aside id="ftn3">
256
+ <p id="_1e228e29-baef-4f38-b048-b05a051747e4">Hello! denoted as 15 % (m/m).</p>
257
+ </aside>
258
+ </div>
259
+ </body>
260
+ </html>
261
+ OUTPUT
262
+ end
263
+
264
+ it "cleans up tables with tfoot" do
265
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
266
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
267
+ <head>
268
+ <title>test</title>
269
+ <body lang="EN-US" link="blue" vlink="#954F72">
270
+ <div class="WordSection1">
271
+ <p>&#160;</p>
272
+ </div>
273
+ <br clear="all" class="section"/>
274
+ <div class="WordSection2">
275
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
276
+ <div>
277
+ <h1 class="ForewordTitle">Foreword</h1>
278
+ <p class="TableTitle" align="center">
279
+ <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
280
+ </p>
281
+ <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
282
+ <thead>
283
+ <tr>
284
+ <td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
285
+ <td colspan="4" align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
286
+ </tr>
287
+ <tr>
288
+ <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Arborio</td>
289
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Drago<a href="#tableD-1a" class="TableFootnoteRef">a</a><aside><div id="ftntableD-1a"><span><span id="tableD-1a" class="TableFootnoteRef">a</span>&#160; </span>
290
+ <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
291
+ </div></aside></td>
292
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Balilla<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
293
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Thaibonnet</td>
294
+ </tr>
295
+ </thead>
296
+ <tbody>
297
+ <tr>
298
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Number of laboratories retained after eliminating outliers</td>
299
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
300
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">11</td>
301
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
302
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
303
+ </tr>
304
+ <tr>
305
+ <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Mean value, g/100 g</td>
306
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,2</td>
307
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">82,0</td>
308
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,8</td>
309
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">77,7</td>
310
+ </tr>
311
+ </tbody>
312
+ <tfoot>
313
+ <tr>
314
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Reproducibility limit, <span class="stem">(#(R)#)</span> (= 2,83 <span class="stem">(#(s_R)#)</span>)</td>
315
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">2,89</td>
316
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">0,57</td>
317
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">2,26</td>
318
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">6,06</td>
319
+ </tr>
320
+ </tfoot>
321
+ <dl>
322
+ <dt>
323
+ <p>Drago</p>
324
+ </dt>
325
+ <dd>A type of rice</dd>
326
+ </dl>
327
+ <div id="" class="Note">
328
+ <p class="Note">NOTE<span style="mso-tab-count:1">&#160; </span>This is a table about rice</p>
329
+ </div>
330
+ </table>
331
+ </div>
332
+ <p>&#160;</p>
333
+ </div>
334
+ <br clear="all" class="section"/>
335
+ <div class="WordSection3">
336
+ <p class="zzSTDTitle1"/>
337
+ </div>
338
+ </body>
339
+ </head>
340
+ </html>
341
+ INPUT
342
+ <?xml version="1.0"?>
343
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
344
+ <head>
345
+ <title>test</title>
346
+ <body lang="EN-US" link="blue" vlink="#954F72">
347
+ <div class="WordSection1">
348
+ <p>&#xA0;</p>
349
+ </div>
350
+ <br clear="all" class="section"/>
351
+ <div class="WordSection2">
352
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
353
+ <div>
354
+ <h1 class="ForewordTitle">Foreword</h1>
355
+ <p class="TableTitle" align="center">
356
+ <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
357
+ </p>
358
+ <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
359
+ <thead>
360
+ <tr>
361
+ <td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
362
+ <td colspan="4" align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
363
+ </tr>
364
+ <tr>
365
+ <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Arborio</td>
366
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Drago<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
367
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Balilla<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
368
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Thaibonnet</td>
369
+ </tr>
370
+ </thead>
371
+ <tbody>
372
+ <tr>
373
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Number of laboratories retained after eliminating outliers</td>
374
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
375
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">11</td>
376
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
377
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
378
+ </tr>
379
+ <tr>
380
+ <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Mean value, g/100 g</td>
381
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,2</td>
382
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">82,0</td>
383
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,8</td>
384
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">77,7</td>
385
+ </tr>
386
+ </tbody>
387
+ <tfoot>
388
+ <tr>
389
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">Reproducibility limit, <span class="stem">(#(R)#)</span> (= 2,83 <span class="stem">(#(s_R)#)</span>)</td>
390
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">2,89</td>
391
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">0,57</td>
392
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">2,26</td>
393
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">6,06</td>
394
+ </tr>
395
+ <tr><td colspan="5" style="border-top:0pt;border-bottom:solid windowtext 1.5pt;"><div id="" class="Note">
396
+ <p class="Note">NOTE<span style="mso-tab-count:1">&#xA0; </span>This is a table about rice</p>
397
+ </div><div class="TableFootnote"><div id="ftntableD-1a">
398
+ <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55" class="TableFootnote"><span><span id="tableD-1a" class="TableFootnoteRef">a</span>&#xA0; </span>Parboiled rice.</p>
399
+ </div></div></td></tr></tfoot>
400
+ <dl>
401
+ <dt>
402
+ <p>Drago</p>
403
+ </dt>
404
+ <dd>A type of rice</dd>
405
+ </dl>
406
+
407
+ </table>
408
+ </div>
409
+ <p>&#xA0;</p>
410
+ </div>
411
+ <br clear="all" class="section"/>
412
+ <div class="WordSection3">
413
+ <p class="zzSTDTitle1"/>
414
+ </div>
415
+ </body>
416
+ </head>
417
+ </html>
418
418
  OUTPUT
419
419
  end
420
420
 
421
421
  it "cleans up tables with tfoot (Word)" do
422
422
  expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
423
- <html xmlns:epub="http://www.idpf.org/2007/ops">
424
- <head>
425
- <title>test</title>
426
- <body lang="EN-US" link="blue" vlink="#954F72">
427
- <div class="WordSection1">
428
- <p>&#160;</p>
429
- </div>
430
- <br clear="all" class="section"/>
431
- <div class="WordSection2">
432
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
433
- <div>
434
- <h1 class="ForewordTitle">Foreword</h1>
435
- <p class="TableTitle" align="center">
436
- <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
437
- </p>
438
- <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
439
- <thead>
440
- <tr>
441
- <td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
442
- <td colspan="4" align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
443
- </tr>
444
- <tr>
445
- <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Arborio</td>
446
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Drago<a href="#tableD-1a" class="TableFootnoteRef">a</a><aside><div id="ftntableD-1a"><span><span id="tableD-1a" class="TableFootnoteRef">a</span><span style="mso-tab-count:1">&#160; </span></span>
447
- <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
448
- </div></aside></td>
449
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Balilla<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
450
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Thaibonnet</td>
451
- </tr>
452
- </thead>
453
- <tbody>
454
- <tr>
455
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Number of laboratories retained after eliminating outliers</td>
456
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
457
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">11</td>
458
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
459
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
460
- </tr>
461
- <tr>
462
- <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Mean value, g/100 g</td>
463
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,2</td>
464
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">82,0</td>
465
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,8</td>
466
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">77,7</td>
467
- </tr>
468
- </tbody>
469
- <tfoot>
470
- <tr>
471
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Reproducibility limit, <span class="stem">(#(R)#)</span> (= 2,83 <span class="stem">(#(s_R)#)</span>)</td>
472
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">2,89</td>
473
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">0,57</td>
474
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">2,26</td>
475
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">6,06</td>
476
- </tr>
477
- </tfoot>
478
- <dl>
479
- <dt>
480
- <p>Drago</p>
481
- </dt>
482
- <dd>A type of rice</dd>
483
- </dl>
484
- <div id="" class="Note">
485
- <p class="Note">NOTE<span style="mso-tab-count:1">&#160; </span>This is a table about rice</p>
486
- </div>
487
- </table>
488
- </div>
489
- <p>&#160;</p>
490
- </div>
491
- <br clear="all" class="section"/>
492
- <div class="WordSection3">
493
- <p class="zzSTDTitle1"/>
494
- </div>
495
- </body>
496
- </head>
497
- </html>
498
- INPUT
499
- <?xml version="1.0"?>
500
- <html xmlns:epub="http://www.idpf.org/2007/ops">
501
- <head>
502
- <title>test</title>
503
- <body lang="EN-US" link="blue" vlink="#954F72">
504
- <div class="WordSection1">
505
- <p>&#xA0;</p>
423
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
424
+ <head>
425
+ <title>test</title>
426
+ <body lang="EN-US" link="blue" vlink="#954F72">
427
+ <div class="WordSection1">
428
+ <p>&#160;</p>
429
+ </div>
430
+ <br clear="all" class="section"/>
431
+ <div class="WordSection2">
432
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
433
+ <div>
434
+ <h1 class="ForewordTitle">Foreword</h1>
435
+ <p class="TableTitle" align="center">
436
+ <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
437
+ </p>
438
+ <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
439
+ <thead>
440
+ <tr>
441
+ <td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
442
+ <td colspan="4" align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
443
+ </tr>
444
+ <tr>
445
+ <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Arborio</td>
446
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Drago<a href="#tableD-1a" class="TableFootnoteRef">a</a><aside><div id="ftntableD-1a"><span><span id="tableD-1a" class="TableFootnoteRef">a</span><span style="mso-tab-count:1">&#160; </span></span>
447
+ <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
448
+ </div></aside></td>
449
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Balilla<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
450
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Thaibonnet</td>
451
+ </tr>
452
+ </thead>
453
+ <tbody>
454
+ <tr>
455
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Number of laboratories retained after eliminating outliers</td>
456
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
457
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">11</td>
458
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
459
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
460
+ </tr>
461
+ <tr>
462
+ <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Mean value, g/100 g</td>
463
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,2</td>
464
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">82,0</td>
465
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,8</td>
466
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">77,7</td>
467
+ </tr>
468
+ </tbody>
469
+ <tfoot>
470
+ <tr>
471
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Reproducibility limit, <span class="stem">(#(R)#)</span> (= 2,83 <span class="stem">(#(s_R)#)</span>)</td>
472
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">2,89</td>
473
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">0,57</td>
474
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">2,26</td>
475
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">6,06</td>
476
+ </tr>
477
+ </tfoot>
478
+ <dl>
479
+ <dt>
480
+ <p>Drago</p>
481
+ </dt>
482
+ <dd>A type of rice</dd>
483
+ </dl>
484
+ <div id="" class="Note">
485
+ <p class="Note">NOTE<span style="mso-tab-count:1">&#160; </span>This is a table about rice</p>
486
+ </div>
487
+ </table>
506
488
  </div>
507
- <br clear="all" class="section"/>
508
- <div class="WordSection2">
509
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
510
- <div>
511
- <h1 class="ForewordTitle">Foreword</h1>
512
- <p class="TableTitle" align="center">
513
- <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
514
- </p>
515
- <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
516
- <thead>
517
- <tr>
518
- <td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
519
- <td colspan="4" align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
520
- </tr>
521
- <tr>
522
- <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Arborio</td>
523
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Drago<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
524
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Balilla<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
525
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Thaibonnet</td>
526
- </tr>
489
+ <p>&#160;</p>
490
+ </div>
491
+ <br clear="all" class="section"/>
492
+ <div class="WordSection3">
493
+ <p class="zzSTDTitle1"/>
494
+ </div>
495
+ </body>
496
+ </head>
497
+ </html>
498
+ INPUT
499
+ <?xml version="1.0"?>
500
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
501
+ <head>
502
+ <title>test</title>
503
+ <body lang="EN-US" link="blue" vlink="#954F72">
504
+ <div class="WordSection1">
505
+ <p>&#xA0;</p>
506
+ </div>
507
+ <br clear="all" class="section"/>
508
+ <div class="WordSection2">
509
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
510
+ <div>
511
+ <h1 class="ForewordTitle">Foreword</h1>
512
+ <p class="TableTitle" align="center">
513
+ <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
514
+ </p>
515
+ <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
516
+ <thead>
517
+ <tr>
518
+ <td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
519
+ <td colspan="4" align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
520
+ </tr>
521
+ <tr>
522
+ <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Arborio</td>
523
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Drago<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
524
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Balilla<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
525
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Thaibonnet</td>
526
+ </tr>
527
+ </thead>
528
+ <tbody>
529
+ <tr>
530
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Number of laboratories retained after eliminating outliers</td>
531
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
532
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">11</td>
533
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
534
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
535
+ </tr>
536
+ <tr>
537
+ <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Mean value, g/100 g</td>
538
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,2</td>
539
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">82,0</td>
540
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,8</td>
541
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">77,7</td>
542
+ </tr>
543
+ </tbody>
544
+ <tfoot>
545
+ <tr>
546
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">Reproducibility limit, <span class="stem">(#(R)#)</span> (= 2,83 <span class="stem">(#(s_R)#)</span>)</td>
547
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">2,89</td>
548
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">0,57</td>
549
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">2,26</td>
550
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">6,06</td>
551
+ </tr>
552
+ <tr><td colspan="5" style="border-top:0pt;mso-border-top-alt:0pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;"><div id="" class="Note">
553
+ <p class="Note">NOTE<span style="mso-tab-count:1">&#xA0; </span>This is a table about rice</p>
554
+ </div><div class="TableFootnote"><div id="ftntableD-1a">
555
+ <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55" class="TableFootnote"><span><span id="tableD-1a" class="TableFootnoteRef">a</span><span style="mso-tab-count:1">&#xA0; </span></span>Parboiled rice.</p>
556
+ </div></div></td></tr></tfoot>
557
+ <dl>
558
+ <dt>
559
+ <p>Drago</p>
560
+ </dt>
561
+ <dd>A type of rice</dd>
562
+ </dl>
563
+
564
+ </table>
565
+ </div>
566
+ <p>&#xA0;</p>
567
+ </div>
568
+ <br clear="all" class="section"/>
569
+ <div class="WordSection3">
570
+ <p class="zzSTDTitle1"/>
571
+ </div>
572
+ </body>
573
+ </head>
574
+ </html>
575
+ OUTPUT
576
+ end
577
+
578
+ it "cleans up tables without tfoot" do
579
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
580
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
581
+ <head>
582
+ <title>test</title>
583
+ <body lang="EN-US" link="blue" vlink="#954F72">
584
+ <div class="WordSection1">
585
+ <p>&#160;</p>
586
+ </div>
587
+ <br clear="all" class="section"/>
588
+ <div class="WordSection2">
589
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
590
+ <div>
591
+ <h1 class="ForewordTitle">Foreword</h1>
592
+ <p class="TableTitle" align="center">
593
+ <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
594
+ </p>
595
+ <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
596
+ <thead>
597
+ <tr>
598
+ <td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
599
+ <td colspan="4" align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
600
+ </tr>
601
+ <tr>
602
+ <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Arborio</td>
603
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Drago<a href="#tableD-1a" class="TableFootnoteRef">a</a><aside><div id="ftntableD-1a"><span><span id="tableD-1a" class="TableFootnoteRef">a</span>&#160; </span>
604
+ <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
605
+ </div></aside></td>
606
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Balilla<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
607
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Thaibonnet</td>
608
+ </tr>
609
+ </thead>
610
+ <tbody>
611
+ <tr>
612
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Number of laboratories retained after eliminating outliers</td>
613
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
614
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">11</td>
615
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
616
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
617
+ </tr>
618
+ <tr>
619
+ <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Mean value, g/100 g</td>
620
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,2</td>
621
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">82,0</td>
622
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,8</td>
623
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">77,7</td>
624
+ </tr>
625
+ </tbody>
626
+ <dl>
627
+ <dt>
628
+ <p>Drago</p>
629
+ </dt>
630
+ <dd>A type of rice</dd>
631
+ </dl>
632
+ <div id="" class="Note">
633
+ <p class="Note">NOTE<span style="mso-tab-count:1">&#160; </span>This is a table about rice</p>
634
+ </div>
635
+ </table>
636
+ </div>
637
+ <p>&#160;</p>
638
+ </div>
639
+ <br clear="all" class="section"/>
640
+ <div class="WordSection3">
641
+ <p class="zzSTDTitle1"/>
642
+ </div>
643
+ </body>
644
+ </head>
645
+ </html>
646
+ INPUT
647
+ <?xml version="1.0"?>
648
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
649
+ <head>
650
+ <title>test</title>
651
+ <body lang="EN-US" link="blue" vlink="#954F72">
652
+ <div class="WordSection1">
653
+ <p>&#xA0;</p>
654
+ </div>
655
+ <br clear="all" class="section"/>
656
+ <div class="WordSection2">
657
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
658
+ <div>
659
+ <h1 class="ForewordTitle">Foreword</h1>
660
+ <p class="TableTitle" align="center">
661
+ <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
662
+ </p>
663
+ <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
664
+ <thead>
665
+ <tr>
666
+ <td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
667
+ <td colspan="4" align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
668
+ </tr>
669
+ <tr>
670
+ <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Arborio</td>
671
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Drago<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
672
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Balilla<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
673
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Thaibonnet</td>
674
+ </tr>
675
+ </thead>
676
+ <tbody>
677
+ <tr>
678
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Number of laboratories retained after eliminating outliers</td>
679
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
680
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">11</td>
681
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
682
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
683
+ </tr>
684
+ <tr>
685
+ <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Mean value, g/100 g</td>
686
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,2</td>
687
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">82,0</td>
688
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,8</td>
689
+ <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">77,7</td>
690
+ </tr>
691
+ </tbody>
692
+ <dl>
693
+ <dt>
694
+ <p>Drago</p>
695
+ </dt>
696
+ <dd>A type of rice</dd>
697
+ </dl>
698
+
699
+ <tfoot><tr><td colspan="5" style="border-top:0pt;border-bottom:solid windowtext 1.5pt;"><div id="" class="Note">
700
+ <p class="Note">NOTE<span style="mso-tab-count:1">&#xA0; </span>This is a table about rice</p>
701
+ </div><div class="TableFootnote"><div id="ftntableD-1a">
702
+ <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55" class="TableFootnote"><span><span id="tableD-1a" class="TableFootnoteRef">a</span>&#xA0; </span>Parboiled rice.</p>
703
+ </div></div></td></tr></tfoot></table>
704
+ </div>
705
+ <p>&#xA0;</p>
706
+ </div>
707
+ <br clear="all" class="section"/>
708
+ <div class="WordSection3">
709
+ <p class="zzSTDTitle1"/>
710
+ </div>
711
+ </body>
712
+ </head>
713
+ </html>
714
+ OUTPUT
715
+ end
716
+
717
+ it "does not break up very long strings in tables by default" do
718
+ expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
719
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
720
+ <head>
721
+ <title>test</title>
722
+ <body lang="EN-US" link="blue" vlink="#954F72">
723
+ <div class="WordSection1">
724
+ <p>&#160;</p>
725
+ </div>
726
+ <br clear="all" class="section"/>
727
+ <div class="WordSection2">
728
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
729
+ <div>
730
+ <h1 class="ForewordTitle">Foreword</h1>
731
+ <p class="TableTitle" align="center">
732
+ <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
733
+ </p>
734
+ <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
735
+ <thead>
736
+ <tr>
737
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
738
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
739
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
740
+ </tr>
741
+ </thead>
742
+ <tbody>
743
+ <tr>
744
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
745
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
746
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
747
+ </tr>
748
+ </tbody>
749
+ </table>
750
+ </div>
751
+ </div>
752
+ </body>
753
+ </html>
754
+ INPUT
755
+ <?xml version='1.0'?>
756
+ <html xmlns:epub='http://www.idpf.org/2007/ops'>
757
+ <head>
758
+ <title>test</title>
759
+ <body lang='EN-US' link='blue' vlink='#954F72'>
760
+ <div class='WordSection1'>
761
+ <p>&#xA0;</p>
762
+ </div>
763
+ <br clear='all' class='section'/>
764
+ <div class='WordSection2'>
765
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
766
+ <div>
767
+ <h1 class='ForewordTitle'>Foreword</h1>
768
+ <p class='TableTitle' align='center'>
769
+ <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
770
+ </p>
771
+ <table id='tableD-1' class='MsoISOTable' border='1' cellspacing='0' cellpadding='0'>
772
+ <thead>
773
+ <tr>
774
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
775
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
776
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
777
+ </tr>
527
778
  </thead>
528
779
  <tbody>
529
780
  <tr>
530
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Number of laboratories retained after eliminating outliers</td>
531
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
532
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">11</td>
533
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
534
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
781
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
782
+ http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
783
+ </td>
784
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
785
+ http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB </td>
786
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
787
+ www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
788
+ </td>
535
789
  </tr>
790
+ </tbody>
791
+ </table>
792
+ </div>
793
+ </div>
794
+ </body>
795
+ </head>
796
+ </html>
797
+ OUTPUT
798
+ end
799
+
800
+ it "does not break up very long strings in tables on request in HTML" do
801
+ expect(xmlpp(IsoDoc::HtmlConvert.new({ break_up_urls_in_tables: "true" }).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
802
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
803
+ <head>
804
+ <title>test</title>
805
+ <body lang="EN-US" link="blue" vlink="#954F72">
806
+ <div class="WordSection1">
807
+ <p>&#160;</p>
808
+ </div>
809
+ <br clear="all" class="section"/>
810
+ <div class="WordSection2">
811
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
812
+ <div>
813
+ <h1 class="ForewordTitle">Foreword</h1>
814
+ <p class="TableTitle" align="center">
815
+ <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
816
+ </p>
817
+ <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
818
+ <thead>
819
+ <tr>
820
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
821
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
822
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
823
+ </tr>
824
+ </thead>
825
+ <tbody>
826
+ <tr>
827
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
828
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
829
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
830
+ </tr>
831
+ </tbody>
832
+ </table>
833
+ </div>
834
+ </div>
835
+ </body>
836
+ </html>
837
+ INPUT
838
+ <?xml version='1.0'?>
839
+ <html xmlns:epub='http://www.idpf.org/2007/ops'>
840
+ <head>
841
+ <title>test</title>
842
+ <body lang='EN-US' link='blue' vlink='#954F72'>
843
+ <div class='WordSection1'>
844
+ <p>&#xA0;</p>
845
+ </div>
846
+ <br clear='all' class='section'/>
847
+ <div class='WordSection2'>
848
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
849
+ <div>
850
+ <h1 class='ForewordTitle'>Foreword</h1>
851
+ <p class='TableTitle' align='center'>
852
+ <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
853
+ </p>
854
+ <table id='tableD-1' class='MsoISOTable' border='1' cellspacing='0' cellpadding='0'>
855
+ <thead>
856
+ <tr>
857
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
858
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
859
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
860
+ </tr>
861
+ </thead>
862
+ <tbody>
536
863
  <tr>
537
- <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Mean value, g/100 g</td>
538
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,2</td>
539
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">82,0</td>
540
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,8</td>
541
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">77,7</td>
864
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
865
+ http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
866
+ </td>
867
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
868
+ http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
869
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
870
+ www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
871
+ </td>
542
872
  </tr>
543
873
  </tbody>
544
- <tfoot>
874
+ </table>
875
+ </div>
876
+ </div>
877
+ </body>
878
+ </head>
879
+ </html>
880
+ OUTPUT
881
+ end
882
+
883
+ it "does not break up very long strings in tables by default (Word)" do
884
+ expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
885
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
886
+ <head>
887
+ <title>test</title>
888
+ <body lang="EN-US" link="blue" vlink="#954F72">
889
+ <div class="WordSection1">
890
+ <p>&#160;</p>
891
+ </div>
892
+ <br clear="all" class="section"/>
893
+ <div class="WordSection2">
894
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
895
+ <div>
896
+ <h1 class="ForewordTitle">Foreword</h1>
897
+ <p class="TableTitle" align="center">
898
+ <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
899
+ </p>
900
+ <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
901
+ <thead>
902
+ <tr>
903
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
904
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
905
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
906
+ </tr>
907
+ </thead>
908
+ <tbody>
909
+ <tr>
910
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
911
+ http://www.example.com/&amp;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
912
+ </td>
913
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
914
+ http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
915
+ </td>
916
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
917
+ www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
918
+ </td>
919
+ </tr>
920
+ </tbody>
921
+ </table>
922
+ </div>
923
+ </div>
924
+ </body>
925
+ </html>
926
+ INPUT
927
+ <?xml version='1.0'?>
928
+ <html xmlns:epub='http://www.idpf.org/2007/ops'>
929
+ <head>
930
+ <title>test</title>
931
+ <body lang='EN-US' link='blue' vlink='#954F72'>
932
+ <div class='WordSection1'>
933
+ <p>&#xA0;</p>
934
+ </div>
935
+ <br clear='all' class='section'/>
936
+ <div class='WordSection2'>
937
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
938
+ <div>
939
+ <h1 class='ForewordTitle'>Foreword</h1>
940
+ <p class='TableTitle' align='center'>
941
+ <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
942
+ </p>
943
+ <table id='tableD-1' class='MsoISOTable' border='1' cellspacing='0' cellpadding='0'>
944
+ <thead>
945
+ <tr>
946
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
947
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
948
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
949
+ </tr>
950
+ </thead>
951
+ <tbody>
545
952
  <tr>
546
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">Reproducibility limit, <span class="stem">(#(R)#)</span> (= 2,83 <span class="stem">(#(s_R)#)</span>)</td>
547
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">2,89</td>
548
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">0,57</td>
549
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">2,26</td>
550
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:0pt;">6,06</td>
953
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
954
+ http://www.example.com/&amp;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
955
+ </td>
956
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
957
+ http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
958
+ </td>
959
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
960
+ www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
961
+ </td>
551
962
  </tr>
552
- <tr><td colspan="5" style="border-top:0pt;mso-border-top-alt:0pt;border-bottom:solid windowtext 1.5pt;mso-border-bottom-alt:solid windowtext 1.5pt;"><div id="" class="Note">
553
- <p class="Note">NOTE<span style="mso-tab-count:1">&#xA0; </span>This is a table about rice</p>
554
- </div><div class="TableFootnote"><div id="ftntableD-1a">
555
- <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55" class="TableFootnote"><span><span id="tableD-1a" class="TableFootnoteRef">a</span><span style="mso-tab-count:1">&#xA0; </span></span>Parboiled rice.</p>
556
- </div></div></td></tr></tfoot>
557
- <dl>
558
- <dt>
559
- <p>Drago</p>
560
- </dt>
561
- <dd>A type of rice</dd>
562
- </dl>
963
+ </tbody>
964
+ </table>
965
+ </div>
966
+ </div>
967
+ </body>
968
+ </head>
969
+ </html>
970
+ OUTPUT
971
+ end
563
972
 
973
+ it "breaks up very long strings in tables on request (Word)" do
974
+ expect(xmlpp(IsoDoc::WordConvert.new({ break_up_urls_in_tables: "true" }).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
975
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
976
+ <head>
977
+ <title>test</title>
978
+ <body lang="EN-US" link="blue" vlink="#954F72">
979
+ <div class="WordSection1">
980
+ <p>&#160;</p>
981
+ </div>
982
+ <br clear="all" class="section"/>
983
+ <div class="WordSection2">
984
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
985
+ <div>
986
+ <h1 class="ForewordTitle">Foreword</h1>
987
+ <p class="TableTitle" align="center">
988
+ <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
989
+ </p>
990
+ <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
991
+ <thead>
992
+ <tr>
993
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
994
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
995
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
996
+ </tr>
997
+ </thead>
998
+ <tbody>
999
+ <tr>
1000
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
1001
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
1002
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
1003
+ </tr>
1004
+ </tbody>
564
1005
  </table>
565
- </div>
566
- <p>&#xA0;</p>
567
- </div>
568
- <br clear="all" class="section"/>
569
- <div class="WordSection3">
570
- <p class="zzSTDTitle1"/>
1006
+ </div>
1007
+ </div>
1008
+ </body>
1009
+ </html>
1010
+ INPUT
1011
+ <?xml version='1.0'?>
1012
+ <html xmlns:epub='http://www.idpf.org/2007/ops'>
1013
+ <head>
1014
+ <title>test</title>
1015
+ <body lang='EN-US' link='blue' vlink='#954F72'>
1016
+ <div class='WordSection1'>
1017
+ <p>&#xA0;</p>
1018
+ </div>
1019
+ <br clear='all' class='section'/>
1020
+ <div class='WordSection2'>
1021
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
1022
+ <div>
1023
+ <h1 class='ForewordTitle'>Foreword</h1>
1024
+ <p class='TableTitle' align='center'>
1025
+ <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
1026
+ </p>
1027
+ <table id='tableD-1' class='MsoISOTable' border='1' cellspacing='0' cellpadding='0'>
1028
+ <thead>
1029
+ <tr>
1030
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
1031
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
1032
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
1033
+ </tr>
1034
+ </thead>
1035
+ <tbody>
1036
+ <tr>
1037
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
1038
+ http://www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAA/ BBBBBBBBBBBBBBBBBBBBBBBBBBBB
1039
+ </td>
1040
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
1041
+ http://www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAABBBBBBBBBBBBBBBBBBBBBB BBBBBB
1042
+ </td>
1043
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
1044
+ www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
1045
+ </td>
1046
+ </tr>
1047
+ </tbody>
1048
+ </table>
571
1049
  </div>
572
- </body>
573
- </head>
574
- </html>
1050
+ </div>
1051
+ </body>
1052
+ </head>
1053
+ </html>
575
1054
  OUTPUT
576
1055
  end
577
1056
 
578
-
579
- it "cleans up tables without tfoot" do
580
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
581
- <html xmlns:epub="http://www.idpf.org/2007/ops">
582
- <head>
583
- <title>test</title>
584
- <body lang="EN-US" link="blue" vlink="#954F72">
585
- <div class="WordSection1">
586
- <p>&#160;</p>
587
- </div>
588
- <br clear="all" class="section"/>
589
- <div class="WordSection2">
590
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
591
- <div>
592
- <h1 class="ForewordTitle">Foreword</h1>
593
- <p class="TableTitle" align="center">
594
- <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
595
- </p>
596
- <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
597
- <thead>
598
- <tr>
599
- <td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
600
- <td colspan="4" align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
601
- </tr>
602
- <tr>
603
- <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Arborio</td>
604
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Drago<a href="#tableD-1a" class="TableFootnoteRef">a</a><aside><div id="ftntableD-1a"><span><span id="tableD-1a" class="TableFootnoteRef">a</span>&#160; </span>
605
- <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55">Parboiled rice.</p>
606
- </div></aside></td>
607
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Balilla<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
608
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Thaibonnet</td>
609
- </tr>
610
- </thead>
611
- <tbody>
612
- <tr>
613
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Number of laboratories retained after eliminating outliers</td>
614
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
615
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">11</td>
616
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
617
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
618
- </tr>
619
- <tr>
620
- <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Mean value, g/100 g</td>
621
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,2</td>
622
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">82,0</td>
623
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,8</td>
624
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">77,7</td>
625
- </tr>
626
- </tbody>
627
- <dl>
628
- <dt>
629
- <p>Drago</p>
630
- </dt>
631
- <dd>A type of rice</dd>
632
- </dl>
633
- <div id="" class="Note">
634
- <p class="Note">NOTE<span style="mso-tab-count:1">&#160; </span>This is a table about rice</p>
1057
+ it "cleans up term sources" do
1058
+ c = IsoDoc::HtmlConvert.new({ i18nyaml: "spec/assets/i18n.yaml" })
1059
+ c.i18n_init("en", "Latn")
1060
+ expect(xmlpp(c.textcleanup(<<~"INPUT").to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
1061
+ #{HTML_HDR}
1062
+ <p class="zzSTDTitle1"/>
1063
+ <div id="_terms_and_definitions"><h1>1.&#160; Terms and Definitions</h1><p>For the purposes of this document,
1064
+ the following terms and definitions apply.</p>
1065
+ <p class="TermNum" id="paddy1">1.1.</p><p class="Terms" style="text-align:left;">paddy</p>
1066
+ #{' '}
1067
+ <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">&lt;rice&gt; rice retaining its husk after threshing</p>
1068
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p class="example-title">EXAMPLE 1</p>
1069
+ <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
1070
+ <ul>
1071
+ <li>A</li>
1072
+ </ul>
635
1073
  </div>
636
- </table>
637
- </div>
638
- <p>&#160;</p>
639
- </div>
640
- <br clear="all" class="section"/>
641
- <div class="WordSection3">
642
- <p class="zzSTDTitle1"/>
643
- </div>
644
- </body>
645
- </head>
646
- </html>
647
- INPUT
648
- <?xml version="1.0"?>
649
- <html xmlns:epub="http://www.idpf.org/2007/ops">
650
- <head>
651
- <title>test</title>
652
- <body lang="EN-US" link="blue" vlink="#954F72">
653
- <div class="WordSection1">
654
- <p>&#xA0;</p>
655
- </div>
656
- <br clear="all" class="section"/>
657
- <div class="WordSection2">
658
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
659
- <div>
660
- <h1 class="ForewordTitle">Foreword</h1>
661
- <p class="TableTitle" align="center">
662
- <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
663
- </p>
664
- <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
665
- <thead>
666
- <tr>
667
- <td rowspan="2" align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
668
- <td colspan="4" align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
669
- </tr>
670
- <tr>
671
- <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Arborio</td>
672
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Drago<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
673
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Balilla<a href="#tableD-1a" class="TableFootnoteRef">a</a></td>
674
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Thaibonnet</td>
675
- </tr>
676
- </thead>
677
- <tbody>
678
- <tr>
679
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Number of laboratories retained after eliminating outliers</td>
680
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
681
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">11</td>
682
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
683
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">13</td>
684
- </tr>
685
- <tr>
686
- <td align="left" style="border-top:none;border-bottom:solid windowtext 1.5pt;">Mean value, g/100 g</td>
687
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,2</td>
688
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">82,0</td>
689
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">81,8</td>
690
- <td align="center" style="border-top:none;border-bottom:solid windowtext 1.5pt;">77,7</td>
691
- </tr>
692
- </tbody>
693
- <dl>
694
- <dt>
695
- <p>Drago</p>
696
- </dt>
697
- <dd>A type of rice</dd>
698
- </dl>
699
-
700
- <tfoot><tr><td colspan="5" style="border-top:0pt;border-bottom:solid windowtext 1.5pt;"><div id="" class="Note">
701
- <p class="Note">NOTE<span style="mso-tab-count:1">&#xA0; </span>This is a table about rice</p>
702
- </div><div class="TableFootnote"><div id="ftntableD-1a">
703
- <p id="_0fe65e9a-5531-408e-8295-eeff35f41a55" class="TableFootnote"><span><span id="tableD-1a" class="TableFootnoteRef">a</span>&#xA0; </span>Parboiled rice.</p>
704
- </div></div></td></tr></tfoot></table>
705
- </div>
706
- <p>&#xA0;</p>
707
- </div>
708
- <br clear="all" class="section"/>
709
- <div class="WordSection3">
710
- <p class="zzSTDTitle1"/>
711
- </div>
712
- </body>
713
- </head>
714
- </html>
1074
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><p class="example-title">EXAMPLE 2</p>
1075
+ <ul>
1076
+ <li>A</li>
1077
+ </ul>
1078
+ </div>
1079
+ #{' '}
1080
+ <p>[TERMREF]
1081
+ <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
1082
+ [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
1083
+ [/TERMREF]</p>
1084
+ <p>[TERMREF] Termbase IEV, term ID xyz [/TERMREF]</p>
1085
+ <p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION] [/TERMREF]</p>
1086
+ <p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION]with adjustments [/TERMREF]</p>
1087
+ <p class="TermNum" id="paddy">1.2.</p><p class="Terms" style="text-align:left;">paddy</p><p class="AltTerms" style="text-align:left;">paddy rice</p>
1088
+ <p class="AltTerms" style="text-align:left;">rough rice</p>
1089
+ <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
1090
+ <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
1091
+ <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p class="example-title">EXAMPLE</p>
1092
+ <ul>
1093
+ <li>A</li>
1094
+ </ul>
1095
+ </div>
1096
+ <div class="Note"><p>Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div>
1097
+ <div class="Note"><p>Note 2 to entry: <ul><li>A</li></ul><p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></p></div>
1098
+ <p>[TERMREF]
1099
+ <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
1100
+ [/TERMREF]</p></div>
1101
+ </div>
1102
+ </body>
1103
+ </html>
1104
+ INPUT
1105
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
1106
+ <head/>
1107
+ <body lang='en'>
1108
+ <div class='title-section'>
1109
+ <p>&#160;</p>
1110
+ </div>
1111
+ <br/>
1112
+ <div class='prefatory-section'>
1113
+ <p>&#160;</p>
1114
+ </div>
1115
+ <br/>
1116
+ <div class='main-section'>
1117
+ <p class='zzSTDTitle1'/>
1118
+ <div id='_terms_and_definitions'>
1119
+ <h1>1.&#160; Terms and Definitions</h1>
1120
+ <p>For the purposes of this document, the following terms and definitions apply.</p>
1121
+ <p class='TermNum' id='paddy1'>1.1.</p>
1122
+ <p class='Terms' style='text-align:left;'>paddy</p>
1123
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>&lt;rice&gt; rice retaining its husk after threshing</p>
1124
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f892' class='example'>
1125
+ <p class='example-title'>EXAMPLE 1</p>
1126
+ <p id='_65c9a509-9a89-4b54-a890-274126aeb55c'>Foreign seeds, husks, bran, sand, dust.</p>
1127
+ <ul>
1128
+ <li>A</li>
1129
+ </ul>
1130
+ </div>
1131
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f894' class='example'>
1132
+ <p class='example-title'>EXAMPLE 2</p>
1133
+ <ul>
1134
+ <li>A</li>
1135
+ </ul>
1136
+ </div>
1137
+ <p>
1138
+ [SOURCE:
1139
+ <a href='#ISO7301'>ISO 7301:2011, Clause 3.1</a>
1140
+ , modified &mdash; The term "cargo rice" is shown as deprecated, and
1141
+ Note 1 to entry is not included here; Termbase IEV, term ID xyz;
1142
+ Termbase IEV, term ID xyz, modified; Termbase IEV, term ID xyz,
1143
+ modified &mdash; with adjustments]
1144
+ </p>
1145
+ <p class='TermNum' id='paddy'>1.2.</p>
1146
+ <p class='Terms' style='text-align:left;'>paddy</p>
1147
+ <p class='AltTerms' style='text-align:left;'>paddy rice</p>
1148
+ <p class='AltTerms' style='text-align:left;'>rough rice</p>
1149
+ <p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: cargo rice</p>
1150
+ <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
1151
+ <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f893' class='example'>
1152
+ <p class='example-title'>EXAMPLE</p>
1153
+ <ul>
1154
+ <li>A</li>
1155
+ </ul>
1156
+ </div>
1157
+ <div class='Note'>
1158
+ <p>
1159
+ Note 1 to entry: The starch of waxy rice consists almost entirely of
1160
+ amylopectin. The kernels have a tendency to stick together after
1161
+ cooking.
1162
+ </p>
1163
+ </div>
1164
+ <div class='Note'>
1165
+ <p>
1166
+ Note 2 to entry:
1167
+ <ul>
1168
+ <li>A</li>
1169
+ </ul>
1170
+ <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
1171
+ The starch of waxy rice consists almost entirely of amylopectin.
1172
+ The kernels have a tendency to stick together after cooking.
1173
+ </p>
1174
+ </p>
1175
+ </div>
1176
+ <p>
1177
+ [SOURCE:
1178
+ <a href='#ISO7301'>ISO 7301:2011, Clause 3.1</a>
1179
+ ]
1180
+ </p>
1181
+ </div>
1182
+ </div>
1183
+ </body>
1184
+ </html>
715
1185
  OUTPUT
716
1186
  end
717
-
718
- it "does not break up very long strings in tables by default" do
719
- expect(xmlpp(IsoDoc::HtmlConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
720
- <html xmlns:epub="http://www.idpf.org/2007/ops">
721
- <head>
722
- <title>test</title>
723
- <body lang="EN-US" link="blue" vlink="#954F72">
724
- <div class="WordSection1">
725
- <p>&#160;</p>
726
- </div>
727
- <br clear="all" class="section"/>
728
- <div class="WordSection2">
729
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
730
- <div>
731
- <h1 class="ForewordTitle">Foreword</h1>
732
- <p class="TableTitle" align="center">
733
- <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
734
- </p>
735
- <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
736
- <thead>
737
- <tr>
738
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
739
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
740
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
741
- </tr>
742
- </thead>
743
- <tbody>
744
- <tr>
745
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
746
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
747
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
748
- </tr>
749
- </tbody>
750
- </table>
751
- </div>
752
- </div>
753
- </body>
754
- </html>
755
- INPUT
756
- <?xml version='1.0'?>
757
- <html xmlns:epub='http://www.idpf.org/2007/ops'>
758
- <head>
759
- <title>test</title>
760
- <body lang='EN-US' link='blue' vlink='#954F72'>
761
- <div class='WordSection1'>
762
- <p>&#xA0;</p>
763
- </div>
764
- <br clear='all' class='section'/>
765
- <div class='WordSection2'>
766
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
767
- <div>
768
- <h1 class='ForewordTitle'>Foreword</h1>
769
- <p class='TableTitle' align='center'>
770
- <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
771
- </p>
772
- <table id='tableD-1' class='MsoISOTable' border='1' cellspacing='0' cellpadding='0'>
773
- <thead>
774
- <tr>
775
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
776
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
777
- <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
778
- </tr>
779
- </thead>
780
- <tbody>
781
- <tr>
782
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
783
- http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
784
- </td>
785
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
786
- http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB </td>
787
- <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
788
- www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
789
- </td>
790
- </tr>
791
- </tbody>
792
- </table>
793
- </div>
794
- </div>
795
- </body>
796
- </head>
797
- </html>
798
- OUTPUT
799
- end
800
-
801
- it "does not break up very long strings in tables on request in HTML" do
802
- expect(xmlpp(IsoDoc::HtmlConvert.new({break_up_urls_in_tables: "true"}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
803
- <html xmlns:epub="http://www.idpf.org/2007/ops">
804
- <head>
805
- <title>test</title>
806
- <body lang="EN-US" link="blue" vlink="#954F72">
807
- <div class="WordSection1">
808
- <p>&#160;</p>
809
- </div>
810
- <br clear="all" class="section"/>
811
- <div class="WordSection2">
812
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
813
- <div>
814
- <h1 class="ForewordTitle">Foreword</h1>
815
- <p class="TableTitle" align="center">
816
- <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
817
- </p>
818
- <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
819
- <thead>
820
- <tr>
821
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
822
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
823
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
824
- </tr>
825
- </thead>
826
- <tbody>
827
- <tr>
828
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
829
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
830
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
831
- </tr>
832
- </tbody>
833
- </table>
834
- </div>
835
- </div>
836
- </body>
837
- </html>
838
- INPUT
839
- <?xml version='1.0'?>
840
- <html xmlns:epub='http://www.idpf.org/2007/ops'>
841
- <head>
842
- <title>test</title>
843
- <body lang='EN-US' link='blue' vlink='#954F72'>
844
- <div class='WordSection1'>
845
- <p>&#xA0;</p>
846
- </div>
847
- <br clear='all' class='section'/>
848
- <div class='WordSection2'>
849
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
850
- <div>
851
- <h1 class='ForewordTitle'>Foreword</h1>
852
- <p class='TableTitle' align='center'>
853
- <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
854
- </p>
855
- <table id='tableD-1' class='MsoISOTable' border='1' cellspacing='0' cellpadding='0'>
856
- <thead>
857
- <tr>
858
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
859
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
860
- <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
861
- </tr>
862
- </thead>
863
- <tbody>
864
- <tr>
865
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
866
- http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
867
- </td>
868
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
869
- http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
870
- <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
871
- www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
872
- </td>
873
- </tr>
874
- </tbody>
875
- </table>
876
- </div>
877
- </div>
878
- </body>
879
- </head>
880
- </html>
881
- OUTPUT
882
- end
883
-
884
-
885
- it "does not break up very long strings in tables by default (Word)" do
886
- expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
887
- <html xmlns:epub="http://www.idpf.org/2007/ops">
888
- <head>
889
- <title>test</title>
890
- <body lang="EN-US" link="blue" vlink="#954F72">
891
- <div class="WordSection1">
892
- <p>&#160;</p>
893
- </div>
894
- <br clear="all" class="section"/>
895
- <div class="WordSection2">
896
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
897
- <div>
898
- <h1 class="ForewordTitle">Foreword</h1>
899
- <p class="TableTitle" align="center">
900
- <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
901
- </p>
902
- <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
903
- <thead>
904
- <tr>
905
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
906
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
907
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
908
- </tr>
909
- </thead>
910
- <tbody>
911
- <tr>
912
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
913
- http://www.example.com/&amp;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
914
- </td>
915
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
916
- http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
917
- </td>
918
- <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
919
- www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
920
- </td>
921
- </tr>
922
- </tbody>
923
- </table>
924
- </div>
925
- </div>
926
- </body>
927
- </html>
928
- INPUT
929
- <?xml version='1.0'?>
930
- <html xmlns:epub='http://www.idpf.org/2007/ops'>
931
- <head>
932
- <title>test</title>
933
- <body lang='EN-US' link='blue' vlink='#954F72'>
934
- <div class='WordSection1'>
935
- <p>&#xA0;</p>
936
- </div>
937
- <br clear='all' class='section'/>
938
- <div class='WordSection2'>
939
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
940
- <div>
941
- <h1 class='ForewordTitle'>Foreword</h1>
942
- <p class='TableTitle' align='center'>
943
- <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
944
- </p>
945
- <table id='tableD-1' class='MsoISOTable' border='1' cellspacing='0' cellpadding='0'>
946
- <thead>
947
- <tr>
948
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
949
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
950
- <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
951
- </tr>
952
- </thead>
953
- <tbody>
954
- <tr>
955
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
956
- http://www.example.com/&amp;AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB
957
- </td>
958
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
959
- http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
960
- </td>
961
- <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
962
- www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB
963
- </td>
964
- </tr>
965
- </tbody>
966
- </table>
967
- </div>
968
- </div>
969
- </body>
970
- </head>
971
- </html>
972
- OUTPUT
973
- end
974
-
975
- it "breaks up very long strings in tables on request (Word)" do
976
- expect(xmlpp(IsoDoc::WordConvert.new({break_up_urls_in_tables: "true"}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
977
- <html xmlns:epub="http://www.idpf.org/2007/ops">
978
- <head>
979
- <title>test</title>
980
- <body lang="EN-US" link="blue" vlink="#954F72">
981
- <div class="WordSection1">
982
- <p>&#160;</p>
983
- </div>
984
- <br clear="all" class="section"/>
985
- <div class="WordSection2">
986
- <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
987
- <div>
988
- <h1 class="ForewordTitle">Foreword</h1>
989
- <p class="TableTitle" align="center">
990
- <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
991
- </p>
992
- <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
993
- <thead>
994
- <tr>
995
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
996
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
997
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
998
- </tr>
999
- </thead>
1000
- <tbody>
1001
- <tr>
1002
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/BBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
1003
- <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
1004
- <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABBBBBBBBBBBBBBBBBBBBBBBBBBBB</td>
1005
- </tr>
1006
- </tbody>
1007
- </table>
1008
- </div>
1009
- </div>
1010
- </body>
1011
- </html>
1012
- INPUT
1013
- <?xml version='1.0'?>
1014
- <html xmlns:epub='http://www.idpf.org/2007/ops'>
1015
- <head>
1016
- <title>test</title>
1017
- <body lang='EN-US' link='blue' vlink='#954F72'>
1018
- <div class='WordSection1'>
1019
- <p>&#xA0;</p>
1020
- </div>
1021
- <br clear='all' class='section'/>
1022
- <div class='WordSection2'>
1023
- <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
1024
- <div>
1025
- <h1 class='ForewordTitle'>Foreword</h1>
1026
- <p class='TableTitle' align='center'>
1027
- <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
1028
- </p>
1029
- <table id='tableD-1' class='MsoISOTable' border='1' cellspacing='0' cellpadding='0'>
1030
- <thead>
1031
- <tr>
1032
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
1033
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
1034
- <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
1035
- </tr>
1036
- </thead>
1037
- <tbody>
1038
- <tr>
1039
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
1040
- http://www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAA/ BBBBBBBBBBBBBBBBBBBBBBBBBBBB
1041
- </td>
1042
- <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
1043
- http://www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAABBBBBBBBBBBBBBBBBBBBBB BBBBBB
1044
- </td>
1045
- <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
1046
- www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
1047
- </td>
1048
- </tr>
1049
- </tbody>
1050
- </table>
1051
- </div>
1052
- </div>
1053
- </body>
1054
- </head>
1055
- </html>
1056
- OUTPUT
1057
- end
1058
-
1059
- it "cleans up term sources" do
1060
- c = IsoDoc::HtmlConvert.new({i18nyaml: "spec/assets/i18n.yaml"})
1061
- c.i18n_init("en", "Latn")
1062
- expect(xmlpp(c.textcleanup(<<~"INPUT").to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
1063
- #{HTML_HDR}
1064
- <p class="zzSTDTitle1"/>
1065
- <div id="_terms_and_definitions"><h1>1.&#160; Terms and Definitions</h1><p>For the purposes of this document,
1066
- the following terms and definitions apply.</p>
1067
- <p class="TermNum" id="paddy1">1.1.</p><p class="Terms" style="text-align:left;">paddy</p>
1068
-
1069
- <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">&lt;rice&gt; rice retaining its husk after threshing</p>
1070
- <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f892" class="example"><p class="example-title">EXAMPLE 1</p>
1071
- <p id="_65c9a509-9a89-4b54-a890-274126aeb55c">Foreign seeds, husks, bran, sand, dust.</p>
1072
- <ul>
1073
- <li>A</li>
1074
- </ul>
1075
- </div>
1076
- <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f894" class="example"><p class="example-title">EXAMPLE 2</p>
1077
- <ul>
1078
- <li>A</li>
1079
- </ul>
1080
- </div>
1081
-
1082
- <p>[TERMREF]
1083
- <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
1084
- [MODIFICATION]The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
1085
- [/TERMREF]</p>
1086
- <p>[TERMREF] Termbase IEV, term ID xyz [/TERMREF]</p>
1087
- <p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION] [/TERMREF]</p>
1088
- <p>[TERMREF] Termbase IEV, term ID xyz [MODIFICATION]with adjustments [/TERMREF]</p>
1089
- <p class="TermNum" id="paddy">1.2.</p><p class="Terms" style="text-align:left;">paddy</p><p class="AltTerms" style="text-align:left;">paddy rice</p>
1090
- <p class="AltTerms" style="text-align:left;">rough rice</p>
1091
- <p class="DeprecatedTerms" style="text-align:left;">DEPRECATED: cargo rice</p>
1092
- <p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
1093
- <div id="_bd57bbf1-f948-4bae-b0ce-73c00431f893" class="example"><p class="example-title">EXAMPLE</p>
1094
- <ul>
1095
- <li>A</li>
1096
- </ul>
1097
- </div>
1098
- <div class="Note"><p>Note 1 to entry: The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></div>
1099
- <div class="Note"><p>Note 2 to entry: <ul><li>A</li></ul><p id="_19830f33-e46c-42cc-94ca-a5ef101132d5">The starch of waxy rice consists almost entirely of amylopectin. The kernels have a tendency to stick together after cooking.</p></p></div>
1100
- <p>[TERMREF]
1101
- <a href="#ISO7301">ISO 7301:2011, Clause 3.1</a>
1102
- [/TERMREF]</p></div>
1103
- </div>
1104
- </body>
1105
- </html>
1106
- INPUT
1107
- <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
1108
- <head/>
1109
- <body lang='en'>
1110
- <div class='title-section'>
1111
- <p>&#160;</p>
1112
- </div>
1113
- <br/>
1114
- <div class='prefatory-section'>
1115
- <p>&#160;</p>
1116
- </div>
1117
- <br/>
1118
- <div class='main-section'>
1119
- <p class='zzSTDTitle1'/>
1120
- <div id='_terms_and_definitions'>
1121
- <h1>1.&#160; Terms and Definitions</h1>
1122
- <p>For the purposes of this document, the following terms and definitions apply.</p>
1123
- <p class='TermNum' id='paddy1'>1.1.</p>
1124
- <p class='Terms' style='text-align:left;'>paddy</p>
1125
- <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>&lt;rice&gt; rice retaining its husk after threshing</p>
1126
- <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f892' class='example'>
1127
- <p class='example-title'>EXAMPLE 1</p>
1128
- <p id='_65c9a509-9a89-4b54-a890-274126aeb55c'>Foreign seeds, husks, bran, sand, dust.</p>
1129
- <ul>
1130
- <li>A</li>
1131
- </ul>
1132
- </div>
1133
- <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f894' class='example'>
1134
- <p class='example-title'>EXAMPLE 2</p>
1135
- <ul>
1136
- <li>A</li>
1137
- </ul>
1138
- </div>
1139
- <p>
1140
- [SOURCE:
1141
- <a href='#ISO7301'>ISO 7301:2011, Clause 3.1</a>
1142
- , modified &mdash; The term "cargo rice" is shown as deprecated, and
1143
- Note 1 to entry is not included here; Termbase IEV, term ID xyz;
1144
- Termbase IEV, term ID xyz, modified; Termbase IEV, term ID xyz,
1145
- modified &mdash; with adjustments]
1146
- </p>
1147
- <p class='TermNum' id='paddy'>1.2.</p>
1148
- <p class='Terms' style='text-align:left;'>paddy</p>
1149
- <p class='AltTerms' style='text-align:left;'>paddy rice</p>
1150
- <p class='AltTerms' style='text-align:left;'>rough rice</p>
1151
- <p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: cargo rice</p>
1152
- <p id='_eb29b35e-123e-4d1c-b50b-2714d41e747f'>rice retaining its husk after threshing</p>
1153
- <div id='_bd57bbf1-f948-4bae-b0ce-73c00431f893' class='example'>
1154
- <p class='example-title'>EXAMPLE</p>
1155
- <ul>
1156
- <li>A</li>
1157
- </ul>
1158
- </div>
1159
- <div class='Note'>
1160
- <p>
1161
- Note 1 to entry: The starch of waxy rice consists almost entirely of
1162
- amylopectin. The kernels have a tendency to stick together after
1163
- cooking.
1164
- </p>
1165
- </div>
1166
- <div class='Note'>
1167
- <p>
1168
- Note 2 to entry:
1169
- <ul>
1170
- <li>A</li>
1171
- </ul>
1172
- <p id='_19830f33-e46c-42cc-94ca-a5ef101132d5'>
1173
- The starch of waxy rice consists almost entirely of amylopectin.
1174
- The kernels have a tendency to stick together after cooking.
1175
- </p>
1176
- </p>
1177
- </div>
1178
- <p>
1179
- [SOURCE:
1180
- <a href='#ISO7301'>ISO 7301:2011, Clause 3.1</a>
1181
- ]
1182
- </p>
1183
- </div>
1184
- </div>
1185
- </body>
1186
- </html>
1187
- OUTPUT
1188
- end
1189
1187
  end