nokogiri 1.12.3-arm64-darwin → 1.12.4-arm64-darwin

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 67439071bb75de96494d56a70bd1d5c376cedfc0c90cf335f647774e91f67d8e
4
- data.tar.gz: 8042f5aad6c0f3e7470cc7c75509f5b0e99b261ef35ffa3fe4bbf12c30efef6f
3
+ metadata.gz: 3723bddb1259307c2fc8250029cee9b57a2dfb77c101c0583fac9e8f3c87e8f1
4
+ data.tar.gz: d64dba675330e56d87eb8fe1e880353fc88dea821532bc753760e75b52abdfef
5
5
  SHA512:
6
- metadata.gz: ff1c390c99842af6292eba69249d785dc8c36c4cf1107de763519932268a82a4bd731155615976fa9cebd9e769c8c598694b8ec4a61f7af69ce365a100d23684
7
- data.tar.gz: f256b5e01a83e04f86f401d9111110397e9ffc2db24ba760f8e43bb78bca4ab8e9ff162ce3ba900aba046a152026b173c8016eccea9e4457e8770d41983bc73b
6
+ metadata.gz: 3a4eb9f27106ad50e9c5c908f3e3a1a5513cc34a6ae16c7feced449dd4aa897b081d833072ff643b78fffcfcdd2fbc5414ec854772fba50812fdc32936cae8b0
7
+ data.tar.gz: a5f9780e3428a44c2cd6d34c325c57f9a1e6bef0dd410d991627f152070bee71508018aeb346bf116a8385aefa867f36efa5e8dfdff6fc59202905cfeedb3695
@@ -69,6 +69,13 @@ relink_namespace(xmlNodePtr reparented)
69
69
  /* Avoid segv when relinking against unlinked nodes. */
70
70
  if (reparented->type != XML_ELEMENT_NODE || !reparented->parent) { return; }
71
71
 
72
+ /* Make sure that our reparented node has the correct namespaces */
73
+ if (!reparented->ns &&
74
+ (reparented->doc != (xmlDocPtr)reparented->parent) &&
75
+ (rb_iv_get(DOC_RUBY_OBJECT(reparented->doc), "@namespace_inheritance") == Qtrue)) {
76
+ xmlSetNs(reparented, reparented->parent->ns);
77
+ }
78
+
72
79
  /* Search our parents for an existing definition */
