diff --git a/lib/core_ext/string.rb b/lib/core_ext/string.rb index 98b3071d9..a81cf8073 100644 --- a/lib/core_ext/string.rb +++ b/lib/core_ext/string.rb @@ -88,6 +88,9 @@ class String string = string.chars.select(&:valid_encoding?).join end + # remove html comments + string.gsub!(//m, '') + # find and replace it with [x] link_list = '' counter = 0 diff --git a/test/unit/aaa_string_test.rb b/test/unit/aaa_string_test.rb index ebf6ccf7b..4b2851c37 100644 --- a/test/unit/aaa_string_test.rb +++ b/test/unit/aaa_string_test.rb @@ -141,6 +141,19 @@ class AaaStringTest < ActiveSupport::TestCase result = "test\n\n___" assert_equal(result, html.html2text) + html = "Ihr RZ-Team
+
+" + result = 'Ihr RZ-Team' + assert_equal(result, html.html2text) + html = ' line 1
you
-----&'