isodoc 1.0.20 → 1.0.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,154 @@
1
+ module IsoDoc::Function
2
+ module XrefGen
3
+ def sequential_figure_names(clause)
4
+ c = Counter.new
5
+ j = 0
6
+ clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
7
+ each do |t|
8
+ if t.parent.name == "figure" then j += 1
9
+ else
10
+ j = 0
11
+ c.increment(t)
12
+ end
13
+ label = c.print + (j.zero? ? "" : "-#{j}")
14
+ next if t["id"].nil? || t["id"].empty?
15
+ @anchors[t["id"]] =
16
+ anchor_struct(label, nil, @figure_lbl, "figure", t["unnumbered"])
17
+ end
18
+ end
19
+
20
+ def sequential_table_names(clause)
21
+ c = Counter.new
22
+ clause.xpath(ns(".//table")).each do |t|
23
+ next if t["id"].nil? || t["id"].empty?
24
+ @anchors[t["id"]] = anchor_struct(c.increment(t).print, nil,
25
+ @table_lbl, "table", t["unnumbered"])
26
+ end
27
+ end
28
+
29
+ def sequential_formula_names(clause)
30
+ c = Counter.new
31
+ clause.xpath(ns(".//formula")).each do |t|
32
+ next if t["id"].nil? || t["id"].empty?
33
+ @anchors[t["id"]] =
34
+ anchor_struct(c.increment(t).print, t,
35
+ t["inequality"] ? @inequality_lbl : @formula_lbl,
36
+ "formula", t["unnumbered"])
37
+ end
38
+ end
39
+
40
+ FIRST_LVL_REQ = "[not(ancestor::permission or ancestor::requirement or "\
41
+ "ancestor::recommendation)]".freeze
42
+
43
+ def sequential_permission_names(clause, klass, label)
44
+ c = Counter.new
45
+ clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
46
+ next if t["id"].nil? || t["id"].empty?
47
+ id = c.increment(t).print
48
+ @anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
49
+ sequential_permission_names2(t, id)
50
+ end
51
+ end
52
+
53
+ def sequential_permission_names2(t, id)
54
+ sequential_permission_names1(t, id, "permission", @permission_lbl)
55
+ sequential_permission_names1(t, id, "requirement", @requirement_lbl)
56
+ sequential_permission_names1(t, id, "recommendation", @recommendation_lbl)
57
+ end
58
+
59
+ def sequential_permission_names1(block, lbl, klass, label)
60
+ c = Counter.new
61
+ block.xpath(ns("./#{klass}")).each do |t|
62
+ next if t["id"].nil? || t["id"].empty?
63
+ id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
64
+ @anchors[t["id"]] = anchor_struct(id, t, label, klass, t["unnumbered"])
65
+ sequential_permission_names2(t, id)
66
+ end
67
+ end
68
+
69
+ def sequential_asset_names(clause)
70
+ sequential_table_names(clause)
71
+ sequential_figure_names(clause)
72
+ sequential_formula_names(clause)
73
+ sequential_permission_names(clause, "permission", @permission_lbl)
74
+ sequential_permission_names(clause, "requirement", @requirement_lbl)
75
+ sequential_permission_names(clause, "recommendation", @recommendation_lbl)
76
+ end
77
+
78
+ def hierarchical_figure_names(clause, num)
79
+ c = Counter.new
80
+ j = 0
81
+ clause.xpath(ns(".//figure | .//sourcecode[not(ancestor::example)]")).
82
+ each do |t|
83
+ if t.parent.name == "figure" then j += 1
84
+ else
85
+ j = 0
86
+ c.increment(t)
87
+ end
88
+ label = "#{num}#{hiersep}#{c.print}" +
89
+ (j.zero? ? "" : "#{hierfigsep}#{j}")
90
+ next if t["id"].nil? || t["id"].empty?
91
+ @anchors[t["id"]] = anchor_struct(label, nil, @figure_lbl, "figure",
92
+ t["unnumbered"])
93
+ end
94
+ end
95
+
96
+ def hierarchical_table_names(clause, num)
97
+ c = Counter.new
98
+ clause.xpath(ns(".//table")).each do |t|
99
+ next if t["id"].nil? || t["id"].empty?
100
+ @anchors[t["id"]] =
101
+ anchor_struct("#{num}#{hiersep}#{c.increment(t).print}",
102
+ nil, @table_lbl, "table", t["unnumbered"])
103
+ end
104
+ end
105
+
106
+ def hierarchical_asset_names(clause, num)
107
+ hierarchical_table_names(clause, num)
108
+ hierarchical_figure_names(clause, num)
109
+ hierarchical_formula_names(clause, num)
110
+ hierarchical_permission_names(clause, num, "permission", @permission_lbl)
111
+ hierarchical_permission_names(clause, num, "requirement",
112
+ @requirement_lbl)
113
+ hierarchical_permission_names(clause, num, "recommendation",
114
+ @recommendation_lbl)
115
+ end
116
+
117
+ def hierarchical_formula_names(clause, num)
118
+ c = Counter.new
119
+ clause.xpath(ns(".//formula")).each do |t|
120
+ next if t["id"].nil? || t["id"].empty?
121
+ @anchors[t["id"]] =
122
+ anchor_struct("#{num}#{hiersep}#{c.increment(t).print}", nil,
123
+ t["inequality"] ? @inequality_lbl : @formula_lbl,
124
+ "formula", t["unnumbered"])
125
+ end
126
+ end
127
+
128
+ def hierarchical_permission_names(clause, num, klass, label)
129
+ c = Counter.new
130
+ clause.xpath(ns(".//#{klass}#{FIRST_LVL_REQ}")).each do |t|
131
+ next if t["id"].nil? || t["id"].empty?
132
+ id = "#{num}#{hiersep}#{c.increment(t).print}"
133
+ @anchors[t["id"]] = anchor_struct(id, nil, label, klass, t["unnumbered"])
134
+ hierarchical_permission_names2(t, id)
135
+ end
136
+ end
137
+
138
+ def hierarchical_permission_names2(t, id)
139
+ hierarchical_permission_names1(t, id, "permission", @permission_lbl)
140
+ hierarchical_permission_names1(t, id, "requirement", @requirement_lbl)
141
+ hierarchical_permission_names1(t, id, "recommendation", @recommendation_lbl)
142
+ end
143
+
144
+ def hierarchical_permission_names1(block, lbl, klass, label)
145
+ c = Counter.new
146
+ block.xpath(ns("./#{klass}")).each do |t|
147
+ next if t["id"].nil? || t["id"].empty?
148
+ id = "#{lbl}#{hierfigsep}#{c.increment(t).print}"
149
+ @anchors[t["id"]] = anchor_struct(id, nil, label, klass, t["unnumbered"])
150
+ hierarchical_permission_names2(t, id)
151
+ end
152
+ end
153
+ end
154
+ end
@@ -62,7 +62,8 @@ module IsoDoc::HtmlFunction
62
62
  end
