diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b4eaa91..c490f2b 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 011df82..11bbe90 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 +
+RAW
+
+ expected = <<-EXPECTED
+
+
+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