This commit is contained in:
bootstraponline
2012-10-13 13:04:51 -06:00
parent 432f9b8d2f
commit 5401cf2910
3 changed files with 10 additions and 3 deletions
+7
View File
@@ -23,5 +23,12 @@ module Precious
return url if url.nil?
url.gsub('%2F','/').gsub(/^\/+/,'')
end
def trim_leading_slash url
return url if url.nil?
url.gsub!('%2F','/')
return '/' + url.gsub(/^\/+/,'') if url[0,1] == '/'
url
end
end
end
+1 -1
View File
@@ -411,7 +411,7 @@ module Gollum
# //page is invalid
# strip all duplicate forward slashes using helpers.rb clean_url
# //page => /page
# link = one_leading_slash link
link = trim_leading_slash link
%{<a class="internal #{presence}" href="#{link}#{extra}">#{name}</a>}
end
+2 -2
View File
@@ -56,7 +56,7 @@ context "Markup" do
#########################################################################
test "absolute link to non-existant page" do
@wiki.write_page("linktest", :markdown, "[[/page]]", commit_details)
@wiki.write_page("linktest", :markdown, "[[/Page]]", commit_details)
# "<p>a <a class=\"internal absent\" href=\"/Foo\">Foo</a><a class=\"internal absent\" href=\"/Bar\">Bar</a> b</p>"
page = @wiki.page("linktest")
@@ -68,7 +68,7 @@ context "Markup" do
assert_equal 1, anchors.size
assert_equal 'internal absent', anchors[0]['class']
assert_equal '/Page', anchors[0]['href']
assert_equal 'Page', anchors[0].text
assert_equal '/Page', anchors[0].text
end
test "double page links no space" do