diff options
author | Ralph Amissah <ralph@amissah.com> | 2007-07-30 09:06:51 +0100 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2007-07-30 09:06:51 +0100 |
commit | a99e0de5885441989c2ae9ae6fad15fd35d0bb97 (patch) | |
tree | c78f7a8ef21b06edd5e69b4396e45edc7b59aeb2 /lib/sisu/v0/shared_html_lite.rb | |
parent | using postive lookahead for url matching, test if to change (diff) |
url matching, semi-colon as possible terminator, in dal match https
Diffstat (limited to 'lib/sisu/v0/shared_html_lite.rb')
-rw-r--r-- | lib/sisu/v0/shared_html_lite.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index 43fb4446..1218aa79 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -88,8 +88,8 @@ module SiSU_Format_Shared @words=[] data.each do |word| @words << if word=~/\{(.+?)\}((?:https?|ftp)\S+|image)/ - if word =~/\{(.+?)\}((?:https?|ftp)\S+|image)([.,](?:\s|$))/ - m,u,d=/\{(.+?)\}((?:https?|ftp)\S+|image)([.,](?:\s|$))/.match(word).captures + if word =~/\{(.+?)\}((?:https?|ftp)\S+|image)([;.,](?:\s|$))/ + m,u,d=/\{(.+?)\}((?:https?|ftp)\S+|image)([;.,](?:\s|$))/.match(word).captures else m,u=/\{(.+?)\}((?:https?|ftp)\S+|image)/.match(word).captures d='' end @@ -131,9 +131,9 @@ module SiSU_Format_Shared words=word_mode.join(' ') para.gsub!(/.+/,words) end - para.gsub!(/\b[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration - para.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url - para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}<a href="\\2" target="_top">\\2</a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration + para.gsub!(/\b[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration + para.gsub!(/((?:^|\s)[}])((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url + para.gsub!(/(^|\s)((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?=\s|$))/,%{\\1#{@url_brace.xml_open}<a href="\\2" target="_top">\\2</a>#{@url_brace.xml_close}\\3}) #http ftp matches with decoration para end def paragraph |