Skip to content

Commit

Permalink
Update to Nokogiri v1.12
Browse files Browse the repository at this point in the history
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 sparklemotion/nokogiri#2205 for more information.
```
  • Loading branch information
lis2 committed Aug 3, 2021
1 parent a683341 commit c638f38
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/sanitize.rb
@@ -1,6 +1,6 @@
# encoding: utf-8

require 'nokogumbo'
require 'nokogiri'
require 'set'

require_relative 'sanitize/version'
Expand Down
3 changes: 1 addition & 2 deletions sanitize.gemspec
Expand Up @@ -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')
Expand Down
8 changes: 4 additions & 4 deletions test/test_sanitize.rb
Expand Up @@ -53,9 +53,9 @@
@s.document("a#{sample_non_chars}z").must_equal "<html>az</html>"
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('<b>foo</b>', Nokogumbo::DEFAULT_MAX_TREE_DEPTH)
content = nest_html_content('<b>foo</b>', Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH)
"<html>#{content}</html>"
end

Expand Down Expand Up @@ -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('<b>foo</b>', Nokogumbo::DEFAULT_MAX_TREE_DEPTH)
content = nest_html_content('<b>foo</b>', Nokogiri::Gumbo::DEFAULT_MAX_TREE_DEPTH)
"<body>#{content}</body>"
end

Expand Down

0 comments on commit c638f38

Please sign in to comment.