summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/helpers/application_helper.rb4
-rw-r--r--test/unit/helpers/application_helper_test.rb14
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">