Fix file link with external path.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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>" +
|
||||
|
||||
Reference in New Issue
Block a user