Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki
This commit is contained in:
commit
e26c12229e
|
@ -18,7 +18,7 @@ module Literal
|
||||||
# A literal chunk that protects 'code' and 'pre' tags from wiki rendering.
|
# A literal chunk that protects 'code' and 'pre' tags from wiki rendering.
|
||||||
class Pre < AbstractLiteral
|
class Pre < AbstractLiteral
|
||||||
PRE_BLOCKS = "a|pre|code|math"
|
PRE_BLOCKS = "a|pre|code|math"
|
||||||
PRE_PATTERN = Regexp.new('<('+PRE_BLOCKS+')\b[^>]*?>.*?</\1>', Regexp::MULTILINE)
|
PRE_PATTERN = Regexp.new('<('+PRE_BLOCKS+')\b[^>]*?(>.*?</\1>|/>)', Regexp::MULTILINE)
|
||||||
def self.pattern() PRE_PATTERN end
|
def self.pattern() PRE_PATTERN end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -56,4 +56,16 @@ class NoWikiTest < Test::Unit::TestCase
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_sanitize_empty_nowiki
|
||||||
|
match(NoWiki, "<nowiki></nowiki>",
|
||||||
|
:plain_text => ''
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_sanitize_blank_nowiki
|
||||||
|
match(NoWiki, "<nowiki>\n</nowiki>",
|
||||||
|
:plain_text => "\n"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -44,6 +44,12 @@ class PageRendererTest < ActiveSupport::TestCase
|
||||||
assert_equal %w( HisWay SmartEngineGUI ), x_test_renderer(@revision).unexisting_pages.sort
|
assert_equal %w( HisWay SmartEngineGUI ), x_test_renderer(@revision).unexisting_pages.sort
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_wiki_links_after_empty
|
||||||
|
assert_markup_parsed_as(%{<code/>\n<p>This is a <span class='newWikiWord'>wikilink<a href=} +
|
||||||
|
%{'../show/wikilink'>?</a></span>.</p>},
|
||||||
|
"<code></code>\n\nThis is a [[wikilink]].")
|
||||||
|
end
|
||||||
|
|
||||||
def test_content_with_wiki_links
|
def test_content_with_wiki_links
|
||||||
assert_equal "<p><span class='newWikiWord'>His Way<a href='../show/HisWay'>?</a></span> " +
|
assert_equal "<p><span class='newWikiWord'>His Way<a href='../show/HisWay'>?</a></span> " +
|
||||||
"would be <a class='existingWikiWord' href='../show/MyWay'>My Way</a> " +
|
"would be <a class='existingWikiWord' href='../show/MyWay'>My Way</a> " +
|
||||||
|
|
Loading…
Reference in a new issue