63
63
 
64
64
  def footnote_parse(node, out)
65
- return table_footnote_parse(node, out) if @in_table || @in_figure
65
+ return table_footnote_parse(node, out) if (@in_table || @in_figure) &&
66
+ !node.ancestors.map {|m| m.name }.include?("name")
66
67
  fn = node["reference"]
67
68
  attrs = { "epub:type": "footnote", rel: "footnote", href: "#fn:#{fn}" }
68
69
  out.a **attrs do |a|
@@ -1,3 +1,3 @@
1
1
  module IsoDoc
2
- VERSION = "1.0.20".freeze
2
+ VERSION = "1.0.21".freeze
3
3
  end
@@ -17,8 +17,6 @@ module IsoDoc::WordFunction
17
17
  end
18
18
 
19
19
  def make_body1(body, _docxml)
20
- #FileUtils.rm_rf tmpimagedir
21
- #FileUtils.mkdir tmpimagedir
22
20
  body.div **{ class: "WordSection1" } do |div1|
23
21
  div1.p { |p| p << "&nbsp;" } # placeholder
24
22
  end
@@ -228,5 +226,23 @@ module IsoDoc::WordFunction
228
226
  "mso-table-overlap:never;border-collapse:collapse;"
229
227
  })
230
228
  end
229
+
230
+ def formula_where(dl, out)
231
+ return unless dl
232
+ out.p { |p| p << @where_lbl }
233
+ parse(dl, out)
234
+ out.parent.at("./table")["class"] = "formula_dl"
235
+ end
236
+
237
+ def li_parse(node, out)
238
+ out.li **attr_code(id: node["id"]) do |li|
239
+ if node["uncheckedcheckbox"] == "true"
240
+ li << '<span class="zzMoveToFollowing">&#x2610; </span>'
241
+ elsif node["checkedcheckbox"] == "true"
242
+ li << '<span class="zzMoveToFollowing">&#x2611; </span>'
243
+ end
244
+ node.children.each { |n| parse(n, li) }
245
+ end
246
+ end
231
247
  end
