nokogiri 1.13.7-x86-mingw32 → 1.13.8-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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64b27462def4e5b5f96c1560fec00105ba4e02c22a158b7af199c43464ab541f
4
- data.tar.gz: 183ab12780b6a21965d5beba12f33dffda1f31963b5c624a1694eb58eb2022b0
3
+ metadata.gz: 89008eefdee0d7409514ca019b289232dfddc3fbb51b5848722689ce2c926d09
4
+ data.tar.gz: 16b14f3de3cdc7253af3f14ca03514e003b040d66009e65d71e99cbe83a25ca0
5
5
  SHA512:
6
- metadata.gz: dd2ec2360a1c48566f49993e5061327f42a29e3c4b181ecd34c8705355f0ea146df8412d9e5ec832fdc2e588658acee6c4b28a50597c3a790f3f1a6672e79e51
7
- data.tar.gz: '0391e05dfe2c3a958e3ef8a030a22d17eb90a758db8b2d9d251b00cef632a899aee16bffd213487eed5c3555156efe2ae6a016f3ae8f31e6614303ea19a342af'
6
+ metadata.gz: 7ed2acba86a316d69961e6c7deb9b6e687dd2e4da6f86ecee7f504acc4a2e30c8a0400f9f10aae7cbd2f88b42ab1d4cd2c7a7dc4882eddead31110f4c65f69e7
7
+ data.tar.gz: 6ca728044a90c1eaabca39adbac95db5806d4eab9793cee5937cc29388b85ff305725b6b5351c2e4086b16875bf43fbdef5e52c69218238920d7176f382c84a6
@@ -974,6 +974,7 @@ have_func("xmlRelaxNGSetValidStructuredErrors") # introduced in libxml 2.6.21
974
974
  have_func("xmlSchemaSetValidStructuredErrors") # introduced in libxml 2.6.23
975
975
  have_func("xmlSchemaSetParserStructuredErrors") # introduced in libxml 2.6.23
976
976
  have_func("rb_gc_location") # introduced in Ruby 2.7
977
+ have_func("rb_category_warning") # introduced in Ruby 3.0
977
978
 
978
979
  have_func("vasprintf")
979
980
 
