nokogiri 1.19.3-aarch64-linux-gnu → 1.19.5-aarch64-linux-gnu

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE-DEPENDENCIES.md +29 -0
  3. data/ext/nokogiri/extconf.rb +1 -0
  4. data/ext/nokogiri/gumbo.c +83 -6
  5. data/ext/nokogiri/html4_document.c +10 -3
  6. data/ext/nokogiri/libxml2_polyfill.c +12 -0
  7. data/ext/nokogiri/nokogiri.c +90 -5
  8. data/ext/nokogiri/nokogiri.h +25 -3
  9. data/ext/nokogiri/xml_attr.c +28 -23
  10. data/ext/nokogiri/xml_document.c +64 -30
  11. data/ext/nokogiri/xml_node.c +151 -52
  12. data/ext/nokogiri/xml_node_set.c +10 -10
  13. data/ext/nokogiri/xml_reader.c +198 -107
  14. data/ext/nokogiri/xml_sax_parser.c +3 -3
  15. data/ext/nokogiri/xml_sax_parser_context.c +38 -7
  16. data/ext/nokogiri/xml_sax_push_parser.c +12 -0
  17. data/ext/nokogiri/xml_xpath_context.c +135 -27
  18. data/ext/nokogiri/xslt_stylesheet.c +123 -27
  19. data/lib/nokogiri/3.2/nokogiri.so +0 -0
  20. data/lib/nokogiri/3.3/nokogiri.so +0 -0
  21. data/lib/nokogiri/3.4/nokogiri.so +0 -0
  22. data/lib/nokogiri/4.0/nokogiri.so +0 -0
  23. data/lib/nokogiri/css/parser.rb +35 -18
  24. data/lib/nokogiri/css/parser.y +35 -17
  25. data/lib/nokogiri/css/xpath_visitor.rb +71 -28
  26. data/lib/nokogiri/html5/document.rb +9 -0
  27. data/lib/nokogiri/html5/document_fragment.rb +16 -1
  28. data/lib/nokogiri/html5/node.rb +1 -1
  29. data/lib/nokogiri/html5.rb +16 -0
  30. data/lib/nokogiri/version/constant.rb +1 -1
  31. data/lib/nokogiri/version/info.rb +10 -0
  32. data/lib/nokogiri/xml/attr.rb +2 -0
  33. data/lib/nokogiri/xml/attribute_decl.rb +2 -1
  34. data/lib/nokogiri/xml/builder.rb +24 -32
  35. data/lib/nokogiri/xml/document.rb +4 -2
  36. data/lib/nokogiri/xml/dtd.rb +2 -1
  37. data/lib/nokogiri/xml/element_decl.rb +2 -1
  38. data/lib/nokogiri/xml/entity_decl.rb +2 -1
  39. data/lib/nokogiri/xml/node.rb +65 -12
  40. metadata +1 -1
@@ -5,7 +5,8 @@ module Nokogiri
5
5
  class ElementDecl < Nokogiri::XML::Node
6
6
  undef_method :namespace
7
7
  undef_method :namespace_definitions
8
- undef_method :line if method_defined?(:line)
8
+ undef_method :line
9
+ undef_method :line= if method_defined?(:line=)
9
10
 
10
11
  private
11
12
 
@@ -7,7 +7,8 @@ module Nokogiri
7
7
  undef_method :attributes
8
8
  undef_method :namespace
9
9
  undef_method :namespace_definitions
10
- undef_method :line if method_defined?(:line)
10
+ undef_method :line
11
+ undef_method :line= if method_defined?(:line=)
11
12
 
12
13
  def self.new(name, doc, *args)
13
14
  doc.create_entity(name, *args)
@@ -505,13 +505,15 @@ module Nokogiri
505
505
  end
506
506
 
507
507
  ###
508
- # Set the default namespace on this node (as would be defined with an
509
- # "xmlns=" attribute in XML source), as a Namespace object +ns+. Note that
510
- # a Namespace added this way will NOT be serialized as an xmlns attribute
511
- # for this node. You probably want #default_namespace= instead, or perhaps
512
- # #add_namespace_definition with a nil prefix argument.
508
+ # Set the namespace of this node to the Namespace object +ns+, which must belong to this
509
+ # node's document. Pass +nil+ to remove the node's namespace.
510
+ #
511
+ # If no declaration of the namespace's prefix is in scope on this node, a declaration of
512
+ # +ns+ is added to this node.
513
+ #
514
+ # To declare a prefixed namespace without putting this node in it, use #add_namespace_definition.
513
515
  def namespace=(ns)
