Test page_name, not text
Fix from Jason Blevins.
This commit is contained in:
parent
c98d44606a
commit
9b857d3501
|
@ -87,7 +87,7 @@ class UrlGenerator < AbstractUrlGenerator
|
||||||
end
|
end
|
||||||
|
|
||||||
def page_link(mode, name, text, web_address, known_page)
|
def page_link(mode, name, text, web_address, known_page)
|
||||||
return %{<span class='wikilink-error'><b>Illegal link (contains a '.'):</b> [[#{text}]]</span>} if text.include?('.')
|
return %{<span class='wikilink-error'><b>Illegal link (target contains a '.'):</b> #{name}</span>} if name.include?('.')
|
||||||
case mode
|
case mode
|
||||||
when :export
|
when :export
|
||||||
if known_page
|
if known_page
|
||||||
|
|
|
@ -127,7 +127,7 @@ class StubUrlGenerator < AbstractUrlGenerator
|
||||||
|
|
||||||
def page_link(mode, name, text, web_address, known_page)
|
def page_link(mode, name, text, web_address, known_page)
|
||||||
link = CGI.escape(name)
|
link = CGI.escape(name)
|
||||||
return %{<span class='wikilink-error'><b>Illegal link (contains a '.'):</b> [[#{text}]]</span>} if text.include?('.')
|
return %{<span class='wikilink-error'><b>Illegal link (target contains a '.'):</b> #{name}</span>} if name.include?('.')
|
||||||
case mode
|
case mode
|
||||||
when :export
|
when :export
|
||||||
if known_page then %{<a class="existingWikiWord" href="#{link}.html">#{text}</a>}
|
if known_page then %{<a class="existingWikiWord" href="#{link}.html">#{text}</a>}
|
||||||
|
|
|
@ -161,7 +161,7 @@ class PageTest < ActiveSupport::TestCase
|
||||||
references = new_page.wiki_references(true)
|
references = new_page.wiki_references(true)
|
||||||
assert_equal( "<p>Reference to <a class='existingWikiWord' href='\.\./show/MyPage'>Happy Page</a>" +
|
assert_equal( "<p>Reference to <a class='existingWikiWord' href='\.\./show/MyPage'>Happy Page</a>" +
|
||||||
" and to <span class='newWikiWord'>Wanted Page2<a href='../show/WantedPage2'>?</a></span>.pdf " +
|
" and to <span class='newWikiWord'>Wanted Page2<a href='../show/WantedPage2'>?</a></span>.pdf " +
|
||||||
"and <span class='wikilink-error'><b>Illegal link (contains a '.'):</b> [[foo.pdf]]</span></p>",
|
"and <span class='wikilink-error'><b>Illegal link (target contains a '.'):</b> foo.pdf</span></p>",
|
||||||
test_renderer(new_page.revisions.last).display_content(true) )
|
test_renderer(new_page.revisions.last).display_content(true) )
|
||||||
assert_equal 3, references.size
|
assert_equal 3, references.size
|
||||||
# now it works.
|
# now it works.
|
||||||
|
|
Loading…
Reference in a new issue