232
248
  end
@@ -78,7 +78,8 @@ module IsoDoc::WordFunction
78
78
  end
79
79
 
80
80
  def footnote_parse(node, out)
81
- return table_footnote_parse(node, out) if @in_table || @in_figure
81
+ return table_footnote_parse(node, out) if (@in_table || @in_figure) &&
82
+ !node.ancestors.map {|m| m.name }.include?("name")
82
83
  fn = node["reference"]
83
84
  return seen_footnote_parse(node, out, fn) if @seen_footnote.include?(fn)
84
85
  @fn_bookmarks[fn] = bookmarkid
@@ -64,6 +64,7 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
64
64
  def word_cleanup(docxml)
65
65
  word_annex_cleanup(docxml)
66
66
  word_preface(docxml)
67
+ word_nested_tables(docxml)
67
68
  word_table_align(docxml)
68
69
  word_table_separator(docxml)
69
70
  word_admonition_images(docxml)
@@ -77,6 +78,14 @@ xmlns:m="http://schemas.microsoft.com/office/2004/12/omml">
77
78
  docxml
78
79
  end
79
80
 
81
+ def word_nested_tables(docxml)
82
+ docxml.xpath("//table").each do |t|
83
+ t.xpath(".//table").reverse.each do |tt|
84
+ t.next = tt.remove
85
+ end
86
+ end
87
+ end
88
+
80
89
  def authority_cleanup1(docxml, klass)
81
90
  dest = docxml.at("//div[@id = 'boilerplate-#{klass}-destination']")
82
91
  auth = docxml.at("//div[@id = 'boilerplate-#{klass}' or @class = 'boilerplate-#{klass}']")
@@ -36,6 +36,7 @@ module IsoDoc::WordFunction
36
36
  def make_table_attr(node)
37
37
  super.merge(attr_code({
38
38
  summary: node["summary"],
39
+ width: node["width"],
39
40
  style: "mso-table-lspace:15.0cm;margin-left:423.0pt;"\
40
41
  "mso-table-rspace:15.0cm;margin-right:423.0pt;"\
41
42
  "mso-table-anchor-horizontal:column;"\
@@ -318,7 +318,7 @@ OUTPUT
318
318
  <iso-standard xmlns="http://riboseinc.com/isoxml">
319
319
  <preface><foreword>
320
320
  <figure id="figureA-1">
321
- <name>Split-it-right <em>sample</em> divider</name>
321
+ <name>Split-it-right <em>sample</em> divider<fn reference="1"><p>X</p></fn></name>
322
322
  <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletxt"/>
323
323
  <image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f1" mimetype="image/png"/>
324
324
  <image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f2" mimetype="image/png"/>
@@ -353,8 +353,12 @@ B</pre>
353
353
  <a href="#_" class="TableFootnoteRef">a</a><aside class="footnote"><div id="fn:_"><span><span id="_" class="TableFootnoteRef">a</span>&#160; </span>
354
354
  <p id="_">The time <span class="stem">(#(t_90)#)</span> was estimated to be 18,2 min for this example.</p>
355
355
  </div></aside>
356
- <p><b>Key</b></p><dl><dt><p>A</p></dt><dd><p>B</p></dd></dl>
357
- <p class="FigureTitle" style="text-align:center;">Figure 1&#160;&#8212; Split-it-right <i>sample</i> divider</p></div>
356
+ <p style='page-break-after:avoid;'><b>Key</b></p><dl><dt><p>A</p></dt><dd><p>B</p></dd></dl>
357
+ <p class="FigureTitle" style="text-align:center;">Figure 1&#160;&#8212; Split-it-right <i>sample</i> divider
358
+ <a rel='footnote' href='#fn:1' epub:type='footnote'>
359
+ <sup>1</sup>
360
+ </a>
361
+ </p></div>
358
362
  <div class="figure" id="figure-B">
359
363
  <pre>A &lt;
360
364
  B</pre>
@@ -366,6 +370,9 @@ B</pre>
366
370
  </div>
367
371
  </div>
368
372
  <p class="zzSTDTitle1"/>
373
+ <aside id='fn:1' class='footnote'>
374
+ <p>X</p>
375
+ </aside>
369
376
  </div>
370
377
  </body>
371
378
  </html>
@@ -373,11 +380,11 @@ B</pre>
373
380
  end
374
381
 
375
382
  it "processes figures (Word)" do
376
- expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/['"][^'".]+\.gif['"]/, "'_.gif'")))).to be_equivalent_to xmlpp(<<~"OUTPUT")
383
+ expect(xmlpp(strip_guid(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true).sub(/['"][^'".]+\.gif['"]/, "'_.gif'").gsub(/mso-bookmark:_Ref\d+/, "mso-bookmark:_Ref")))).to be_equivalent_to xmlpp(<<~"OUTPUT")
377
384
  <iso-standard xmlns="http://riboseinc.com/isoxml">
