diff options
author | Ralph Amissah <ralph@amissah.com> | 2008-08-12 23:37:42 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2008-08-12 23:37:42 -0400 |
commit | d43865fb6a093625a77e8605d6fb00158546e1e4 (patch) | |
tree | 5386383af935307af234e4389e8c243ee3368f83 /lib/sisu/v0/shared_html_lite.rb | |
parent | sisu-0.68.0 + sha256 (diff) |
html increased use of css; dal, middle layer, url representation, interim commit
Diffstat (limited to 'lib/sisu/v0/shared_html_lite.rb')
-rw-r--r-- | lib/sisu/v0/shared_html_lite.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb index a930821e..a4e40685 100644 --- a/lib/sisu/v0/shared_html_lite.rb +++ b/lib/sisu/v0/shared_html_lite.rb @@ -92,10 +92,10 @@ module SiSU_Format_Shared def urls(data) @words=[] data.each do |word| - @words << if word=~/\{(.+?)\}((?:https?|file|ftp)\S+|image)/ - if word =~/\{(.+?)\}((?:https?|file|ftp)\S+|image)([;.,](?:\s|$))/ - m,u,d=/\{(.+?)\}((?:https?|file|ftp)\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+|image)([;.,](?:\s|$))/ + m,u,d=/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}((?:https?|file|ftp)\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 word=case m @@ -114,14 +114,14 @@ module SiSU_Format_Shared %{<a href="#{u}">[#{png}]</a>#{caption}} else %{[#{png}] #{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=%{<a href="#{u}">#{link}</a>#{d}} #ins=%{#{link} <a href="#{u}">[link]</a>#{d}} - word.gsub!(/\{.+?\}(?:https?|file|ftp)\S+/,ins) + word.gsub!(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:https?|file|ftp)\S+/,ins) end else word end @@ -131,14 +131,14 @@ module SiSU_Format_Shared end def markup(para) if para !~/^#{Mx[:gr_o]}:code#{Mx[:gr_c]}/ - if para =~/\{.+?\}((?:https?|file|ftp)\S+|image)/ - wm=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|\S+/) + if para =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}((?:https?|file|ftp)\S+|image)/ + wm=para.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp)\S+|image)|\S+/) words=urls(wm) para.gsub!(/.+/m,words) end para.gsub!(/#{Mx[:pa_o]}:i[1-9]#{Mx[:pa_c]}/m,'') para.gsub!(/\b[_\\]((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'<a href="\1" target="_top">\1</a>\2') #http ftp matches escaped, no decoration - para.gsub!(/((?:^|\s)[}])((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url + para.gsub!(/((?:^|\s)#{Mx[:lnk_c]})((?:https?|file|ftp):\/\/\S+?\.[^'"><\s]+?)([;.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #special case \{ e.g. \}http://url para.gsub!(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|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 else para.gsub!(/(^|[^}])_</m,'\1<'); para.gsub!(/(^|[^}])_>/m,'\1>') #code-block: angle brackets special characters |