diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-03-15 19:57:35 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2010-03-15 19:57:35 +0000 |
commit | 6b88de1234524faa3beae8b54b2887dbb4a2867c (patch) | |
tree | 6f3f234aef8738c535a00e223e613d4d0d3a694c | |
parent | 7203196212ae78d3723c0df4c661a3c03769135a (diff) | |
download | redmine-6b88de1234524faa3beae8b54b2887dbb4a2867c.tar.gz redmine-6b88de1234524faa3beae8b54b2887dbb4a2867c.zip |
Close unclosed pre/code tags (#4265).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3590 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/helpers/application_helper.rb | 4 | ||||
-rw-r--r-- | test/unit/helpers/application_helper_test.rb | 14 |
2 files changed, 18 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b4eaa91de..c490f2b13 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -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 diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index 011df82fe..11bbe908d 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -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"> |