lib/isodoc/function/cleanup.rb in isodoc-1.0.24 vs lib/isodoc/function/cleanup.rb in isodoc-1.0.25
- old
+ new
@@ -18,19 +18,21 @@
example_cleanup(docxml)
admonition_cleanup(docxml)
end
def table_long_strings_cleanup(docxml)
+ return unless @break_up_urls_in_tables == true
docxml.xpath("//td | //th").each do |d|
d.traverse do |n|
next unless n.text?
n.replace(HTMLEntities.new.encode(
break_up_long_strings(n.text)))
end
end
end
def break_up_long_strings(t)
+ return t if t.match(/^\s*$/)
t.split(/(?=\s)/).map do |w|
(/^\s*$/.match(t) or w.size < 30) ? w :
w.scan(/.{,30}/).map do |w1|
(w1.size < 30) ? w1 : break_up_long_strings1(w1)
end.join