diff --git a/lib/redmine/wiki_formatting/textile/redcloth3.rb b/lib/redmine/wiki_formatting/textile/redcloth3.rb index 59d0551c2..51c13f561 100644 --- a/lib/redmine/wiki_formatting/textile/redcloth3.rb +++ b/lib/redmine/wiki_formatting/textile/redcloth3.rb @@ -298,6 +298,7 @@ class RedCloth3 < String @pre_list = [] rip_offtags text no_textile text + clean_html_comment text escape_html_tags text # need to do this before #hard_break and #blocks block_textile_quotes text unless @lite_mode @@ -1217,4 +1218,8 @@ class RedCloth3 < String end end end + + def clean_html_comment(text) + text.gsub!(//, '') + end end diff --git a/test/helpers/application_helper_test.rb b/test/helpers/application_helper_test.rb index 20b854cc7..f34daf55a 100644 --- a/test/helpers/application_helper_test.rb +++ b/test/helpers/application_helper_test.rb @@ -1300,7 +1300,6 @@ class ApplicationHelperTest < Redmine::HelperTest "
\nline 1\nline2
" => "
\nline 1\nline2
", "
\nline 1\nline2
" => "
\nline 1\nline2
", "
content
" => "
<div>content</div>
", - "HTML comment: " => "

HTML comment: <!-- no comments -->

", " + Hello world. + + Foo + +
+      This is a code block.
+      

+ +

+
+ STR + expected = <<~EXPECTED +

Hello world.

+ +

Foo

+ +
+      This is a code block.
+      <p>
+      <!-- comments in a code block should be preserved -->
+      </p>
+      
+ + EXPECTED + assert_equal expected.gsub(%r{[\r\n\t]}, ''), to_html(text).gsub(%r{[\r\n\t]}, '') + end + private def assert_html_output(to_test, expect_paragraph = true)