Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki

This commit is contained in:
Jacques Distler 2011-08-23 14:39:30 -05:00
commit e26c12229e
3 changed files with 19 additions and 1 deletions

View file

@ -18,7 +18,7 @@ module Literal
# A literal chunk that protects 'code' and 'pre' tags from wiki rendering.
class Pre < AbstractLiteral
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
end

View file

@ -56,4 +56,16 @@ class NoWikiTest < Test::Unit::TestCase
)
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

View file

@ -44,6 +44,12 @@ class PageRendererTest < ActiveSupport::TestCase
assert_equal %w( HisWay SmartEngineGUI ), x_test_renderer(@revision).unexisting_pages.sort
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
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> " +