aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2010-10-09 22:51:24 -0400
committerRalph Amissah <ralph@amissah.com>2010-10-09 22:51:27 -0400
commit7010772e78d181be3a8ba304387d94b8f4825ea7 (patch)
treee698b32b5e0f2a970e585bf092585d2f5f8c0ee5
parentsha256 (2.7.4) (diff)
odt fix cornercase breakage matching and representing "&nbsp", "&" and urls
(+changelog) * odf, "&nbsp" and "&" (prior to this fix, odt for viral_spiral is broken in sisu-markup-samples) * shared_metadata, "&nbsp", "&" and urls in metadata more consistent open document text results
-rw-r--r--CHANGELOG_v215
-rw-r--r--data/doc/sisu/v2/CHANGELOG15
-rw-r--r--lib/sisu/v2/odf.rb6
-rw-r--r--lib/sisu/v2/shared_metadata.rb14
4 files changed, 46 insertions, 4 deletions
diff --git a/CHANGELOG_v2 b/CHANGELOG_v2
index 2c9ff5a1..d27ff32d 100644
--- a/CHANGELOG_v2
+++ b/CHANGELOG_v2
@@ -12,6 +12,21 @@ Reverse Chronological:
%% Development branch UNSTABLE
+%% 2.7.5.orig.tar.gz (2010-10-08:40/5)
+http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.5.orig.tar.gz
+ sisu_2.7.5.orig.tar.gz
+ sisu_2.7.5-1.dsc
+ sisu_2.7.5-1.diff.gz
+
+ [debian freeze, fix]
+
+ * odf:odt
+ * odf, fix odt cornercase document breakage when matching and representing
+ "&nbsp" and "&" (prior to this fix, odt for viral_spiral is broken in
+ sisu-markup-samples)
+ * shared_metadata, fix cornercase odt document breakage when matching and
+ representing "&nbsp", "&" and urls in metadata
+
%% 2.7.4.orig.tar.gz (2010-10-08:40/5)
http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.4.orig.tar.gz
3d36b407f7f2df7b260f0a7932adf520a0539f8578dac59c6ca6de3bbfd03e62 2743433 sisu_2.7.4.orig.tar.gz
diff --git a/data/doc/sisu/v2/CHANGELOG b/data/doc/sisu/v2/CHANGELOG
index 45e47ec7..6f8b3edf 100644
--- a/data/doc/sisu/v2/CHANGELOG
+++ b/data/doc/sisu/v2/CHANGELOG
@@ -12,6 +12,21 @@ Reverse Chronological:
%% Development branch UNSTABLE
+%% 2.7.5.orig.tar.gz (2010-10-08:40/5)
+http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.5.orig.tar.gz
+ sisu_2.7.5.orig.tar.gz
+ sisu_2.7.5-1.dsc
+ sisu_2.7.5-1.diff.gz
+
+ [debian freeze, fix]
+
+ * odf:odt
+ * odf, fix odt cornercase document breakage when matching and representing
+ "&nbsp" and "&" (prior to this fix, odt for viral_spiral is broken in
+ sisu-markup-samples)
+ * shared_metadata, fix cornercase odt document breakage when matching and
+ representing "&nbsp", "&" and urls in metadata
+
%% 2.7.4.orig.tar.gz (2010-10-08:40/5)
http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.4.orig.tar.gz
3d36b407f7f2df7b260f0a7932adf520a0539f8578dac59c6ca6de3bbfd03e62 2743433 sisu_2.7.4.orig.tar.gz
diff --git a/lib/sisu/v2/odf.rb b/lib/sisu/v2/odf.rb
index 41229249..ad1f45d1 100644
--- a/lib/sisu/v2/odf.rb
+++ b/lib/sisu/v2/odf.rb
@@ -461,9 +461,9 @@ module SiSU_ODF
word.each do |w| # _ - / # | : ! ^ ~
unless dob =~/^(?:#{Rx[:meta]}|%+ )/m
w.gsub!(/&#(?:126|152);/,'~') #126 usual
- if w !~/&\S{1,7};/ \
- or w =~/&nbsp;/
- w.gsub!(/&/,'&amp;') #watch &nbsp;
+ w.gsub!(/&nbsp;/,'&#160;')
+ if w !~/&\S{2,7}?;/
+ w.gsub!(/&/,'&amp;')
end
w.gsub!(/(&\S{1,7};)+&/,'\1&amp;') #could break things
end
diff --git a/lib/sisu/v2/shared_metadata.rb b/lib/sisu/v2/shared_metadata.rb
index 69a92070..e589c598 100644
--- a/lib/sisu/v2/shared_metadata.rb
+++ b/lib/sisu/v2/shared_metadata.rb
@@ -476,6 +476,18 @@ WOK
if @inf.class==String
@inf.gsub!(/</,'&lt;'); @inf.gsub!(/>/,'&gt;')
@inf.gsub!(/&lt;br(?: \/)?&gt;/,'<br />')
+ if @inf =~/&/
+ inf_array=[]
+ word=@inf.scan(/\S+|\n/)
+ word.each do |w| # _ - / # | : ! ^ ~
+ w.gsub!(/&nbsp;/,'&#160;')
+ if w !~/&\S{2,7}?;/
+ w.gsub!(/&/,'&amp;')
+ end
+ inf_array << w
+ end
+ @inf=inf_array.join(' ')
+ end
@inf.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
'<text:a xlink:type="simple" xlink:href="\1">\1</text:a>') #http ftp matches escaped, no decoration
@inf.gsub!(/(#{Mx[:lnk_c]})#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
@@ -484,7 +496,7 @@ WOK
@inf.gsub!(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
%{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration
else
- @inf.gsub!(/(https?:\/\/\S+)/,
+ @inf.gsub!(/(https?:\/\/[^<>'"\s]+)/,
%{#{url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{url_brace.xml_close}}) #http ftp matches with decoration
end
@inf.gsub!(/([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/,