73
80
  if (reparented->nsDef) {
74
81
  xmlNsPtr curr = reparented->nsDef;
Binary file
Binary file
Binary file
Binary file
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module Nokogiri
3
3
  # The version of Nokogiri you are using
4
- VERSION = "1.12.3"
4
+ VERSION = "1.12.4"
5
5
  end
@@ -196,6 +196,41 @@ module Nokogiri
196
196
  #
197
197
  # Note the "foo:object" tag.
198
198
  #
199
+ # === Namespace inheritance
200
+ #
201
+ # In the Builder context, children will inherit their parent's namespace. This is the same
202
+ # behavior as if the underlying {XML::Document} set +namespace_inheritance+ to +true+:
203
+ #
204
+ # result = Nokogiri::XML::Builder.new do |xml|
205
+ # xml["soapenv"].Envelope("xmlns:soapenv" => "http://schemas.xmlsoap.org/soap/envelope/") do
206
+ # xml.Header
207
+ # end
208
+ # end
209
+ # result.doc.to_xml
210
+ # # => <?xml version="1.0" encoding="utf-8"?>
211
+ # # <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
212
+ # # <soapenv:Header/>
213
+ # # </soapenv:Envelope>
214
+ #
215
+ # Users may turn this behavior off by passing a keyword argument +namespace_inheritance:false+
216
+ # to the initializer:
217
+ #
218
+ # result = Nokogiri::XML::Builder.new(namespace_inheritance: false) do |xml|
219
+ # xml["soapenv"].Envelope("xmlns:soapenv" => "http://schemas.xmlsoap.org/soap/envelope/") do
220
+ # xml.Header
221
+ # xml["soapenv"].Body # users may explicitly opt into the namespace
222
+ # end
223
+ # end
224
+ # result.doc.to_xml
225
+ # # => <?xml version="1.0" encoding="utf-8"?>
226
+ # # <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
227
+ # # <Header/>
228
+ # # <soapenv:Body/>
229
+ # # </soapenv:Envelope>
230
+ #
231
+ # For more information on namespace inheritance, please see {XML::Document#namespace_inheritance}
232
+ #
233
+ #
199
234
  # == Document Types
200
235
  #
201
236
  # To create a document type (DTD), access use the Builder#doc method to get
@@ -226,6 +261,8 @@ module Nokogiri
226
261
  # </root>
227
262
  #
228
263
  class Builder
264
+ DEFAULT_DOCUMENT_OPTIONS = {namespace_inheritance: true}
265
+
229
266
  # The current Document object being built
230
267
  attr_accessor :doc
231
268
 
@@ -282,6 +319,7 @@ module Nokogiri
282
319
  @arity = nil
283
320
  @ns = nil
284
321
 
322
+ options = DEFAULT_DOCUMENT_OPTIONS.merge(options)
285
323
  options.each do |k, v|
286
324
  @doc.send(:"#{k}=", v)
287
325
  end
@@ -113,9 +113,55 @@ module Nokogiri
113
113
  # A list of Nokogiri::XML::SyntaxError found when parsing a document
114
114
  attr_accessor :errors
115
115
 
116
+ # When true, reparented elements without a namespace will inherit their new parent's
117
+ # namespace (if one exists). Defaults to +false+.
118
+ #
119
+ # @example Default behavior of namespace inheritance
120
+ # xml = <<~EOF
121
+ # <root xmlns:foo="http://nokogiri.org/default_ns/test/foo">
122
+ # <foo:parent>
123
+ # </foo:parent>
124
+ # </root>
125
+ # EOF
126
+ # doc = Nokogiri::XML(xml)
127
+ # parent = doc.at_xpath("//foo:parent", "foo" => "http://nokogiri.org/default_ns/test/foo")
128
+ # parent.add_child("<child></child>")
129
+ # doc.to_xml
130
+ # # => <?xml version="1.0"?>
131
+ # # <root xmlns:foo="http://nokogiri.org/default_ns/test/foo">
132
+ # # <foo:parent>
133
+ # # <child/>
134
+ # # </foo:parent>
135
+ # # </root>
136
+ #
137
+ # @example Setting namespace inheritance to +true+
138
+ # xml = <<~EOF
139
+ # <root xmlns:foo="http://nokogiri.org/default_ns/test/foo">
140
+ # <foo:parent>
141
+ # </foo:parent>
142
+ # </root>
143
+ # EOF
144
+ # doc = Nokogiri::XML(xml)
145
+ # doc.namespace_inheritance = true
146
+ # parent = doc.at_xpath("//foo:parent", "foo" => "http://nokogiri.org/default_ns/test/foo")
147
+ # parent.add_child("<child></child>")
148
+ # doc.to_xml
149
+ # # => <?xml version="1.0"?>
150
+ # # <root xmlns:foo="http://nokogiri.org/default_ns/test/foo">
151
+ # # <foo:parent>
152
+ # # <foo:child/>
153
+ # # </foo:parent>
154
+ # # </root>
155
+ #
156
+ # @return [Boolean]
157
+ #
158
+ # @since v1.12.4
159
+ attr_accessor :namespace_inheritance
160
+
116
161
  def initialize *args # :nodoc:
117
162
  @errors = []
118
163
  @decorators = nil
164
+ @namespace_inheritance = false
119
165
  end
120
166
 
121
167
  ##
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.12.3
4
+ version: 1.12.4
5
5
  platform: arm64-darwin
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: 2021-08-10 00:00:00.000000000 Z
23
+ date: 2021-08-29 00:00:00.000000000 Z
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: racc