diff options
author | Ralph Amissah <ralph@amissah.com> | 2007-07-31 21:15:08 +0100 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2007-07-31 21:15:08 +0100 |
commit | 77ad17a847fec49785a42fbbe395fab6de5b4f25 (patch) | |
tree | a760c6b4b98abb91ba76593516f993f624386553 /lib | |
parent | Updated sisu-0.56.1 (diff) | |
parent | odf regex matches, 0.56.2 (diff) |
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v0/odf.rb | 8 |
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!(/&nbsp;| /,' ') para.gsub!(/</,'<'); para.gsub!(/>/,'>') + para.gsub!(/<(text:span text:style-name="T[1-5]"|\/text:span)>/,'<\1>') #works, not ideal para.gsub!(/<br(?:\s+\/)?>/,'<br />') #para.gsub!(/\s\s/,'  ') 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 |