nokogiri 1.15.0 → 1.16.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +17 -14
  3. data/README.md +4 -1
  4. data/dependencies.yml +9 -8
  5. data/ext/nokogiri/extconf.rb +3 -4
  6. data/ext/nokogiri/html4_sax_push_parser.c +1 -1
  7. data/ext/nokogiri/nokogiri.h +10 -3
  8. data/ext/nokogiri/test_global_handlers.c +1 -1
  9. data/ext/nokogiri/xml_cdata.c +28 -23
  10. data/ext/nokogiri/xml_document.c +13 -5
  11. data/ext/nokogiri/xml_namespace.c +0 -4
  12. data/ext/nokogiri/xml_node.c +6 -9
  13. data/ext/nokogiri/xml_reader.c +26 -48
  14. data/ext/nokogiri/xml_relax_ng.c +1 -1
  15. data/ext/nokogiri/xml_sax_parser_context.c +4 -0
  16. data/ext/nokogiri/xml_sax_push_parser.c +1 -1
  17. data/ext/nokogiri/xml_schema.c +13 -8
  18. data/ext/nokogiri/xml_syntax_error.c +3 -3
  19. data/ext/nokogiri/xml_text.c +24 -19
  20. data/ext/nokogiri/xml_xpath_context.c +2 -5
  21. data/ext/nokogiri/xslt_stylesheet.c +8 -3
  22. data/gumbo-parser/Makefile +18 -0
  23. data/gumbo-parser/src/error.c +1 -1
  24. data/gumbo-parser/src/parser.c +8 -5
  25. data/gumbo-parser/src/tokenizer.c +1 -0
  26. data/lib/nokogiri/css/parser_extras.rb +1 -1
  27. data/lib/nokogiri/css/xpath_visitor.rb +1 -21
  28. data/lib/nokogiri/html4/document.rb +1 -1
  29. data/lib/nokogiri/html4/encoding_reader.rb +1 -1
  30. data/lib/nokogiri/html5.rb +0 -66
  31. data/lib/nokogiri/jruby/nokogiri_jars.rb +3 -3
  32. data/lib/nokogiri/version/constant.rb +1 -1
  33. data/lib/nokogiri/version/info.rb +6 -5
  34. data/lib/nokogiri/xml/attr.rb +2 -2
  35. data/lib/nokogiri/xml/document.rb +4 -5
  36. data/lib/nokogiri/xml/document_fragment.rb +2 -2
  37. data/lib/nokogiri/xml/namespace.rb +1 -2
  38. data/lib/nokogiri/xml/node.rb +31 -24
  39. data/lib/nokogiri/xml/node_set.rb +3 -3
  40. data/lib/nokogiri/xml/reader.rb +10 -9
  41. data/lib/nokogiri/xml/searchable.rb +3 -3
  42. data/lib/nokogiri/xml/syntax_error.rb +1 -1
  43. data/lib/nokogiri/xml.rb +1 -1
  44. data/lib/nokogiri/xslt/stylesheet.rb +29 -7
  45. data/lib/nokogiri/xslt.rb +1 -1
  46. data/lib/nokogiri.rb +1 -1
  47. data/ports/archives/libxml2-2.12.7.tar.xz +0 -0
  48. data/ports/archives/libxslt-1.1.39.tar.xz +0 -0
  49. metadata +9 -9
  50. data/ports/archives/libxml2-2.11.3.tar.xz +0 -0
  51. data/ports/archives/libxslt-1.1.38.tar.xz +0 -0
@@ -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 = (document.root&.namespaces || {})
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(/xmlns:/, " :") unless Nokogiri.uses_libxml?
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 ||= (document.root&.namespaces || {})
272
+ ns ||= document.root&.namespaces || {}
273
273
 
274
274
  [params, handler, ns, binds]
275
275
  end
@@ -63,7 +63,7 @@ module Nokogiri
63
63
  end
64
64
 
65
65
  def location_to_s
66
- return nil if nil_or_zero?(line) && nil_or_zero?(column)
66
+ return if nil_or_zero?(line) && nil_or_zero?(column)
67
67
 
68
68
  "#{line}:#{column}"
69
69
  end
data/lib/nokogiri/xml.rb CHANGED
@@ -11,7 +11,7 @@ module Nokogiri
11
11
 
12
12
  module XML
13
13
  # Original C14N 1.0 spec canonicalization
14
- XML_C14N_1_0 = 0
14
+ XML_C14N_1_0 = 0
15
15
  # Exclusive C14N 1.0 spec canonicalization
16
16
  XML_C14N_EXCLUSIVE_1_0 = 1
17
17
  # C14N 1.1 spec canonicalization
@@ -10,15 +10,37 @@ module Nokogiri
10
10
  # doc = Nokogiri::XML(File.read('some_file.xml'))
