aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0/shared_html_lite.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0/shared_html_lite.rb')
-rw-r--r--lib/sisu/v0/shared_html_lite.rb22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/sisu/v0/shared_html_lite.rb b/lib/sisu/v0/shared_html_lite.rb
index df6b0bcb..f258f0a9 100644
--- a/lib/sisu/v0/shared_html_lite.rb
+++ b/lib/sisu/v0/shared_html_lite.rb
@@ -87,10 +87,10 @@ module SiSU_Format_Shared
def urls(data)
@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
- else m,u=/\{(.+?)\}((?:https?|ftp)\S+|image)/.match(word).captures
+ @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
d=''
end
case m
@@ -108,14 +108,14 @@ module SiSU_Format_Shared
%{<a href="#{u}">[#{png}]</a>#{caption}}
else %{[#{png}] #{caption}}
end
- word.gsub!(/\{.+?\}((?:https?|ftp)\S+|image)/,ins)
+ word.gsub!(/\{.+?\}((?: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?|ftp)\S+/,ins)
+ word.gsub!(/\{.+?\}(?:https?|file|ftp)\S+/,ins)
end
word
else word
@@ -126,15 +126,15 @@ module SiSU_Format_Shared
end
def markup(para)
if para !~/^<:code>/
- if para =~/\{.+?\}((?:http|ftp)\S+|image)/
- wm=para.scan(/\{.+?\}(?:(?:https?|ftp)\S+|image)|\S+/)
+ if para =~/\{.+?\}((?:https?|file|ftp)\S+|image)/
+ wm=para.scan(/\{.+?\}(?:(?:https?|file|ftp)\S+|image)|\S+/)
word_mode=urls(wm)
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?|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)((?: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,'&lt;'); para.gsub!(/_>/m,'&gt;') #code-block: angle brackets special characters
end
para