Fix file link with external path.

This commit is contained in:
Tom Preston-Werner
2010-07-20 22:26:13 -05:00
parent 8595ca5645
commit 8221bd6321
2 changed files with 12 additions and 1 deletions
+3 -1
View File
@@ -190,8 +190,10 @@ module Gollum
nil
end
if name && path
if name && path && file
%{<a href="#{::File.join @wiki.base_path, file.path}">#{name}</a>}
elsif name && path
%{<a href="#{path}">#{name}</a>}
else
nil
end
+9
View File
@@ -195,6 +195,15 @@ context "Markup" do
assert_equal %{<p>a <a href="/greek/alpha.jpg">Alpha</a> b</p>}, output
end
test "file link with external path" do
index = @wiki.repo.index
index.add("greek/Bilbo-Baggins.md", "a [[Alpha|http://example.com/alpha.jpg]] b")
index.commit("Add alpha.jpg")
page = @wiki.page("Bilbo Baggins")
assert_equal %{<p>a <a href="http://example.com/alpha.jpg">Alpha</a> b</p>}, page.formatted_data
end
test "code blocks" do
content = "a\n\n```ruby\nx = 1\n```\n\nb"
output = "<p>a</p>\n\n<div class=\"highlight\"><pre>" +