diff --git a/lib/core_ext/string.rb b/lib/core_ext/string.rb index a81cf8073..74b253869 100644 --- a/lib/core_ext/string.rb +++ b/lib/core_ext/string.rb @@ -225,7 +225,7 @@ class String string.gsub!(/[[:blank:]]+$/, '') # remove double multiple empty lines - string.gsub!(/\n\n\n/, "\n\n") + string.gsub!(/\n\n\n+/, "\n\n") # add extracted links if link_list != '' @@ -233,7 +233,7 @@ class String end # remove double multiple empty lines - string.gsub!(/\n\n\n/, "\n\n") + string.gsub!(/\n\n\n+/, "\n\n") string.strip end diff --git a/test/unit/aaa_string_test.rb b/test/unit/aaa_string_test.rb index 4b2851c37..1f71498bf 100644 --- a/test/unit/aaa_string_test.rb +++ b/test/unit/aaa_string_test.rb @@ -1,6 +1,7 @@ # encoding: utf-8 +# rubocop:disable all require 'test_helper' -# rubocop:disable TrailingWhitespace + class AaaStringTest < ActiveSupport::TestCase test 'to_filename ref' do @@ -131,7 +132,7 @@ class AaaStringTest < ActiveSupport::TestCase html = "\n
Best Tool of the World some other text
" - result = "[1] Best Tool of the Worldsome other text\n\n\n[1] http://zammad.org" + result = "[1] Best Tool of the Worldsome other text\n\n[1] http://zammad.org" assert_equal(result, html.html2text) html = " @@ -141,6 +142,10 @@ class AaaStringTest < ActiveSupport::TestCase result = "test\n\n___" assert_equal(result, html.html2text) + html = "test


--
abc
" + result = "test\n\n--\nabc" + assert_equal(result, html.html2text) + html = "Ihr RZ-Team