From d22fa2e1bb66a35fa52b9466c0bd8b7f18f2b104 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 8 Jul 2020 22:08:31 -0700 Subject: [PATCH 1/3] Update some allowed HTML errors. --- lib/rdf/rdfa/reader/nokogiri.rb | 6 ++++-- spec/suite_spec.rb | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/rdf/rdfa/reader/nokogiri.rb b/lib/rdf/rdfa/reader/nokogiri.rb index e62b1a4..4640fbc 100644 --- a/lib/rdf/rdfa/reader/nokogiri.rb +++ b/lib/rdf/rdfa/reader/nokogiri.rb @@ -34,7 +34,7 @@ def initialize(node, parent = nil) # # @return [String] def language - language = case + case when @node.attribute_with_ns("lang", RDF::XML.to_s) @node.attribute_with_ns("lang", RDF::XML.to_s) when @node.attribute("xml:lang") @@ -286,7 +286,9 @@ def doc_errors # FIXME: Nokogiri version 1.5 thinks many HTML5 elements are invalid, so just ignore all Tag errors. # Nokogumbo might make this simpler if @host_language == :html5 - @doc.errors.reject {|e| e.to_s =~ /The doctype must be the first token in the document/} + @doc.errors.reject {|e| + e.to_s =~ /(The doctype must be the first token in the document)|(Expected a doctype token)|(Unexpected '\?' where start tag name is expected)/ + } else @doc.errors.reject {|e| e.to_s =~ /(?:Tag \w+ invalid)|(?:Missing attribute name)/} end diff --git a/spec/suite_spec.rb b/spec/suite_spec.rb index a7dde27..edaf103 100644 --- a/spec/suite_spec.rb +++ b/spec/suite_spec.rb @@ -14,7 +14,6 @@ Fixtures::TestCase.for_specific(host_language, version, Fixtures::TestCase::Test.send(classification)) do |t| specify "test #{t.num}: #{t.description}#{", (negative test)" if t.expectedResults.false?}" do skip "CDN messes up email addresses" if %w(0065 0176).include?(t.num) - pending "Nokogumbo error" if t.num == "0216" && host_language == "xhtml5" skip "XMLLiteral" if %w(0198 0212).include?(t.num) begin t.logger = RDF::Spec.logger From 50f241a6b4282c79e8d22e66e458c69c1b376306 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 8 Jul 2020 22:27:10 -0700 Subject: [PATCH 2/3] Update allowed HTML errors. --- lib/rdf/rdfa/reader/nokogiri.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rdf/rdfa/reader/nokogiri.rb b/lib/rdf/rdfa/reader/nokogiri.rb index 4640fbc..353a8a8 100644 --- a/lib/rdf/rdfa/reader/nokogiri.rb +++ b/lib/rdf/rdfa/reader/nokogiri.rb @@ -286,9 +286,9 @@ def doc_errors # FIXME: Nokogiri version 1.5 thinks many HTML5 elements are invalid, so just ignore all Tag errors. # Nokogumbo might make this simpler if @host_language == :html5 - @doc.errors.reject {|e| - e.to_s =~ /(The doctype must be the first token in the document)|(Expected a doctype token)|(Unexpected '\?' where start tag name is expected)/ - } + @doc.errors.reject do |e| + e.to_s =~ %r{(The doctype must be the first token in the document)|(Expected a doctype token)|(Unexpected '\?' where start tag name is expected)} + end else @doc.errors.reject {|e| e.to_s =~ /(?:Tag \w+ invalid)|(?:Missing attribute name)/} end From 509f29b40e54d1612cbdf84149abd1546c97608f Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Wed, 8 Jul 2020 22:27:58 -0700 Subject: [PATCH 3/3] Version 3.1.2. --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 94ff29c..ef538c2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.1.1 +3.1.2