From c638f388582a091464c77c88ea2696f7c38255be Mon Sep 17 00:00:00 2001 From: Krzysztof Kotlarek Date: Tue, 3 Aug 2021 15:02:42 +1000 Subject: [PATCH] Update to Nokogiri v1.12 Nokogiri v1.12 merged Nokogumbo code https://github.com/sparklemotion/nokogiri/releases/tag/v1.12.0 Therefore, Nokogumbo is not required as a dependency anymore. If tests are run with latest Nokogiri deprecation note is printed: ``` NOTE: nokogumbo: Using Nokogiri::HTML5 provided by Nokogiri. See https://github.com/sparklemotion/nokogiri/issues/2205 for more information. ``` --- lib/sanitize.rb | 2 +- sanitize.gemspec | 3 +-- test/test_sanitize.rb | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/sanitize.rb b/lib/sanitize.rb index 561c180..10b6b10 100644 --- a/lib/sanitize.rb +++ b/lib/sanitize.rb @@ -1,6 +1,6 @@ # encoding: utf-8 -require 'nokogumbo' +require 'nokogiri' require 'set' require_relative 'sanitize/version' diff --git a/sanitize.gemspec b/sanitize.gemspec index 6ba12cf..7c37693 100644 --- a/sanitize.gemspec +++ b/sanitize.gemspec @@ -18,8 +18,7 @@ Gem::Specification.new do |s| # Runtime dependencies. s.add_dependency('crass', '~> 1.0.2') - s.add_dependency('nokogiri', '>= 1.8.0') - s.add_dependency('nokogumbo', '~> 2.0') + s.add_dependency('nokogiri', '>= 1.12.0') # Development dependencies. s.add_development_dependency('minitest', '~> 5.11.3') diff --git a/test/test_sanitize.rb b/test/test_sanitize.rb index ea5e75d..2f7c72d 100644 --- a/test/test_sanitize.rb +++ b/test/test_sanitize.rb @@ -53,9 +53,9 @@ @s.document("a#{sample_non_chars}z").must_equal "az" end - describe 'when html body exceeds Nokogumbo::DEFAULT_MAX_TREE_DEPTH' do + describe 'when html body exceeds Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH' do let(:content) do - content = nest_html_content('foo', Nokogumbo::DEFAULT_MAX_TREE_DEPTH) + content = nest_html_content('foo', Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH) "#{content}" end @@ -115,9 +115,9 @@ @s.fragment("a#{sample_non_chars}z").must_equal "az" end - describe 'when html body exceeds Nokogumbo::DEFAULT_MAX_TREE_DEPTH' do + describe 'when html body exceeds Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH' do let(:content) do - content = nest_html_content('foo', Nokogumbo::DEFAULT_MAX_TREE_DEPTH) + content = nest_html_content('foo', Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH) "#{content}" end