Project

General

Profile

Defect #31232 » fix-31232.patch

Go MAEDA, 2019-04-20 11:36

View differences:

lib/redmine/wiki_formatting/html_parser.rb
}
def self.to_text(html)
html = html.gsub(/[\n\r]/, '').squeeze(' ')
html = html.gsub(/^\s+/, '').tr("\n\r", '').squeeze(' ')
doc = Loofah.document(html)
doc.scrub!(WikiTags.new(tags))
test/unit/lib/redmine/wiki_formatting/html_parser_test.rb
assert_equal "Text",
@parser.to_text('<html><body><style>body {font-size: 0.8em;}</style>Text</body></html>')
end
def test_should_remove_preceding_whitespaces
assert_equal "foo\n\nbar",
@parser.to_text("<div>foo</div>\n<p>\n bar\n</p>")
end
end
(3-3/5)