diff --git a/lib/chunks/literal.rb b/lib/chunks/literal.rb
index da17c9b9..9602f2ad 100644
--- a/lib/chunks/literal.rb
+++ b/lib/chunks/literal.rb
@@ -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
diff --git a/test/unit/chunks/nowiki_test.rb b/test/unit/chunks/nowiki_test.rb
index bbd00856..96e5bfd3 100755
--- a/test/unit/chunks/nowiki_test.rb
+++ b/test/unit/chunks/nowiki_test.rb
@@ -56,4 +56,16 @@ class NoWikiTest < Test::Unit::TestCase
)
end
+ def test_sanitize_empty_nowiki
+ match(NoWiki, "\n
This is a wikilink?.
}, + "
\n\nThis is a [[wikilink]].")
+ end
+
def test_content_with_wiki_links
assert_equal "