378
385
  <preface><foreword>
379
386
  <figure id="figureA-1">
380
- <name>Split-it-right sample divider</name>
387
+ <name>Split-it-right sample divider<fn reference="1"><p>X</p></fn></name>
381
388
  <image src="rice_images/rice_image1.png" height="20" width="30" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png" alt="alttext" title="titletext"/>
382
389
  <image src="rice_images/rice_image1.png" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
383
390
  <image src="data:image/gif;base64,R0lGODlhEAAQAMQAAORHHOVSKudfOulrSOp3WOyDZu6QdvCchPGolfO0o/XBs/fNwfjZ0frl3/zy7////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABAALAAAAAAQABAAAAVVICSOZGlCQAosJ6mu7fiyZeKqNKToQGDsM8hBADgUXoGAiqhSvp5QAnQKGIgUhwFUYLCVDFCrKUE1lBavAViFIDlTImbKC5Gm2hB0SlBCBMQiB0UjIQA7" height="20" width="auto" id="_8357ede4-6d44-4672-bac4-9a85e82ab7f0" mimetype="image/png"/>
@@ -415,8 +422,16 @@ B</pre>
415
422
  <a href="#_" class="TableFootnoteRef">a</a><aside><div id="ftn_"><span><span id="_" class="TableFootnoteRef">a</span><span style="mso-tab-count:1">&#160; </span></span>
