mirror of
https://github.com/discourse/discourse.git
synced 2025-01-16 01:02:41 +08:00
DEV: Remove invalid parsing options (#30545)
HTML5 parser doesn't have those options
This commit is contained in:
parent
bba4c9b005
commit
145c7e46e1
|
@ -1,6 +1,5 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "nokogiri/xml/parse_options"
|
||||
RSpec::Matchers.define :match_html do |expected|
|
||||
match { |actual| make_canonical_html(expected).eql? make_canonical_html(actual) }
|
||||
|
||||
|
@ -13,11 +12,7 @@ RSpec::Matchers.define :match_html do |expected|
|
|||
end
|
||||
|
||||
def make_canonical_html(html)
|
||||
doc =
|
||||
Nokogiri.HTML5(html) do |config|
|
||||
config[:options] = Nokogiri::XML::ParseOptions::NOBLANKS |
|
||||
Nokogiri::XML::ParseOptions::COMPACT
|
||||
end
|
||||
doc = Nokogiri.HTML5(html)
|
||||
|
||||
doc.traverse do |node|
|
||||
node.content = node.content.gsub(/\s+/, " ").strip if node.node_name&.downcase == "text"
|
||||
|
|
Loading…
Reference in New Issue
Block a user