aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/odf.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2007-07-31 21:15:08 +0100
committerRalph Amissah <ralph@amissah.com>2007-07-31 21:15:08 +0100
commit77ad17a847fec49785a42fbbe395fab6de5b4f25 (patch)
treea760c6b4b98abb91ba76593516f993f624386553 /lib/sisu/v0/odf.rb
parentUpdated sisu-0.56.1 (diff)
parentodf regex matches, 0.56.2 (diff)
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib/sisu/v0/odf.rb')
-rw-r--r--lib/sisu/v0/odf.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb
index 381e23d4..f6d6d942 100644
--- a/lib/sisu/v0/odf.rb
+++ b/lib/sisu/v0/odf.rb
@@ -279,7 +279,7 @@ module SiSU_ODF
end
def text_link(para)
para.gsub!(@serial,'')
- m=para.scan(/(\{([^}]+?)\}((?:https?|ftp)\S+?))([;.,]?$)/) #sort
+ m=para.scan(/(\{([^}]+?)\}((?:https?|ftp)\S+?))([;.,]?(?=\s|$))/) #sort
if m
m.each do |i|
txt,url,trail=i[1],i[2]
@@ -297,8 +297,8 @@ module SiSU_ODF
para.gsub!(@serial,'')
para.gsub!(/\b[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,
%{<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>\\2}) #http ftp matches escaped, no decoration
- para.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,
- %{\\1<text:a xlink:type="simple" xlink:href="\\2">\\2</text:a>\\3}) #special case \{ e.g. \}http://url
+ para.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,
+ '\1<text:a xlink:type="simple" xlink:href="\2">\2</text:a>\3') #special case \{ e.g. \}http://url
para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,
%{\\1#{@url_brace.xml_open}<text:a xlink:type="simple" xlink:href="\\2">\\2</text:a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration
#para.gsub!(/\b((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, also works
@@ -346,6 +346,7 @@ module SiSU_ODF
def group_clean(para)
para.gsub!(/&amp;nbsp;|&nbsp;/,'&#160;')
para.gsub!(/</,'&lt;'); para.gsub!(/>/,'&gt;')
+ para.gsub!(/&lt;(text:span text:style-name="T[1-5]"|\/text:span)&gt;/,'<\1>') #works, not ideal
para.gsub!(/&lt;br(?:\s+\/)?&gt;/,'<br />')
#para.gsub!(/\s\s/,'&#160;&#160;')
para
@@ -382,6 +383,7 @@ module SiSU_ODF
parray << %{<text:p text:style-name="P5">#{parablock}</text:p>} if parablock =~/\S+/
end
para=parray.join + '<text:p text:style-name="Standard"/>'
+ para
end
def table(para) #
if para =~/<!Th?.+/ # tables come as single block