11
11
  # xslt = Nokogiri::XSLT(File.read('some_transformer.xslt'))
12
12
  #
13
- # puts xslt.transform(doc)
13
+ # xslt.transform(doc) # => Nokogiri::XML::Document
14
14
  #
15
- # See Nokogiri::XSLT::Stylesheet#transform for more transformation
16
- # information.
15
+ # Many XSLT transformations include serialization behavior to emit a non-XML document. For these
16
+ # cases, please take care to invoke the #serialize method on the result of the transformation:
17
+ #
18
+ # doc = Nokogiri::XML(File.read('some_file.xml'))
19
+ # xslt = Nokogiri::XSLT(File.read('some_transformer.xslt'))
20
+ # xslt.serialize(xslt.transform(doc)) # => String
21
+ #
22
+ # or use the #apply_to method, which is a shortcut for `serialize(transform(document))`:
23
+ #
24
+ # doc = Nokogiri::XML(File.read('some_file.xml'))
25
+ # xslt = Nokogiri::XSLT(File.read('some_transformer.xslt'))
26
+ # xslt.apply_to(doc) # => String
27
+ #
28
+ # See Nokogiri::XSLT::Stylesheet#transform for more information and examples.
17
29
  class Stylesheet
18
- ###
19
- # Apply an XSLT stylesheet to an XML::Document.
20
- # +params+ is an array of strings used as XSLT parameters.
21
- # returns serialized document
30
+ # :call-seq:
31
+ # apply_to(document, params = []) -> String
32
+ #
33
+ # Apply an XSLT stylesheet to an XML::Document and serialize it properly. This method is
34
+ # equivalent to calling #serialize on the result of #transform.
35
+ #
36
+ # [Parameters]
37
+ # - +document+ is an instance of XML::Document to transform
38
+ # - +params+ is an array of strings used as XSLT parameters, passed into #transform
39
+ #
40
+ # [Returns]
41
+ # A string containing the serialized result of the transformation.
42
+ #
43
+ # See Nokogiri::XSLT::Stylesheet#transform for more information and examples.
22
44
  def apply_to(document, params = [])
23
45
  serialize(transform(document, params))
24
46
  end
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(/'/, %q{', "'", '})}')"
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 and will be removed in a future version of Nokogiri. Please call Nokogiri::EncodingHandler.install_default_aliases instead.")
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.15.0
4
+ version: 1.16.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Dalessio
@@ -17,10 +17,10 @@ authors:
17
17
  - Sergio Arbeo
18
18
  - Timothy Elliott
19
19
  - Nobuyoshi Nakada
20
- autorequire:
20
+ autorequire:
21
21
  bindir: bin
22
22
  cert_chain: []
23
- date: 2023-05-15 00:00:00.000000000 Z
23
+ date: 2024-05-13 00:00:00.000000000 Z
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mini_portile2
@@ -272,8 +272,8 @@ files:
272
272
  - patches/libxml2/0010-update-config.guess-and-config.sub-for-libxml2.patch
273
273
  - patches/libxml2/0011-rip-out-libxml2-s-libc_single_threaded-support.patch
274
274
  - patches/libxslt/0001-update-config.guess-and-config.sub-for-libxslt.patch
275
- - ports/archives/libxml2-2.11.3.tar.xz
276
- - ports/archives/libxslt-1.1.38.tar.xz
275
+ - ports/archives/libxml2-2.12.7.tar.xz
276
+ - ports/archives/libxslt-1.1.39.tar.xz
277
277
  homepage: https://nokogiri.org
278
278
  licenses:
279
279
  - MIT
@@ -284,7 +284,7 @@ metadata:
284
284
  changelog_uri: https://nokogiri.org/CHANGELOG.html
285
285
  source_code_uri: https://github.com/sparklemotion/nokogiri
286
286
  rubygems_mfa_required: 'true'
287
- post_install_message:
287
+ post_install_message:
288
288
  rdoc_options:
289
289
  - "--main"
290
290
  - README.md
@@ -294,15 +294,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
294
294
  requirements:
295
295
  - - ">="
296
296
  - !ruby/object:Gem::Version
297
- version: 2.7.0
297
+ version: 3.0.0
298
298
  required_rubygems_version: !ruby/object:Gem::Requirement
299
299
  requirements:
300
300
  - - ">="
301
301
  - !ruby/object:Gem::Version
302
302
  version: '0'
303
303
  requirements: []
304
- rubygems_version: 3.4.10
305
- signing_key:
304
+ rubygems_version: 3.5.10
305
+ signing_key:
306
306
  specification_version: 4
307
307
  summary: Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby.
308
308
  test_files: []
Binary file
Binary file