514
- return set_namespace(ns) unless ns
516
+ return set_namespace(ns) if ns.nil?
515
517
 
516
518
  unless Nokogiri::XML::Namespace === ns
517
519
  raise TypeError, "#{ns.class} can't be coerced into Nokogiri::XML::Namespace"
@@ -523,16 +525,67 @@ module Nokogiri
523
525
  set_namespace(ns)
524
526
  end
525
527
 
528
+ XINCLUDE_NAMESPACES = {
529
+ "xi2001" => "http://www.w3.org/2001/XInclude",
530
+ "xi2003" => "http://www.w3.org/2003/XInclude",
531
+ }.freeze
532
+ private_constant :XINCLUDE_NAMESPACES
533
+
534
+ # Every top-level <xi:include> in the subtree, in either XInclude namespace, excluding
535
+ # includes nested inside another include's fallback (libxml2 only expands those if the
536
+ # parent include fails).
537
+ XINCLUDE_QUERY =
538
+ "descendant-or-self::xi2001:include[not(ancestor::xi2001:include) and not(ancestor::xi2003:include)] | " \
539
+ "descendant-or-self::xi2003:include[not(ancestor::xi2001:include) and not(ancestor::xi2003:include)]"
540
+ private_constant :XINCLUDE_QUERY
541
+
526
542
  ###
527
- # Do xinclude substitution on the subtree below node. If given a block, a
528
- # Nokogiri::XML::ParseOptions object initialized from +options+, will be
529
- # passed to it, allowing more convenient modification of the parser options.
530
- def do_xinclude(options = XML::ParseOptions::DEFAULT_XML)
543
+ # :call-seq:
544
+ # do_xinclude(options = ParseOptions::DEFAULT_XML, safe_copy: true) → self
545
+ # do_xinclude(options = ParseOptions::DEFAULT_XML, safe_copy: true) { |options| ... } → self
546
+ #
547
+ # Do XInclude substitution on the subtree below this node, replacing each +<xi:include>+ with
548
+ # the content it references.
549
+ #
550
+ # [Parameters]
551
+ # - +options+ (Nokogiri::XML::ParseOptions) The parser options for the substitution. (default
552
+ # +ParseOptions::DEFAULT_XML+)
553
+ #
554
+ # [Optional Keyword Arguments]
555
+ # - +safe_copy:+ (Boolean) Operate on a defensive copy of each +<xi:include>+ element, to
556
+ # prevent libxml2 from freeing memory that is bound to live Ruby objects. (default +true+)
557
+ #
558
+ # When +true+, each +<xi:include>+ is processed on an unwrapped copy of itself, so libxml2
559
+ # frees the copy while the original node is unlinked from the document and kept alive. This
560
+ # prevents a use-after-free when the +<xi:include>+ node, or any of its descendants or
561
+ # namespaces, has already been exposed to Ruby; as a consequence such a wrapped node ends up
562
+ # detached from the document rather than removed or converted in place.
563
+ #
564
+ # When +false+, the document is processed in place. This is faster but only safe when nothing
565
+ # in the subtree has been exposed to Ruby (for example, immediately after parsing), which is
566
+ # why Document.parse uses it.
567
+ #
568
+ # This option has no effect on the pure-Java backend, which performs XInclude substitution
569
+ # during parsing.
570
+ #
571
+ # [Yields]
572
+ # If a block is given, a Nokogiri::XML::ParseOptions object initialized from +options+ is
573
+ # yielded to it, which can be configured before substitution.
574
+ #
575
+ # [Returns] +self+ (Nokogiri::XML::Node)
576
+ def do_xinclude(options = XML::ParseOptions::DEFAULT_XML, safe_copy: true)
531
577
  options = Nokogiri::XML::ParseOptions.new(options) if Integer === options
532
578
  yield options if block_given?
533
579
 
534
- # call c extension
535
- process_xincludes(options.to_i)
580
+ if safe_copy && Nokogiri.uses_libxml?
581
+ xpath(XINCLUDE_QUERY, XINCLUDE_NAMESPACES).each do |include_node|
582
+ include_node.safe_process_xinclude(options.to_i)
583
+ end
584
+ else
585
+ process_xincludes(options.to_i)
586
+ end
587
+
588
+ self
536
589
  end
537
590
 
538
591
  alias_method :next, :next_sibling
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.19.3
4
+ version: 1.19.5
5
5
  platform: aarch64-linux-gnu
6
6
  authors:
7
7
  - Mike Dalessio