Close unclosed pre/code tags (#4265).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3590 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2010-03-15 19:57:35 +00:00
parent 7203196212
commit 6b88de1234
2 changed files with 18 additions and 0 deletions

View File

@ -439,6 +439,10 @@ module ApplicationHelper
parsed << full_tag
end
end
# Close any non closing tags
while tag = tags.pop
parsed << "</#{tag}>"
end
parsed
end

View File

@ -324,6 +324,20 @@ EXPECTED
assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
end
def test_non_closing_pre_blocks_should_be_closed
raw = <<-RAW
<pre><code>
RAW
expected = <<-EXPECTED
<pre><code>
</code></pre>
EXPECTED
@project = Project.find(1)
assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
end
def test_syntax_highlight
raw = <<-RAW
<pre><code class="ruby">