From d43865fb6a093625a77e8605d6fb00158546e1e4 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 12 Aug 2008 23:37:42 -0400 Subject: html increased use of css; dal, middle layer, url representation, interim commit --- lib/sisu/v0/html_tune.rb | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'lib/sisu/v0/html_tune.rb') diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb index 11976af9..9cc50b23 100644 --- a/lib/sisu/v0/html_tune.rb +++ b/lib/sisu/v0/html_tune.rb @@ -254,10 +254,10 @@ module SiSU_Tune def urls(data) @words=[] data.each do |word| - @words << if word=~/\{(.+?)\}((?:https?|file|ftp)\S+|image)/ - if word =~/\{.+?\}(?:(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?|image)[;.,]?(?:\s|$)/ - m,u,d=/\{(.+?)\}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?|image)([;.,]?(?:\s|$))/.match(word).captures - else m,u=/\{(.+?)\}((?:https?|file|ftp)\S+|image)/.match(word).captures + @words << if word=~/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/ + if word =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?|image)[;.,]?(?:\s|$)/ + m,u,d=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?|image)([;.,]?(?:\s|$))/.match(word).captures + else m,u=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/.match(word).captures d='' end case m @@ -276,13 +276,13 @@ module SiSU_Tune %{#{caption}} else %{#{caption}} end - word.gsub!(/\{.+?\}((?:https?|file|ftp)\S+|image)/,ins) + word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/,ins) else link=m[/(.+)/m] png=m.scan(/\S+/)[0].strip link=link.strip ins=%{#{link}#{d}} - word.gsub!(/\{.+?\}(?:https?|file|ftp)\S+/,ins) + word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp)\S+/,ins) end word else word @@ -313,8 +313,8 @@ module SiSU_Tune para.gsub!(/<:image\s+(\S+)\s+>/, %{}) end - if para =~/\{.+?\}((?:https?|file|ftp)\S+|image)/ - @word_mode=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|\S+/u) + if para =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/ + @word_mode=para.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp)\S+|image)|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|\S+/u) words=urls(@word_mode) para.gsub!(/.+/m,words) end @@ -336,7 +336,7 @@ module SiSU_Tune para.gsub!(/([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)/,'<\1>') end para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2') #http ftp matches escaped, no decoration - para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2\3') #special case \{ e.g. \}http://url + para.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1\2\3') #special case \{ e.g. \}http://url para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}\\2#{@url_brace.xml_close}\\3}) #http ftp matches with decoration if para =~/..\/\S+/ \ and para !~/(\"..\/\S+?\"|>\s*..\/\S+<)/ -- cgit v1.2.3