From 5aa5fb54771a8e6ec9c6bbc292e0b06c00db9a96 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 31 Jul 2007 21:15:01 +0100 Subject: odf regex matches, 0.56.2 --- CHANGELOG | 15 ++++++++++++--- lib/sisu/v0/odf.rb | 8 +++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index b7f3df00..d8d5e4ff 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,11 +6,20 @@ Reverse Chronological: %% STABLE MANIFEST +%% sisu_0.56.2.orig.tar.gz (2007-07-31:31/2) +http://www.jus.uio.no/sisu/pkg/src/sisu_0.56.2.orig.tar.gz + sisu_0.56.2.orig.tar.gz + sisu_0.56.2-1.dsc + sisu_0.56.2-1.diff.gz + + * odf, a few regex matches, a new fix (url), and an old one (grouped text + with change to fontface) + %% sisu_0.56.1.orig.tar.gz (2007-07-31:31/2) http://www.jus.uio.no/sisu/pkg/src/sisu_0.56.1.orig.tar.gz - sisu_0.56.1.orig.tar.gz - sisu_0.56.1-1.dsc - sisu_0.56.1-1.diff.gz + 6740ed538a5558cead0228315b811d9f 1272026 sisu_0.56.1.orig.tar.gz + 1270f327c735cca3ea077950e5229f25 606 sisu_0.56.1-1.dsc + 87e12b0b18192346e4a98c3127a73968 142382 sisu_0.56.1-1.diff.gz * dal, endnote / url matching refinement 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|$))/, %{\\1\\2}) #http ftp matches escaped, no decoration - para.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/, - %{\\1\\2\\3}) #special case \{ e.g. \}http://url + para.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, + '\1\2\3') #special case \{ e.g. \}http://url para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/, %{\\1#{@url_brace.xml_open}\\2#{@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!(/<(text:span text:style-name="T[1-5]"|\/text:span)>/,'<\1>') #works, not ideal para.gsub!(/<br(?:\s+\/)?>/,'
') #para.gsub!(/\s\s/,'  ') para @@ -382,6 +383,7 @@ module SiSU_ODF parray << %{#{parablock}} if parablock =~/\S+/ end para=parray.join + '' + para end def table(para) # if para =~/