image tag with relative path

This commit is contained in:
Tom Preston-Werner
2010-04-19 11:10:26 -07:00
parent 5f037e5e47
commit 342edec448
2 changed files with 22 additions and 5 deletions
+8 -2
View File
@@ -12,6 +12,7 @@ module Gollum
@name = page.name
@data = page.raw_data
@version = page.version.id
@dir = ::File.dirname(page.path)
@tagmap = {}
end
@@ -78,12 +79,17 @@ module Gollum
if name =~ /^\//
if file = @wiki.file(name[1..-1], @version)
%{<img src="#{file.name}" />}
%{<img src="/#{file.name}" />}
else
nil
end
else
nil
path = ::File.join(@dir, name)
if file = @wiki.file(path, @version)
%{<img src="/#{path}" />}
else
nil
end
end
end