Support external file links.

This commit is contained in:
Tom Preston-Werner
2010-07-20 21:06:54 -05:00
parent 5b24f623a2
commit 9d68c4ef8a
2 changed files with 43 additions and 11 deletions
+10 -3
View File
@@ -180,10 +180,17 @@ module Gollum
# if it is not.
def process_file_link_tag(tag)
parts = tag.split('|')
name = parts[0].strip
path = parts[1] && parts[1].strip
name = parts[0].strip
path = parts[1] && parts[1].strip
path = if path && file = find_file(path)
::File.join @wiki.base_path, file.path
elsif path =~ /^https?:\/\/.+(jpg|png|gif|svg|bmp)$/
path
else
nil
end
if name && path && file = find_file(path)
if name && path
%{<a href="#{::File.join @wiki.base_path, file.path}">#{name}</a>}
else
nil