fix-31232.patch

Go MAEDA, 2019-04-20 11:36

Download (1.15 KB)

View differences:

lib/redmine/wiki_formatting/html_parser.rb
30 30
      }
31 31

  
32 32
      def self.to_text(html)
33
        html = html.gsub(/[\n\r]/, '').squeeze(' ')
33
        html = html.gsub(/^\s+/, '').tr("\n\r", '').squeeze(' ')
34 34
    
35 35
        doc = Loofah.document(html)
36 36
        doc.scrub!(WikiTags.new(tags))
test/unit/lib/redmine/wiki_formatting/html_parser_test.rb
34 34
    assert_equal "Text",
35 35
      @parser.to_text('<html><body><style>body {font-size: 0.8em;}</style>Text</body></html>')
36 36
  end
37

  
38
  def test_should_remove_preceding_whitespaces
39
    assert_equal "foo\n\nbar",
40
      @parser.to_text("<div>foo</div>\n<p>\n  bar\n</p>")
41
  end
37 42
end