aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/html_tune.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2007-07-09 11:19:48 +0100
committerRalph Amissah <ralph@amissah.com>2007-07-09 11:19:48 +0100
commitfdd1489c82a274615e46e3c67fc5707e3fb0465f (patch)
tree1241b19a94118352dbb16cbc3f02483a51919ce8 /lib/sisu/v0/html_tune.rb
parentsisu-0.55.2 + md5s (diff)
improved url matching, and texpdf tolerance and indentation levels set
Diffstat (limited to 'lib/sisu/v0/html_tune.rb')
-rw-r--r--lib/sisu/v0/html_tune.rb18
1 files changed, 4 insertions, 14 deletions
diff --git a/lib/sisu/v0/html_tune.rb b/lib/sisu/v0/html_tune.rb
index 1fb282de..1d3461c3 100644
--- a/lib/sisu/v0/html_tune.rb
+++ b/lib/sisu/v0/html_tune.rb
@@ -196,6 +196,7 @@ module SiSU_Tune
@sys=SiSU_Env::System_call.new
@dp=@@dp ||=SiSU_Env::Info_env.new.digest.pattern
@env=SiSU_Env::Info_env.new(@md.fns)
+ @url_brace=SiSU_Viz::Skin.new.url_decoration
#@utf8=SiSU_character_encode::UTF8 #.new
end
def songsheet
@@ -324,20 +325,9 @@ module SiSU_Tune
if (para =~/\b\S+\@\S+?\.\S+/ and para !~/(\"\S+\@\S+?\.\S+\"|>\S+\@\S+?\.\S+?<)/)
para.gsub!(/\b(\S+\@\S+?\.\S+)(\s)/,'&lt;<a href="mailto:\1">\1</a>&gt;\2')
end
- if (para !~/(\"\w+:\/\/\S+?\"|>\s*\w+:\/\/\w+?\S*<)/) #url markup http etc.
- if para=~/\w+:\/\/\S+?\.\S+?[.,] /
- para.gsub!(/(\w+:\/\/\S+?\.\S+?)([.,] )/,'&lt;<a href="\1" target="_top">\1</a>&gt;\2') #full stops ! have been a bother
- else
- para.gsub!(/(\w+:\/\/\S+?\.\S+)/, '&lt;<a href="\1" target="_top">\1</a>&gt;')
- end
- end
- if (para =~/[ ^](?:https?|ftp):\/\/\S+/) #url markup http leftovers watch carefully may accept too much 2004w46
- if para=~/([ ^])((?:https?|ftp):\/\/\S+?)([\.,] )/
- para.gsub!(/([ ^])((?:https?|ftp):\/\/\S+?)([\.,] )/,'\1&lt;<a href="\2" target="_top">\2</a>&gt;\3') #full stops ! have been a bother
- else
- para.gsub!(/([ ^])((?:https?|ftp):\/\/\S+)/,'\1&lt;<a href="\2" target="_top">\2</a>&gt;')
- end
- end
+ para.gsub!(/(^|\s)[_\\]((?:https?|ftp):\/\/\S+?\.[^'"><\s]+?)([.,]?(?:\s|$))/,'\1<a href="\2" target="_top">\2</a>\3') #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
if (para =~/..\/\S+/ and para !~/(\"..\/\S+?\"|>\s*..\/\S+<)/)
para.gsub!(/(\.\.\/\S+)/,'<a href="\1">\1</a>')
end