nokogiri 1.15.5-x86-mingw32 → 1.16.0.rc1-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of nokogiri might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +11 -14
- data/README.md +1 -1
- data/dependencies.yml +5 -5
- data/ext/nokogiri/extconf.rb +3 -4
- data/ext/nokogiri/html4_sax_push_parser.c +1 -1
- data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +23 -0
- data/ext/nokogiri/include/libxml2/libxml/SAX.h +0 -2
- data/ext/nokogiri/include/libxml2/libxml/SAX2.h +0 -2
- data/ext/nokogiri/include/libxml2/libxml/c14n.h +0 -2
- data/ext/nokogiri/include/libxml2/libxml/dict.h +1 -0
- data/ext/nokogiri/include/libxml2/libxml/encoding.h +16 -14
- data/ext/nokogiri/include/libxml2/libxml/entities.h +4 -0
- data/ext/nokogiri/include/libxml2/libxml/globals.h +15 -503
- data/ext/nokogiri/include/libxml2/libxml/hash.h +57 -61
- data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +2 -2
- data/ext/nokogiri/include/libxml2/libxml/parser.h +128 -18
- data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +1 -0
- data/ext/nokogiri/include/libxml2/libxml/relaxng.h +2 -1
- data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +1 -0
- data/ext/nokogiri/include/libxml2/libxml/schematron.h +1 -0
- data/ext/nokogiri/include/libxml2/libxml/threads.h +4 -11
- data/ext/nokogiri/include/libxml2/libxml/tree.h +68 -20
- data/ext/nokogiri/include/libxml2/libxml/uri.h +2 -1
- data/ext/nokogiri/include/libxml2/libxml/valid.h +2 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +65 -12
- data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +37 -8
- data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +37 -40
- data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +6 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +2 -9
- data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +9 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +3 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +28 -43
- data/ext/nokogiri/include/libxml2/libxml/xpath.h +1 -1
- data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +2 -1
- data/ext/nokogiri/include/libxml2/libxml/xpointer.h +5 -4
- data/ext/nokogiri/nokogiri.h +10 -3
- data/ext/nokogiri/test_global_handlers.c +1 -1
- data/ext/nokogiri/xml_cdata.c +1 -2
- data/ext/nokogiri/xml_document.c +3 -3
- data/ext/nokogiri/xml_namespace.c +0 -4
- data/ext/nokogiri/xml_node.c +5 -8
- data/ext/nokogiri/xml_reader.c +1 -44
- data/ext/nokogiri/xml_relax_ng.c +1 -1
- data/ext/nokogiri/xml_sax_push_parser.c +1 -1
- data/ext/nokogiri/xml_schema.c +2 -3
- data/ext/nokogiri/xml_syntax_error.c +3 -3
- data/ext/nokogiri/xml_text.c +1 -2
- data/ext/nokogiri/xml_xpath_context.c +2 -5
- data/gumbo-parser/Makefile +15 -0
- data/lib/nokogiri/3.0/nokogiri.so +0 -0
- data/lib/nokogiri/3.1/nokogiri.so +0 -0
- data/lib/nokogiri/3.2/nokogiri.so +0 -0
- data/lib/nokogiri/{2.7 → 3.3}/nokogiri.so +0 -0
- data/lib/nokogiri/css/parser_extras.rb +1 -1
- data/lib/nokogiri/css/xpath_visitor.rb +1 -21
- data/lib/nokogiri/html4/document.rb +1 -1
- data/lib/nokogiri/html4/encoding_reader.rb +1 -1
- data/lib/nokogiri/html5.rb +0 -66
- data/lib/nokogiri/version/constant.rb +1 -1
- data/lib/nokogiri/version/info.rb +6 -5
- data/lib/nokogiri/xml/attr.rb +2 -2
- data/lib/nokogiri/xml/document.rb +3 -3
- data/lib/nokogiri/xml/document_fragment.rb +2 -2
- data/lib/nokogiri/xml/namespace.rb +1 -2
- data/lib/nokogiri/xml/node.rb +6 -5
- data/lib/nokogiri/xml/node_set.rb +3 -3
- data/lib/nokogiri/xml/searchable.rb +3 -3
- data/lib/nokogiri/xml/syntax_error.rb +1 -1
- data/lib/nokogiri/xml.rb +1 -1
- data/lib/nokogiri/xslt.rb +1 -1
- data/lib/nokogiri.rb +1 -1
- metadata +7 -7
data/lib/nokogiri/html5.rb
CHANGED
@@ -239,23 +239,6 @@ module Nokogiri
|
|
239
239
|
DocumentFragment.parse(string, encoding, options)
|
240
240
|
end
|
241
241
|
|
242
|
-
# Fetch and parse a HTML document from the web, following redirects,
|
243
|
-
# handling https, and determining the character encoding using HTML5
|
244
|
-
# rules. +uri+ may be a +String+ or a +URI+. +options+ contains
|
245
|
-
# http headers and special options. Everything which is not a
|
246
|
-
# special option is considered a header. Special options include:
|
247
|
-
# * :follow_limit => number of redirects which are followed
|
248
|
-
# * :basic_auth => [username, password]
|
249
|
-
def get(uri, options = {})
|
250
|
-
# TODO: deprecate
|
251
|
-
warn(
|
252
|
-
"Nokogiri::HTML5.get is deprecated and will be removed in a future version of Nokogiri.",
|
253
|
-
uplevel: 1,
|
254
|
-
category: :deprecated,
|
255
|
-
)
|
256
|
-
get_impl(uri, options)
|
257
|
-
end
|
258
|
-
|
259
242
|
# :nodoc:
|
260
243
|
def read_and_encode(string, encoding)
|
261
244
|
# Read the string with the given encoding.
|
@@ -283,55 +266,6 @@ module Nokogiri
|
|
283
266
|
|
284
267
|
private
|
285
268
|
|
286
|
-
def get_impl(uri, options = {})
|
287
|
-
headers = options.clone
|
288
|
-
headers = { follow_limit: headers } if Numeric === headers # deprecated
|
289
|
-
limit = headers[:follow_limit] ? headers.delete(:follow_limit).to_i : 10
|
290
|
-
|
291
|
-
require "net/http"
|
292
|
-
uri = URI(uri) unless URI === uri
|
293
|
-
|
294
|
-
http = Net::HTTP.new(uri.host, uri.port)
|
295
|
-
|
296
|
-
# TLS / SSL support
|
297
|
-
http.use_ssl = true if uri.scheme == "https"
|
298
|
-
|
299
|
-
# Pass through Net::HTTP override values, which currently include:
|
300
|
-
# :ca_file, :ca_path, :cert, :cert_store, :ciphers,
|
301
|
-
# :close_on_empty_response, :continue_timeout, :key, :open_timeout,
|
302
|
-
# :read_timeout, :ssl_timeout, :ssl_version, :use_ssl,
|
303
|
-
# :verify_callback, :verify_depth, :verify_mode
|
304
|
-
options.each do |key, _value|
|
305
|
-
http.send("#{key}=", headers.delete(key)) if http.respond_to?("#{key}=")
|
306
|
-
end
|
307
|
-
|
308
|
-
request = Net::HTTP::Get.new(uri.request_uri)
|
309
|
-
|
310
|
-
# basic authentication
|
311
|
-
auth = headers.delete(:basic_auth)
|
312
|
-
auth ||= [uri.user, uri.password] if uri.user && uri.password
|
313
|
-
request.basic_auth(auth.first, auth.last) if auth
|
314
|
-
|
315
|
-
# remaining options are treated as headers
|
316
|
-
headers.each { |key, value| request[key.to_s] = value.to_s }
|
317
|
-
|
318
|
-
response = http.request(request)
|
319
|
-
|
320
|
-
case response
|
321
|
-
when Net::HTTPSuccess
|
322
|
-
doc = parse(reencode(response.body, response["content-type"]), options)
|
323
|
-
doc.instance_variable_set(:@response, response)
|
324
|
-
doc.class.send(:attr_reader, :response)
|
325
|
-
doc
|
326
|
-
when Net::HTTPRedirection
|
327
|
-
response.value if limit <= 1
|
328
|
-
location = URI.join(uri, response["location"])
|
329
|
-
get_impl(location, options.merge(follow_limit: limit - 1))
|
330
|
-
else
|
331
|
-
response.value
|
332
|
-
end
|
333
|
-
end
|
334
|
-
|
335
269
|
# Charset sniffing is a complex and controversial topic that understandably isn't done _by
|
336
270
|
# default_ by the Ruby Net::HTTP library. This being said, it is a very real problem for
|
337
271
|
# consumers of HTML as the default for HTML is iso-8859-1, most "good" producers use utf-8, and
|
@@ -94,11 +94,14 @@ module Nokogiri
|
|
94
94
|
nokogiri["version"] = Nokogiri::VERSION
|
95
95
|
|
96
96
|
unless jruby?
|
97
|
-
# enable gems
|
97
|
+
# enable gems to build against Nokogiri with the following in their extconf.rb:
|
98
98
|
#
|
99
99
|
# append_cflags(Nokogiri::VERSION_INFO["nokogiri"]["cppflags"])
|
100
100
|
# append_ldflags(Nokogiri::VERSION_INFO["nokogiri"]["ldflags"])
|
101
101
|
#
|
102
|
+
# though, this won't work on all platform and versions of Ruby, and won't be supported
|
103
|
+
# forever, see https://github.com/sparklemotion/nokogiri/discussions/2746 for context.
|
104
|
+
#
|
102
105
|
cppflags = ["-I#{header_directory.shellescape}"]
|
103
106
|
ldflags = []
|
104
107
|
|
@@ -108,7 +111,8 @@ module Nokogiri
|
|
108
111
|
end
|
109
112
|
|
110
113
|
if windows?
|
111
|
-
# on windows,
|
114
|
+
# on windows, third party libraries that wish to link against nokogiri
|
115
|
+
# should link against nokogiri.so to resolve symbols. see #2167
|
112
116
|
lib_directory = File.expand_path(File.join(File.dirname(__FILE__), "../#{ruby_minor}"))
|
113
117
|
unless File.exist?(lib_directory)
|
114
118
|
lib_directory = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
@@ -136,9 +140,6 @@ module Nokogiri
|
|
136
140
|
libxml["source"] = "packaged"
|
137
141
|
libxml["precompiled"] = libxml2_precompiled?
|
138
142
|
libxml["patches"] = Nokogiri::LIBXML2_PATCHES
|
139
|
-
|
140
|
-
# this is for nokogumbo and shouldn't be forever
|
141
|
-
libxml["libxml2_path"] = header_directory
|
142
143
|
else
|
143
144
|
libxml["source"] = "system"
|
144
145
|
end
|
data/lib/nokogiri/xml/attr.rb
CHANGED
@@ -18,8 +18,6 @@ module Nokogiri
|
|
18
18
|
# - +value+ → (String) The value of the attribute.
|
19
19
|
# - +namespace+ → (Namespace, nil) The Namespace of the attribute, or +nil+ if there is no namespace.
|
20
20
|
#
|
21
|
-
# ⚡ This is an experimental feature, available since v1.14.0
|
22
|
-
#
|
23
21
|
# *Example*
|
24
22
|
#
|
25
23
|
# doc = Nokogiri::XML.parse(<<~XML)
|
@@ -52,6 +50,8 @@ module Nokogiri
|
|
52
50
|
# # href = "http://nokogiri.org/ns/noko"
|
53
51
|
# # })}
|
54
52
|
#
|
53
|
+
# Since v1.14.0
|
54
|
+
#
|
55
55
|
def deconstruct_keys(keys)
|
56
56
|
{ name: name, value: value, namespace: namespace }
|
57
57
|
end
|
@@ -329,7 +329,7 @@ module Nokogiri
|
|
329
329
|
# Validate this Document against it's DTD. Returns a list of errors on
|
330
330
|
# the document or +nil+ when there is no DTD.
|
331
331
|
def validate
|
332
|
-
return
|
332
|
+
return unless internal_subset
|
333
333
|
|
334
334
|
internal_subset.validate(self)
|
335
335
|
end
|
@@ -426,8 +426,6 @@ module Nokogiri
|
|
426
426
|
# instructions. If you have a use case and would like this functionality, please let us know
|
427
427
|
# by opening an issue or a discussion on the github project.
|
428
428
|
#
|
429
|
-
# ⚡ This is an experimental feature, available since v1.14.0
|
430
|
-
#
|
431
429
|
# *Example*
|
432
430
|
#
|
433
431
|
# doc = Nokogiri::XML.parse(<<~XML)
|
@@ -454,6 +452,8 @@ module Nokogiri
|
|
454
452
|
# doc.deconstruct_keys([:root])
|
455
453
|
# # => {:root=>nil}
|
456
454
|
#
|
455
|
+
# Since v1.14.0
|
456
|
+
#
|
457
457
|
def deconstruct_keys(keys)
|
458
458
|
{ root: root }
|
459
459
|
end
|
@@ -154,8 +154,6 @@ module Nokogiri
|
|
154
154
|
# root elements, you should deconstruct the array returned by
|
155
155
|
# <tt>DocumentFragment#elements</tt>.
|
156
156
|
#
|
157
|
-
# ⚡ This is an experimental feature, available since v1.14.0
|
158
|
-
#
|
159
157
|
# *Example*
|
160
158
|
#
|
161
159
|
# frag = Nokogiri::HTML5.fragment(<<~HTML)
|
@@ -187,6 +185,8 @@ module Nokogiri
|
|
187
185
|
# # }),
|
188
186
|
# # #(Element:0x398 { name = "div", children = [ #(Text "End")] })]
|
189
187
|
#
|
188
|
+
# Since v1.14.0
|
189
|
+
#
|
190
190
|
def deconstruct
|
191
191
|
children.to_a
|
192
192
|
end
|
@@ -16,8 +16,6 @@ module Nokogiri
|
|
16
16
|
# - +prefix+ → (String, nil) The namespace's prefix, or +nil+ if there is no prefix (e.g., default namespace).
|
17
17
|
# - +href+ → (String) The namespace's URI
|
18
18
|
#
|
19
|
-
# ⚡ This is an experimental feature, available since v1.14.0
|
20
|
-
#
|
21
19
|
# *Example*
|
22
20
|
#
|
23
21
|
# doc = Nokogiri::XML.parse(<<~XML)
|
@@ -43,6 +41,7 @@ module Nokogiri
|
|
43
41
|
# doc.root.elements.last.namespace.deconstruct_keys([:prefix, :href])
|
44
42
|
# # => {:prefix=>"noko", :href=>"http://nokogiri.org/ns/noko"}
|
45
43
|
#
|
44
|
+
# Since v1.14.0
|
46
45
|
#
|
47
46
|
def deconstruct_keys(keys)
|
48
47
|
{ prefix: prefix, href: href }
|
data/lib/nokogiri/xml/node.rb
CHANGED
@@ -1165,7 +1165,7 @@ module Nokogiri
|
|
1165
1165
|
# Fetch the Nokogiri::HTML4::ElementDescription for this node. Returns
|
1166
1166
|
# nil on XML documents and on unknown tags.
|
1167
1167
|
def description
|
1168
|
-
return
|
1168
|
+
return if document.xml?
|
1169
1169
|
|
1170
1170
|
Nokogiri::HTML4::ElementDescription[name]
|
1171
1171
|
end
|
@@ -1254,8 +1254,8 @@ module Nokogiri
|
|
1254
1254
|
# Compare two Node objects with respect to their Document. Nodes from
|
1255
1255
|
# different documents cannot be compared.
|
1256
1256
|
def <=>(other)
|
1257
|
-
return
|
1258
|
-
return
|
1257
|
+
return unless other.is_a?(Nokogiri::XML::Node)
|
1258
|
+
return unless document == other.document
|
1259
1259
|
|
1260
1260
|
compare(other)
|
1261
1261
|
end
|
@@ -1278,6 +1278,7 @@ module Nokogiri
|
|
1278
1278
|
# end
|
1279
1279
|
#
|
1280
1280
|
def serialize(*args, &block)
|
1281
|
+
# TODO: deprecate non-hash options, see 46c68ed 2009-06-20 for context
|
1281
1282
|
options = if args.first.is_a?(Hash)
|
1282
1283
|
args.shift
|
1283
1284
|
else
|
@@ -1429,8 +1430,6 @@ module Nokogiri
|
|
1429
1430
|
# - +content+ → (String) The contents of all the text nodes in this node's subtree. See #content.
|
1430
1431
|
# - +inner_html+ → (String) The inner markup for the children of this node. See #inner_html.
|
1431
1432
|
#
|
1432
|
-
# ⚡ This is an experimental feature, available since v1.14.0
|
1433
|
-
#
|
1434
1433
|
# *Example*
|
1435
1434
|
#
|
1436
1435
|
# doc = Nokogiri::XML.parse(<<~XML)
|
@@ -1465,6 +1464,8 @@ module Nokogiri
|
|
1465
1464
|
# # value = "def"
|
1466
1465
|
# # })]}
|
1467
1466
|
#
|
1467
|
+
# Since v1.14.0
|
1468
|
+
#
|
1468
1469
|
def deconstruct_keys(keys)
|
1469
1470
|
requested_keys = DECONSTRUCT_KEYS & keys
|
1470
1471
|
{}.tap do |values|
|
@@ -372,7 +372,7 @@ module Nokogiri
|
|
372
372
|
# Removes the last element from set and returns it, or +nil+ if
|
373
373
|
# the set is empty
|
374
374
|
def pop
|
375
|
-
return
|
375
|
+
return if length == 0
|
376
376
|
|
377
377
|
delete(last)
|
378
378
|
end
|
@@ -381,7 +381,7 @@ module Nokogiri
|
|
381
381
|
# Returns the first element of the NodeSet and removes it. Returns
|
382
382
|
# +nil+ if the set is empty.
|
383
383
|
def shift
|
384
|
-
return
|
384
|
+
return if length == 0
|
385
385
|
|
386
386
|
delete(first)
|
387
387
|
end
|
@@ -435,7 +435,7 @@ module Nokogiri
|
|
435
435
|
#
|
436
436
|
# Returns the members of this NodeSet as an array, to use in pattern matching.
|
437
437
|
#
|
438
|
-
#
|
438
|
+
# Since v1.14.0
|
439
439
|
#
|
440
440
|
def deconstruct
|
441
441
|
to_a
|
@@ -199,7 +199,7 @@ module Nokogiri
|
|
199
199
|
#
|
200
200
|
# Search this node's immediate children using CSS selector +selector+
|
201
201
|
def >(selector) # rubocop:disable Naming/BinaryOperatorParameterName
|
202
|
-
ns =
|
202
|
+
ns = document.root&.namespaces || {}
|
203
203
|
xpath(CSS.xpath_for(selector, prefix: "./", ns: ns).first)
|
204
204
|
end
|
205
205
|
|
@@ -229,7 +229,7 @@ module Nokogiri
|
|
229
229
|
def xpath_impl(node, path, handler, ns, binds)
|
230
230
|
ctx = XPathContext.new(node)
|
231
231
|
ctx.register_namespaces(ns)
|
232
|
-
path = path.gsub(
|
232
|
+
path = path.gsub("xmlns:", " :") unless Nokogiri.uses_libxml?
|
233
233
|
|
234
234
|
binds&.each do |key, value|
|
235
235
|
ctx.register_variable(key.to_s, value)
|
@@ -269,7 +269,7 @@ module Nokogiri
|
|
269
269
|
end
|
270
270
|
ns, binds = hashes.reverse
|
271
271
|
|
272
|
-
ns ||=
|
272
|
+
ns ||= document.root&.namespaces || {}
|
273
273
|
|
274
274
|
[params, handler, ns, binds]
|
275
275
|
end
|
data/lib/nokogiri/xml.rb
CHANGED
data/lib/nokogiri/xslt.rb
CHANGED
@@ -101,7 +101,7 @@ module Nokogiri
|
|
101
101
|
params.flatten.each_slice(2).with_object([]) do |kv, quoted_params|
|
102
102
|
key, value = kv.map(&:to_s)
|
103
103
|
value = if value.include?("'")
|
104
|
-
"concat('#{value.gsub(
|
104
|
+
"concat('#{value.gsub("'", %q{', "'", '})}')"
|
105
105
|
else
|
106
106
|
"'#{value}'"
|
107
107
|
end
|
data/lib/nokogiri.rb
CHANGED
@@ -94,7 +94,7 @@ module Nokogiri
|
|
94
94
|
|
95
95
|
# :nodoc:
|
96
96
|
def install_default_aliases
|
97
|
-
warn("Nokogiri.install_default_aliases is deprecated
|
97
|
+
warn("Nokogiri.install_default_aliases is deprecated. Please call Nokogiri::EncodingHandler.install_default_aliases instead. This will become an error in Nokogiri v1.17.0.", uplevel: 1, category: :deprecated) # deprecated in v1.14.0, remove in v1.17.0
|
98
98
|
Nokogiri::EncodingHandler.install_default_aliases
|
99
99
|
end
|
100
100
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nokogiri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.16.0.rc1
|
5
5
|
platform: x86-mingw32
|
6
6
|
authors:
|
7
7
|
- Mike Dalessio
|
@@ -20,7 +20,7 @@ authors:
|
|
20
20
|
autorequire:
|
21
21
|
bindir: bin
|
22
22
|
cert_chain: []
|
23
|
-
date: 2023-
|
23
|
+
date: 2023-12-13 00:00:00.000000000 Z
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: racc
|
@@ -201,10 +201,10 @@ files:
|
|
201
201
|
- gumbo-parser/Makefile
|
202
202
|
- gumbo-parser/THANKS
|
203
203
|
- lib/nokogiri.rb
|
204
|
-
- lib/nokogiri/2.7/nokogiri.so
|
205
204
|
- lib/nokogiri/3.0/nokogiri.so
|
206
205
|
- lib/nokogiri/3.1/nokogiri.so
|
207
206
|
- lib/nokogiri/3.2/nokogiri.so
|
207
|
+
- lib/nokogiri/3.3/nokogiri.so
|
208
208
|
- lib/nokogiri/class_resolver.rb
|
209
209
|
- lib/nokogiri/css.rb
|
210
210
|
- lib/nokogiri/css/node.rb
|
@@ -301,15 +301,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
301
301
|
requirements:
|
302
302
|
- - ">="
|
303
303
|
- !ruby/object:Gem::Version
|
304
|
-
version: '
|
304
|
+
version: '3.0'
|
305
305
|
- - "<"
|
306
306
|
- !ruby/object:Gem::Version
|
307
|
-
version: 3.
|
307
|
+
version: 3.4.dev
|
308
308
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
309
309
|
requirements:
|
310
|
-
- - "
|
310
|
+
- - ">"
|
311
311
|
- !ruby/object:Gem::Version
|
312
|
-
version:
|
312
|
+
version: 1.3.1
|
313
313
|
requirements: []
|
314
314
|
rubygems_version: 3.3.26
|
315
315
|
signing_key:
|