416
423
  <p id="_">The time <span class="stem">(#(t_90)#)</span> was estimated to be 18,2 min for this example.</p>
417
424
  </div></aside>
418
- <p><b>Key</b></p><table class="dl"><tr><td valign="top" align="left"><p align="left" style="margin-left:0pt;text-align:left;">A</p></td><td valign="top"><p>B</p></td></tr></table>
419
- <p class="FigureTitle" style="text-align:center;">Figure 1&#160;&#8212; Split-it-right sample divider</p></div>
425
+ <p style='page-break-after:avoid;'><b>Key</b></p><table class="dl"><tr><td valign="top" align="left"><p align="left" style="margin-left:0pt;text-align:left;">A</p></td><td valign="top"><p>B</p></td></tr></table>
426
+ <p class='FigureTitle' style='text-align:center;'>
427
+ Figure 1&#160;&#8212; Split-it-right sample divider
428
+ <span style='mso-bookmark:_Ref'>
429
+ <a href='#ftn1' epub:type='footnote'>
430
+ <sup>1</sup>
431
+ </a>
432
+ </span>
433
+ </p>
434
+ </div>
420
435
  <div class="figure" id="figure-B">
421
436
  <pre>A &lt;
422
437
  B</pre>
@@ -428,6 +443,9 @@ B</pre>
428
443
  <p><br clear="all" class="section"/></p>
429
444
  <div class="WordSection3">
430
445
  <p class="zzSTDTitle1"/>
446
+ <aside id='ftn1'>
447
+ <p>X</p>
448
+ </aside>
431
449
  </div>
432
450
  </body>
433
451
  </html>
@@ -729,7 +747,7 @@ Que?
729
747
  <br/>
730
748
  <div>
731
749
  <h1 class="ForewordTitle">Foreword</h1>
732
- <div id="_be9158af-7e93-4ee2-90c5-26d31c181934" class="formula"><p><span class="stem">(#(r = 1 %)#)</span></p></div><p>where</p><dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d"><dt>
750
+ <div id="_be9158af-7e93-4ee2-90c5-26d31c181934" class="formula"><p><span class="stem">(#(r = 1 %)#)</span></p></div><p style='page-break-after:avoid;'>where</p><dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d" class="formula_dl"><dt>
733
751
  <span class="stem">(#(r)#)</span>
734
752
  </dt><dd>
735
753
  <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
@@ -747,6 +765,96 @@ Que?
747
765
  OUTPUT
748
766
  end
749
767
 
768
+ it "processes formulae (Word)" do
769
+ expect(xmlpp(IsoDoc::WordConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
770
+ <iso-standard xmlns="http://riboseinc.com/isoxml">
771
+ <preface><foreword>
772
+ <formula id="_be9158af-7e93-4ee2-90c5-26d31c181934" unnumbered="true">
773
+ <stem type="AsciiMath">r = 1 %</stem>
774
+ <dl id="_e4fe94fe-1cde-49d9-b1ad-743293b7e21d">
775
+ <dt>
776
+ <stem type="AsciiMath">r</stem>
777
+ </dt>
778
+ <dd>
779
+ <p id="_1b99995d-ff03-40f5-8f2e-ab9665a69b77">is the repeatability limit.</p>
780
+ </dd>
781
+ </dl>
782
+ <note id="_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0">
783
+ <p id="_511aaa98-4116-42af-8e5b-c87cdf5bfdc8">[durationUnits] is essentially a duration statement without the "P" prefix. "P" is unnecessary because between "G" and "U" duration is always expressed.</p>
784
+ </note>
785
+ </formula>
786
+ <formula id="_be9158af-7e93-4ee2-90c5-26d31c181935">
787
+ <stem type="AsciiMath">r = 1 %</stem>
788
+ </formula>
789
+ </foreword></preface>
790
+ </iso-standard>
791
+ INPUT
792
+ <html xmlns:epub='http://www.idpf.org/2007/ops' lang='en'>
793
+ <head>
794
+ <style>
795
+ </style>
796
+ </head>
797
+ <body lang='EN-US' link='blue' vlink='#954F72'>
798
+ <div class='WordSection1'>
799
+ <p>&#160;</p>
800
+ </div>
801
+ <p>
802
+ <br clear='all' class='section'/>
803
+ </p>
804
+ <div class='WordSection2'>
805
+ <p>
806
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
807
+ </p>
808
+ <div>
809
+ <h1 class='ForewordTitle'>Foreword</h1>
810
+ <div id='_be9158af-7e93-4ee2-90c5-26d31c181934' class='formula'>
811
+ <p>
812
+ <span class='stem'>(#(r = 1 %)#)</span>
813
+ </p>
814
+ </div>
815
+ <p>where</p>
816
+ <table class='formula_dl'>
817
+ <tr>
818
+ <td valign='top' align='left'>
819
+ <p align='left' style='margin-left:0pt;text-align:left;'>
820
+ <span class='stem'>(#(r)#)</span>
821
+ </p>
822
+ </td>
823
+ <td valign='top'>
824
+ <p id='_1b99995d-ff03-40f5-8f2e-ab9665a69b77'>is the repeatability limit.</p>
825
+ </td>
826
+ </tr>
827
+ </table>
828
+ <div id='_83083c7a-6c85-43db-a9fa-4d8edd0c9fc0' class='Note'>
829
+ <p class='Note'>
830
+ <span class='note_label'>NOTE</span>
831
+ <span style='mso-tab-count:1'>&#160; </span>
832
+ [durationUnits] is essentially a duration statement without the "P"
833
+ prefix. "P" is unnecessary because between "G" and "U" duration is
834
+ always expressed.
835
+ </p>
836
+ </div>
837
+ <div id='_be9158af-7e93-4ee2-90c5-26d31c181935' class='formula'>
838
+ <p>
839
+ <span class='stem'>(#(r = 1 %)#)</span>
840
+ <span style='mso-tab-count:1'>&#160; </span>
841
+ (1)
842
+ </p>
843
+ </div>
844
+ </div>
845
+ <p>&#160;</p>
846
+ </div>
847
+ <p>
848
+ <br clear='all' class='section'/>
849
+ </p>
850
+ <div class='WordSection3'>
851
+ <p class='zzSTDTitle1'/>
852
+ </div>
853
+ </body>
854
+ </html>
855
+ OUTPUT
856
+ end
857
+
750
858
  it "processes paragraph alignments" do
751
859
  expect(xmlpp(IsoDoc::HtmlConvert.new({}).convert("test", <<~"INPUT", true))).to be_equivalent_to xmlpp(<<~"OUTPUT")
752
860
  <iso-standard xmlns="http://riboseinc.com/isoxml">
@@ -715,4 +715,182 @@ INPUT
715
715
  OUTPUT
716
716
  end
717
717
 
718
+ it "breaks up very long strings in tables" 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
+ <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>
778
+ <tbody>
779
+ <tr>
780
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
781
+ http://www.example.com/
782
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAA/
783
+ 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/
787
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
788
+ AAAAAAAABBBBBBBBBBBBBBBBBBBBBB BBBBBB
789
+ </td>
790
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
791
+ www.example.com/
792
+ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
793
+ ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
794
+ </td>
795
+ </tr>
796
+ </tbody>
797
+ </thead>
798
+ </table>
799
+ </div>
800
+ </div>
801
+ </body>
802
+ </head>
803
+ </html>
804
+ OUTPUT
805
+ end
806
+
807
+ it "breaks up very long strings in tables (Word)" do
808
+ expect(xmlpp(IsoDoc::WordConvert.new({}).cleanup(Nokogiri::XML(<<~"INPUT")).to_s)).to be_equivalent_to xmlpp(<<~"OUTPUT")
809
+ <html xmlns:epub="http://www.idpf.org/2007/ops">
810
+ <head>
811
+ <title>test</title>
812
+ <body lang="EN-US" link="blue" vlink="#954F72">
813
+ <div class="WordSection1">
814
+ <p>&#160;</p>
815
+ </div>
816
+ <br clear="all" class="section"/>
817
+ <div class="WordSection2">
818
+ <br clear="all" style="mso-special-character:line-break;page-break-before:always"/>
819
+ <div>
820
+ <h1 class="ForewordTitle">Foreword</h1>
821
+ <p class="TableTitle" align="center">
822
+ <b>Table 1&#160;&#8212; Repeatability and reproducibility of husked rice yield</b>
823
+ </p>
824
+ <table id="tableD-1" class="MsoISOTable" border="1" cellspacing="0" cellpadding="0">
825
+ <thead>
826
+ <tr>
827
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
828
+ <td align="left" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;">Description</td>
829
+ <td align="center" style="border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;">Rice sample</td>
830
+ </tr>
831
+ <tbody>
832
+ <tr>
833
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
834
+ http://www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAA/ BBBBBBBBBBBBBBBBBBBBBBBBBBBB
835
+ </td>
836
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
837
+ http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAABBBBBBBBBBBBBBBBBBBBBB BBBBBB
838
+ </td>
839
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
840
+ www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
841
+ </td>
842
+ </tr>
843
+ </tbody>
844
+ </table>
845
+ </div>
846
+ </div>
847
+ </body>
848
+ </html>
849
+ INPUT
850
+ <?xml version='1.0'?>
851
+ <html xmlns:epub='http://www.idpf.org/2007/ops'>
852
+ <head>
853
+ <title>test</title>
854
+ <body lang='EN-US' link='blue' vlink='#954F72'>
855
+ <div class='WordSection1'>
856
+ <p>&#xA0;</p>
857
+ </div>
858
+ <br clear='all' class='section'/>
859
+ <div class='WordSection2'>
860
+ <br clear='all' style='mso-special-character:line-break;page-break-before:always'/>
861
+ <div>
862
+ <h1 class='ForewordTitle'>Foreword</h1>
863
+ <p class='TableTitle' align='center'>
864
+ <b>Table 1&#xA0;&#x2014; Repeatability and reproducibility of husked rice yield</b>
865
+ </p>
866
+ <table id='tableD-1' class='MsoISOTable' border='1' cellspacing='0' cellpadding='0'>
867
+ <thead>
868
+ <tr>
869
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
870
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>Description</td>
871
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>Rice sample</td>
872
+ </tr>
873
+ <tbody>
874
+ <tr>
875
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
876
+ http://www.example.com/ AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAA/ BBBBBBBBBBBBBBBBBBBBBBBBBBBB
877
+ </td>
878
+ <td align='left' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.5pt;'>
879
+ http://www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAABBBBBBBBBBBBBBBBBBBBBB BBBBBB
880
+ </td>
881
+ <td align='center' style='border-top:solid windowtext 1.5pt;border-bottom:solid windowtext 1.0pt;'>
882
+ www.example.com/AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA ABBBBBBBBBBBBBBBBBBBBBBBBBBBB
883
+ </td>
884
+ </tr>
885
+ </tbody>
886
+ </thead>
887
+ </table>
888
+ </div>
889
+ </div>
890
+ </body>
891
+ </head>
892
+ </html>
893
+ OUTPUT
894
+ end
895
+
718
896
  end