@@ -133,7 +133,7 @@ extern "C" {
133
133
  #ifndef WITH_MODULES
134
134
  #define WITH_MODULES
135
135
  #endif
136
- #define LIBXSLT_DEFAULT_PLUGINS_PATH() "/home/flavorjones/code/oss/nokogiri/ports/x86-mingw32/libxslt/1.1.35/lib/libxslt-plugins"
136
+ #define LIBXSLT_DEFAULT_PLUGINS_PATH() "/home/flavorjones/code/oss/nokogiri/ports/x64-mingw32/libxslt/1.1.35/lib/libxslt-plugins"
137
137
  #endif
138
138
 
139
139
  /**
@@ -202,6 +202,12 @@ NOKOPUBFUN VALUE Nokogiri_wrap_xml_document(VALUE klass,
202
202
  #define DISCARD_CONST_QUAL(t, v) ((t)(uintptr_t)(v))
203
203
  #define DISCARD_CONST_QUAL_XMLCHAR(v) DISCARD_CONST_QUAL(xmlChar *, v)
204
204
 
205
+ #if HAVE_RB_CATEGORY_WARNING
206
+ # define NOKO_WARN_DEPRECATION(message) rb_category_warning(RB_WARN_CATEGORY_DEPRECATED, message)
207
+ #else
208
+ # define NOKO_WARN_DEPRECATION(message) rb_warning(message)
209
+ #endif
210
+
205
211
  void Nokogiri_structured_error_func_save(libxmlStructuredErrorHandlerState *handler_state);
206
212
  void Nokogiri_structured_error_func_save_and_set(libxmlStructuredErrorHandlerState *handler_state, void *user_data,
207
213
  xmlStructuredErrorFunc handler);
@@ -1806,7 +1806,7 @@ rb_xml_node_new(int argc, VALUE *argv, VALUE klass)
1806
1806
  }
1807
1807
  if (!rb_obj_is_kind_of(rb_document_node, cNokogiriXmlDocument)) {
1808
1808
  // TODO: deprecate allowing Node
1809
- rb_warn("Passing a Node as the second parameter to Node.new is deprecated. Please pass a Document instead, or prefer an alternative constructor like Node#add_child. This will become an error in a future release of Nokogiri.");
1809
+ NOKO_WARN_DEPRECATION("Passing a Node as the second parameter to Node.new is deprecated. Please pass a Document instead, or prefer an alternative constructor like Node#add_child. This will become an error in a future release of Nokogiri.");
1810
1810
  }
1811
1811
  Noko_Node_Get_Struct(rb_document_node, xmlNode, c_document_node);
1812
1812
 
@@ -31,6 +31,7 @@ has_attributes(xmlTextReaderPtr reader)
31
31
  return (0);
32
32
  }
33
33
 
34
+ // TODO: merge this function into the `namespaces` method implementation
34
35
  static void
35
36
  Nokogiri_xml_node_namespaces(xmlNodePtr node, VALUE attr_hash)
36
37
  {
@@ -150,7 +151,11 @@ namespaces(VALUE self)
150
151
  /*
151
152
  :call-seq: attribute_nodes() → Array<Nokogiri::XML::Attr>
152
153
 
153
- Get the attributes of the current node as an Array of Attr
154
+ Get the attributes of the current node as an Array of XML:Attr
155
+
156
+ ⚠ This method is deprecated and unsafe to use. It will be removed in a future version of Nokogiri.
157
+
158
+ See related: #attribute_hash, #attributes
154
159
  */
155
160
  static VALUE
156
161
  rb_xml_reader_attribute_nodes(VALUE rb_reader)
@@ -160,6 +165,10 @@ rb_xml_reader_attribute_nodes(VALUE rb_reader)
160
165
  VALUE attr_nodes;
161
166
  int j;
162
167
 
168
+ // TODO: deprecated, remove in Nokogiri v1.15, see https://github.com/sparklemotion/nokogiri/issues/2598
169
+ // After removal, we can also remove all the "node_has_a_document" special handling from xml_node.c
170
+ NOKO_WARN_DEPRECATION("Reader#attribute_nodes is deprecated and will be removed in a future version of Nokogiri. Please use Reader#attribute_hash instead.");
171
+
163
172
  Data_Get_Struct(rb_reader, xmlTextReader, c_reader);
164
173
 
165
174
  if (! has_attributes(c_reader)) {
@@ -181,6 +190,47 @@ rb_xml_reader_attribute_nodes(VALUE rb_reader)
181
190
  return attr_nodes;
182
191
  }
183
192
 
193
+ /*
194
+ :call-seq: attribute_hash() → Hash<String ⇒ String>
195
+
196
+ Get the attributes of the current node as a Hash of names and values.
197
+
198
+ See related: #attributes and #namespaces
199
+ */
200
+ static VALUE
201
+ rb_xml_reader_attribute_hash(VALUE rb_reader)
202
+ {
203
+ VALUE rb_attributes = rb_hash_new();
204
+ xmlTextReaderPtr c_reader;
205
+ xmlNodePtr c_node;
206
+ xmlAttrPtr c_property;
207
+
208
+ Data_Get_Struct(rb_reader, xmlTextReader, c_reader);
209
+
210
+ if (!has_attributes(c_reader)) {
211
+ return rb_attributes;
212
+ }
213
+
214
+ c_node = xmlTextReaderExpand(c_reader);
215
+ c_property = c_node->properties;
216
+ while (c_property != NULL) {
217
+ VALUE rb_name = NOKOGIRI_STR_NEW2(c_property->name);
218
+ VALUE rb_value = Qnil;
219
+ xmlChar *c_value = xmlNodeGetContent((xmlNode *)c_property);
220
+
221
+ if (c_value) {
222
+ rb_value = NOKOGIRI_STR_NEW2(c_value);
223
+ xmlFree(c_value);
224
+ }
225
+
226
+ rb_hash_aset(rb_attributes, rb_name, rb_value);
227
+
228
+ c_property = c_property->next;
229
+ }
230
+
231
+ return rb_attributes;
232
+ }
233
+
184
234
  /*
185
235
  * call-seq:
186
236
  * attribute_at(index)
@@ -696,6 +746,7 @@ noko_init_xml_reader()
696
746
  rb_define_method(cNokogiriXmlReader, "attribute_at", attribute_at, 1);
697
747
  rb_define_method(cNokogiriXmlReader, "attribute_count", attribute_count, 0);
698
748
  rb_define_method(cNokogiriXmlReader, "attribute_nodes", rb_xml_reader_attribute_nodes, 0);
749
+ rb_define_method(cNokogiriXmlReader, "attribute_hash", rb_xml_reader_attribute_hash, 0);
699
750
  rb_define_method(cNokogiriXmlReader, "attributes?", attributes_eh, 0);
700
751
  rb_define_method(cNokogiriXmlReader, "base_uri", rb_xml_reader_base_uri, 0);
701
752
  rb_define_method(cNokogiriXmlReader, "default?", default_eh, 0);
Binary file
Binary file
Binary file
Binary file
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Nokogiri
4
4
  # The version of Nokogiri you are using
5
- VERSION = "1.13.7"
5
+ VERSION = "1.13.8"
6
6
  end
@@ -83,16 +83,14 @@ module Nokogiri
83
83
  end
84
84
  private :initialize
85
85
 
86
- # Get the attributes of the current node as a Hash
86
+ # Get the attributes and namespaces of the current node as a Hash.
87
87
  #
88
- # [Returns] (Hash<String, String>) Attribute names and values
88
+ # This is the union of Reader#attribute_hash and Reader#namespaces
89
+ #
90
+ # [Returns]
91
+ # (Hash<String, String>) Attribute names and values, and namespace prefixes and hrefs.
89
92
  def attributes
90
- attrs_hash = attribute_nodes.each_with_object({}) do |node, hash|
91
- hash[node.name] = node.to_s
92
- end
93
- ns = namespaces
94
- attrs_hash.merge!(ns) if ns
95
- attrs_hash
93
+ attribute_hash.merge(namespaces)
96
94
  end
97
95
 
98
96
  ###
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.13.7
4
+ version: 1.13.8
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: 2022-07-12 00:00:00.000000000 Z
23
+ date: 2022-07-23 00:00:00.000000000 Z
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: racc