nokogiri 1.15.6 → 1.16.0.rc1
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 +6 -5
- data/ext/nokogiri/extconf.rb +3 -4
- data/ext/nokogiri/html4_sax_push_parser.c +1 -1
- 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/gumbo-parser/src/tokenizer.c +1 -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
- data/ports/archives/libxml2-2.12.3.tar.xz +0 -0
- metadata +9 -9
- data/ports/archives/libxml2-2.11.7.tar.xz +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edb35060c35ecf55ba01f20e731bb2a7866377ee2e06ef97ea6f3a7e5a1ef450
|
4
|
+
data.tar.gz: c698841274ac4d10a894ac456bba6535a7825ed7a836bfbd27fe91b1734c7438
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e6907cf3ffe729da72be3ba21cf8af21e2fd448631572713fec65bd37ab2cfec290067f1c8ea3e00564d5b6b4eb1b7c63beb9b8bbeba3a1518599d11023cd84
|
7
|
+
data.tar.gz: 7cdcc4e33d7ee32de3074ed49a55c97f55763ec6f2ab01076cd2712bd07d7df19cb292981435248b6d3fb85741ed78fd4ddcc913b9b565e5e963c38ff3091968
|
data/Gemfile
CHANGED
@@ -7,33 +7,30 @@ gemspec
|
|
7
7
|
group :development do
|
8
8
|
# bootstrapping
|
9
9
|
gem "bundler", "~> 2.3"
|
10
|
-
gem "rake", "
|
10
|
+
gem "rake", "13.1.0"
|
11
11
|
|
12
12
|
# building extensions
|
13
|
-
gem "rake-compiler", "
|
14
|
-
gem "rake-compiler-dock", "
|
15
|
-
|
16
|
-
# documentation
|
17
|
-
gem "hoe-markdown", "= 1.4.0"
|
13
|
+
gem "rake-compiler", "1.2.5"
|
14
|
+
gem "rake-compiler-dock", "1.4.0.rc2"
|
18
15
|
|
19
16
|
# parser generator
|
20
17
|
gem "rexical", "= 1.0.7"
|
21
18
|
|
22
19
|
# tests
|
23
|
-
gem "minitest", "5.
|
24
|
-
gem "minitest-
|
25
|
-
gem "ruby_memcheck", "
|
20
|
+
gem "minitest", "5.20.0"
|
21
|
+
gem "minitest-parallel_fork", "2.0.0"
|
22
|
+
gem "ruby_memcheck", "2.2.1"
|
26
23
|
gem "rubyzip", "~> 2.3.2"
|
27
24
|
gem "simplecov", "= 0.21.2"
|
28
25
|
|
29
26
|
# rubocop
|
30
27
|
if Gem::Requirement.new("~> 3.0").satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
31
|
-
gem "rubocop", "1.
|
32
|
-
gem "rubocop-minitest", "0.
|
28
|
+
gem "rubocop", "1.58.0"
|
29
|
+
gem "rubocop-minitest", "0.33.0"
|
33
30
|
gem "rubocop-packaging", "0.5.2"
|
34
|
-
gem "rubocop-performance", "1.
|
31
|
+
gem "rubocop-performance", "1.19.1"
|
35
32
|
gem "rubocop-rake", "= 0.6.0"
|
36
|
-
gem "rubocop-shopify", "2.
|
33
|
+
gem "rubocop-shopify", "2.14.0"
|
37
34
|
end
|
38
35
|
end
|
39
36
|
|
@@ -41,5 +38,5 @@ end
|
|
41
38
|
# `bundle config set --local without rdoc`
|
42
39
|
# Then re-run `bundle install`.
|
43
40
|
group :rdoc do
|
44
|
-
gem "rdoc", "6.
|
41
|
+
gem "rdoc", "6.6.1"
|
45
42
|
end
|
data/README.md
CHANGED
data/dependencies.yml
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
+
|
1
2
|
libxml2:
|
2
|
-
version: "2.
|
3
|
-
sha256: "
|
4
|
-
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.
|
3
|
+
version: "2.12.3"
|
4
|
+
sha256: "8c8f1092340a89ff32bc44ad5c9693aff9bc8a7a3e161bb239666e5d15ac9aaa"
|
5
|
+
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.12/libxml2-2.12.3.sha256sum
|
5
6
|
|
6
7
|
libxslt:
|
7
8
|
version: "1.1.39"
|
@@ -9,8 +10,8 @@ libxslt:
|
|
9
10
|
# sha-256 hash provided in https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.39.sha256sum
|
10
11
|
|
11
12
|
zlib:
|
12
|
-
version: "1.
|
13
|
-
sha256: "
|
13
|
+
version: "1.3"
|
14
|
+
sha256: "ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e"
|
14
15
|
# SHA-256 hash provided on http://zlib.net/
|
15
16
|
|
16
17
|
libiconv:
|
data/ext/nokogiri/extconf.rb
CHANGED
@@ -443,7 +443,7 @@ def process_recipe(name, version, static_p, cross_p, cacheable_p = true)
|
|
443
443
|
# We use 'host' to set compiler prefix for cross-compiling. Prefer host_alias over host. And
|
444
444
|
# prefer i686 (what external dev tools use) to i386 (what ruby's configure.ac emits).
|
445
445
|
recipe.host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
|
446
|
-
recipe.host = recipe.host.gsub(
|
446
|
+
recipe.host = recipe.host.gsub("i386", "i686")
|
447
447
|
|
448
448
|
recipe.target = File.join(PACKAGE_ROOT_DIR, "ports") if cacheable_p
|
449
449
|
recipe.configure_options << "--libdir=#{File.join(recipe.path, "lib")}"
|
@@ -651,8 +651,7 @@ append_cppflags(ENV["CPPFLAGS"].split) unless ENV["CPPFLAGS"].nil?
|
|
651
651
|
append_ldflags(ENV["LDFLAGS"].split) unless ENV["LDFLAGS"].nil?
|
652
652
|
$LIBS = concat_flags($LIBS, ENV["LIBS"])
|
653
653
|
|
654
|
-
#
|
655
|
-
# errors/warnings. see #2302
|
654
|
+
# libgumbo uses C90/C99 features, see #2302
|
656
655
|
append_cflags(["-std=c99", "-Wno-declaration-after-statement"])
|
657
656
|
|
658
657
|
# gumbo html5 serialization is slower with O3, let's make sure we use O2
|
@@ -919,6 +918,7 @@ else
|
|
919
918
|
"--with-c14n",
|
920
919
|
"--with-debug",
|
921
920
|
"--with-threads",
|
921
|
+
"--without-tls", # see https://github.com/sparklemotion/nokogiri/issues/3031
|
922
922
|
"CPPFLAGS=#{cppflags}",
|
923
923
|
"CFLAGS=#{cflags}",
|
924
924
|
]
|
@@ -1087,7 +1087,6 @@ have_func("xmlRelaxNGSetParserStructuredErrors") # introduced in libxml 2.6.24
|
|
1087
1087
|
have_func("xmlRelaxNGSetValidStructuredErrors") # introduced in libxml 2.6.21
|
1088
1088
|
have_func("xmlSchemaSetValidStructuredErrors") # introduced in libxml 2.6.23
|
1089
1089
|
have_func("xmlSchemaSetParserStructuredErrors") # introduced in libxml 2.6.23
|
1090
|
-
have_func("rb_gc_location") # introduced in Ruby 2.7
|
1091
1090
|
have_func("rb_category_warning") # introduced in Ruby 3.0
|
1092
1091
|
|
1093
1092
|
other_library_versions_string = OTHER_LIBRARY_VERSIONS.map { |k, v| [k, v].join(":") }.join(",")
|
@@ -32,7 +32,7 @@ native_write(VALUE self, VALUE _chunk, VALUE _last_chunk)
|
|
32
32
|
|
33
33
|
if ((status != 0) && !(ctx->options & XML_PARSE_RECOVER)) {
|
34
34
|
// TODO: there appear to be no tests for this block
|
35
|
-
|
35
|
+
xmlErrorConstPtr e = xmlCtxtGetLastError(ctx);
|
36
36
|
Nokogiri_error_raise(NULL, e);
|
37
37
|
}
|
38
38
|
|
data/ext/nokogiri/nokogiri.h
CHANGED
@@ -66,6 +66,13 @@ xmlNodePtr xmlLastElementChild(xmlNodePtr parent);
|
|
66
66
|
#define XMLNS_PREFIX "xmlns"
|
67
67
|
#define XMLNS_PREFIX_LEN 6 /* including either colon or \0 */
|
68
68
|
|
69
|
+
#ifndef xmlErrorConstPtr
|
70
|
+
# if LIBXML_VERSION >= 21200
|
71
|
+
# define xmlErrorConstPtr const xmlError *
|
72
|
+
# else
|
73
|
+
# define xmlErrorConstPtr xmlError *
|
74
|
+
# endif
|
75
|
+
#endif
|
69
76
|
|
70
77
|
#include <ruby.h>
|
71
78
|
#include <ruby/st.h>
|
@@ -227,9 +234,9 @@ void Nokogiri_structured_error_func_save(libxmlStructuredErrorHandlerState *hand
|
|
227
234
|
void Nokogiri_structured_error_func_save_and_set(libxmlStructuredErrorHandlerState *handler_state, void *user_data,
|
228
235
|
xmlStructuredErrorFunc handler);
|
229
236
|
void Nokogiri_structured_error_func_restore(libxmlStructuredErrorHandlerState *handler_state);
|
230
|
-
VALUE Nokogiri_wrap_xml_syntax_error(
|
231
|
-
void Nokogiri_error_array_pusher(void *ctx,
|
232
|
-
NORETURN_DECL void Nokogiri_error_raise(void *ctx,
|
237
|
+
VALUE Nokogiri_wrap_xml_syntax_error(xmlErrorConstPtr error);
|
238
|
+
void Nokogiri_error_array_pusher(void *ctx, xmlErrorConstPtr error);
|
239
|
+
NORETURN_DECL void Nokogiri_error_raise(void *ctx, xmlErrorConstPtr error);
|
233
240
|
void Nokogiri_marshal_xpath_funcall_and_return_values(xmlXPathParserContextPtr ctx, int nargs, VALUE handler,
|
234
241
|
const char *function_name) ;
|
235
242
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
static VALUE foreign_error_handler_block = Qnil;
|
4
4
|
|
5
5
|
static void
|
6
|
-
foreign_error_handler(void *user_data,
|
6
|
+
foreign_error_handler(void *user_data, xmlErrorConstPtr c_error)
|
7
7
|
{
|
8
8
|
rb_funcall(foreign_error_handler_block, rb_intern("call"), 0);
|
9
9
|
}
|
data/ext/nokogiri/xml_cdata.c
CHANGED
@@ -33,8 +33,7 @@ rb_xml_cdata_s_new(int argc, VALUE *argv, VALUE klass)
|
|
33
33
|
|
34
34
|
if (!rb_obj_is_kind_of(rb_document, cNokogiriXmlDocument)) {
|
35
35
|
xmlNodePtr deprecated_node_type_arg;
|
36
|
-
// TODO:
|
37
|
-
NOKO_WARN_DEPRECATION("Passing a Node as the first parameter to CDATA.new is deprecated. Please pass a Document instead. This will become an error in a future release of Nokogiri.");
|
36
|
+
NOKO_WARN_DEPRECATION("Passing a Node as the first parameter to CDATA.new is deprecated. Please pass a Document instead. This will become an error in Nokogiri v1.17.0."); // TODO: deprecated in v1.15.3, remove in v1.17.0
|
38
37
|
Noko_Node_Get_Struct(rb_document, xmlNode, deprecated_node_type_arg);
|
39
38
|
c_document = deprecated_node_type_arg->doc;
|
40
39
|
} else {
|
data/ext/nokogiri/xml_document.c
CHANGED
@@ -337,7 +337,7 @@ read_io(VALUE klass,
|
|
337
337
|
xmlSetStructuredErrorFunc(NULL, NULL);
|
338
338
|
|
339
339
|
if (doc == NULL) {
|
340
|
-
|
340
|
+
xmlErrorConstPtr error;
|
341
341
|
|
342
342
|
xmlFreeDoc(doc);
|
343
343
|
|
@@ -383,7 +383,7 @@ read_memory(VALUE klass,
|
|
383
383
|
xmlSetStructuredErrorFunc(NULL, NULL);
|
384
384
|
|
385
385
|
if (doc == NULL) {
|
386
|
-
|
386
|
+
xmlErrorConstPtr error;
|
387
387
|
|
388
388
|
xmlFreeDoc(doc);
|
389
389
|
|
@@ -537,7 +537,7 @@ create_entity(int argc, VALUE *argv, VALUE self)
|
|
537
537
|
);
|
538
538
|
|
539
539
|
if (NULL == ptr) {
|
540
|
-
|
540
|
+
xmlErrorConstPtr error = xmlGetLastError();
|
541
541
|
if (error) {
|
542
542
|
rb_exc_raise(Nokogiri_wrap_xml_syntax_error(error));
|
543
543
|
} else {
|
@@ -42,7 +42,6 @@ _xml_namespace_dealloc(void *ptr)
|
|
42
42
|
xmlFree(ns);
|
43
43
|
}
|
44
44
|
|
45
|
-
#ifdef HAVE_RB_GC_LOCATION
|
46
45
|
static void
|
47
46
|
_xml_namespace_update_references(void *ptr)
|
48
47
|
{
|
@@ -51,9 +50,6 @@ _xml_namespace_update_references(void *ptr)
|
|
51
50
|
ns->_private = (void *)rb_gc_location((VALUE)ns->_private);
|
52
51
|
}
|
53
52
|
}
|
54
|
-
#else
|
55
|
-
# define _xml_namespace_update_references 0
|
56
|
-
#endif
|
57
53
|
|
58
54
|
static const rb_data_type_t nokogiri_xml_namespace_type_with_dealloc = {
|
59
55
|
.wrap_struct_name = "Nokogiri::XML::Namespace#with_dealloc",
|
data/ext/nokogiri/xml_node.c
CHANGED
@@ -28,7 +28,6 @@ _xml_node_mark(void *ptr)
|
|
28
28
|
}
|
29
29
|
}
|
30
30
|
|
31
|
-
#ifdef HAVE_RB_GC_LOCATION
|
32
31
|
static void
|
33
32
|
_xml_node_update_references(void *ptr)
|
34
33
|
{
|
@@ -38,9 +37,6 @@ _xml_node_update_references(void *ptr)
|
|
38
37
|
node->_private = (void *)rb_gc_location((VALUE)node->_private);
|
39
38
|
}
|
40
39
|
}
|
41
|
-
#else
|
42
|
-
# define _xml_node_update_references 0
|
43
|
-
#endif
|
44
40
|
|
45
41
|
static const rb_data_type_t nokogiri_node_type = {
|
46
42
|
.wrap_struct_name = "Nokogiri::XML::Node",
|
@@ -961,7 +957,7 @@ internal_subset(VALUE self)
|
|
961
957
|
* - +new_parent_doc+
|
962
958
|
* The new node's parent Document. Defaults to the this node's document.
|
963
959
|
*
|
964
|
-
* [Returns] The new
|
960
|
+
* [Returns] The new Nokogiri::XML::Node
|
965
961
|
*/
|
966
962
|
static VALUE
|
967
963
|
duplicate_node(int argc, VALUE *argv, VALUE self)
|
@@ -2058,8 +2054,7 @@ rb_xml_node_new(int argc, VALUE *argv, VALUE klass)
|
|
2058
2054
|
rb_raise(rb_eArgError, "document must be a Nokogiri::XML::Node");
|
2059
2055
|
}
|
2060
2056
|
if (!rb_obj_is_kind_of(rb_document_node, cNokogiriXmlDocument)) {
|
2061
|
-
// TODO:
|
2062
|
-
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.");
|
2057
|
+
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 Nokogiri v1.17.0."); // TODO: deprecated in v1.13.0, remove in v1.17.0
|
2063
2058
|
}
|
2064
2059
|
Noko_Node_Get_Struct(rb_document_node, xmlNode, c_document_node);
|
2065
2060
|
|
@@ -2138,7 +2133,7 @@ process_xincludes(VALUE self, VALUE options)
|
|
2138
2133
|
xmlSetStructuredErrorFunc(NULL, NULL);
|
2139
2134
|
|
2140
2135
|
if (rcode < 0) {
|
2141
|
-
|
2136
|
+
xmlErrorConstPtr error;
|
2142
2137
|
|
2143
2138
|
error = xmlGetLastError();
|
2144
2139
|
if (error) {
|
@@ -2174,6 +2169,8 @@ in_context(VALUE self, VALUE _str, VALUE _options)
|
|
2174
2169
|
|
2175
2170
|
/* Twiddle global variable because of a bug in libxml2.
|
2176
2171
|
* http://git.gnome.org/browse/libxml2/commit/?id=e20fb5a72c83cbfc8e4a8aa3943c6be8febadab7
|
2172
|
+
*
|
2173
|
+
* TODO: this is fixed, and HTML_PARSE_NOIMPLIED is defined, in libxml2 2.7.7
|
2177
2174
|
*/
|
2178
2175
|
#ifndef HTML_PARSE_NOIMPLIED
|
2179
2176
|
htmlHandleOmittedElem(0);
|
data/ext/nokogiri/xml_reader.c
CHANGED
@@ -166,48 +166,6 @@ rb_xml_reader_namespaces(VALUE rb_reader)
|
|
166
166
|
return rb_namespaces ;
|
167
167
|
}
|
168
168
|
|
169
|
-
/*
|
170
|
-
:call-seq: attribute_nodes() → Array<Nokogiri::XML::Attr>
|
171
|
-
|
172
|
-
Get the attributes of the current node as an Array of XML:Attr
|
173
|
-
|
174
|
-
⚠ This method is deprecated and unsafe to use. It will be removed in a future version of Nokogiri.
|
175
|
-
|
176
|
-
See related: #attribute_hash, #attributes
|
177
|
-
*/
|
178
|
-
static VALUE
|
179
|
-
rb_xml_reader_attribute_nodes(VALUE rb_reader)
|
180
|
-
{
|
181
|
-
xmlTextReaderPtr c_reader;
|
182
|
-
xmlNodePtr c_node;
|
183
|
-
VALUE attr_nodes;
|
184
|
-
int j;
|
185
|
-
|
186
|
-
// TODO: deprecated, remove in Nokogiri v1.15, see https://github.com/sparklemotion/nokogiri/issues/2598
|
187
|
-
// After removal, we can also remove all the "node_has_a_document" special handling from xml_node.c
|
188
|
-
NOKO_WARN_DEPRECATION("Reader#attribute_nodes is deprecated and will be removed in a future version of Nokogiri. Please use Reader#attribute_hash instead.");
|
189
|
-
|
190
|
-
TypedData_Get_Struct(rb_reader, xmlTextReader, &xml_reader_type, c_reader);
|
191
|
-
|
192
|
-
if (! has_attributes(c_reader)) {
|
193
|
-
return rb_ary_new() ;
|
194
|
-
}
|
195
|
-
|
196
|
-
c_node = xmlTextReaderExpand(c_reader);
|
197
|
-
if (c_node == NULL) {
|
198
|
-
return Qnil;
|
199
|
-
}
|
200
|
-
|
201
|
-
attr_nodes = noko_xml_node_attrs(c_node);
|
202
|
-
|
203
|
-
/* ensure that the Reader won't be GCed as long as a node is referenced */
|
204
|
-
for (j = 0 ; j < RARRAY_LEN(attr_nodes) ; j++) {
|
205
|
-
rb_iv_set(rb_ary_entry(attr_nodes, j), "@reader", rb_reader);
|
206
|
-
}
|
207
|
-
|
208
|
-
return attr_nodes;
|
209
|
-
}
|
210
|
-
|
211
169
|
/*
|
212
170
|
:call-seq: attribute_hash() → Hash<String ⇒ String>
|
213
171
|
|
@@ -554,7 +512,7 @@ static VALUE
|
|
554
512
|
read_more(VALUE self)
|
555
513
|
{
|
556
514
|
xmlTextReaderPtr reader;
|
557
|
-
|
515
|
+
xmlErrorConstPtr error;
|
558
516
|
VALUE error_list;
|
559
517
|
int ret;
|
560
518
|
|
@@ -778,7 +736,6 @@ noko_init_xml_reader(void)
|
|
778
736
|
rb_define_method(cNokogiriXmlReader, "attribute", reader_attribute, 1);
|
779
737
|
rb_define_method(cNokogiriXmlReader, "attribute_at", attribute_at, 1);
|
780
738
|
rb_define_method(cNokogiriXmlReader, "attribute_count", attribute_count, 0);
|
781
|
-
rb_define_method(cNokogiriXmlReader, "attribute_nodes", rb_xml_reader_attribute_nodes, 0);
|
782
739
|
rb_define_method(cNokogiriXmlReader, "attribute_hash", rb_xml_reader_attribute_hash, 0);
|
783
740
|
rb_define_method(cNokogiriXmlReader, "attributes?", attributes_eh, 0);
|
784
741
|
rb_define_method(cNokogiriXmlReader, "base_uri", rb_xml_reader_base_uri, 0);
|
data/ext/nokogiri/xml_relax_ng.c
CHANGED
@@ -59,7 +59,7 @@ native_write(VALUE self, VALUE _chunk, VALUE _last_chunk)
|
|
59
59
|
|
60
60
|
if (xmlParseChunk(ctx, chunk, size, Qtrue == _last_chunk ? 1 : 0)) {
|
61
61
|
if (!(ctx->options & XML_PARSE_RECOVER)) {
|
62
|
-
|
62
|
+
xmlErrorConstPtr e = xmlCtxtGetLastError(ctx);
|
63
63
|
Nokogiri_error_raise(NULL, e);
|
64
64
|
}
|
65
65
|
}
|
data/ext/nokogiri/xml_schema.c
CHANGED
@@ -146,7 +146,7 @@ xml_schema_parse_schema(
|
|
146
146
|
xmlSchemaFreeParserCtxt(c_parser_context);
|
147
147
|
|
148
148
|
if (NULL == c_schema) {
|
149
|
-
|
149
|
+
xmlErrorConstPtr error = xmlGetLastError();
|
150
150
|
if (error) {
|
151
151
|
Nokogiri_error_raise(NULL, error);
|
152
152
|
} else {
|
@@ -222,8 +222,7 @@ rb_xml_schema_s_from_document(int argc, VALUE *argv, VALUE klass)
|
|
222
222
|
|
223
223
|
if (!rb_obj_is_kind_of(rb_document, cNokogiriXmlDocument)) {
|
224
224
|
xmlNodePtr deprecated_node_type_arg;
|
225
|
-
// TODO:
|
226
|
-
NOKO_WARN_DEPRECATION("Passing a Node as the first parameter to Schema.from_document is deprecated. Please pass a Document instead. This will become an error in a future release of Nokogiri.");
|
225
|
+
NOKO_WARN_DEPRECATION("Passing a Node as the first parameter to Schema.from_document is deprecated. Please pass a Document instead. This will become an error in Nokogiri v1.17.0."); // TODO: deprecated in v1.15.3, remove in v1.17.0
|
227
226
|
Noko_Node_Get_Struct(rb_document, xmlNode, deprecated_node_type_arg);
|
228
227
|
c_document = deprecated_node_type_arg->doc;
|
229
228
|
} else {
|
@@ -26,7 +26,7 @@ Nokogiri_structured_error_func_restore(libxmlStructuredErrorHandlerState *handle
|
|
26
26
|
}
|
27
27
|
|
28
28
|
void
|
29
|
-
Nokogiri_error_array_pusher(void *ctx,
|
29
|
+
Nokogiri_error_array_pusher(void *ctx, xmlErrorConstPtr error)
|
30
30
|
{
|
31
31
|
VALUE list = (VALUE)ctx;
|
32
32
|
Check_Type(list, T_ARRAY);
|
@@ -34,13 +34,13 @@ Nokogiri_error_array_pusher(void *ctx, xmlErrorPtr error)
|
|
34
34
|
}
|
35
35
|
|
36
36
|
void
|
37
|
-
Nokogiri_error_raise(void *ctx,
|
37
|
+
Nokogiri_error_raise(void *ctx, xmlErrorConstPtr error)
|
38
38
|
{
|
39
39
|
rb_exc_raise(Nokogiri_wrap_xml_syntax_error(error));
|
40
40
|
}
|
41
41
|
|
42
42
|
VALUE
|
43
|
-
Nokogiri_wrap_xml_syntax_error(
|
43
|
+
Nokogiri_wrap_xml_syntax_error(xmlErrorConstPtr error)
|
44
44
|
{
|
45
45
|
VALUE msg, e, klass;
|
46
46
|
|
data/ext/nokogiri/xml_text.c
CHANGED
@@ -28,8 +28,7 @@ rb_xml_text_s_new(int argc, VALUE *argv, VALUE klass)
|
|
28
28
|
|
29
29
|
if (!rb_obj_is_kind_of(rb_document, cNokogiriXmlDocument)) {
|
30
30
|
xmlNodePtr deprecated_node_type_arg;
|
31
|
-
// TODO:
|
32
|
-
NOKO_WARN_DEPRECATION("Passing a Node as the second parameter to Text.new is deprecated. Please pass a Document instead. This will become an error in a future release of Nokogiri.");
|
31
|
+
NOKO_WARN_DEPRECATION("Passing a Node as the second parameter to Text.new is deprecated. Please pass a Document instead. This will become an error in Nokogiri v1.17.0."); // TODO: deprecated in v1.15.3, remove in v1.17.0
|
33
32
|
Noko_Node_Get_Struct(rb_document, xmlNode, deprecated_node_type_arg);
|
34
33
|
c_document = deprecated_node_type_arg->doc;
|
35
34
|
} else {
|
@@ -321,11 +321,8 @@ handler_lookup(void *data, const xmlChar *c_name, const xmlChar *c_ns_uri)
|
|
321
321
|
VALUE rb_handler = (VALUE)data;
|
322
322
|
if (rb_respond_to(rb_handler, rb_intern((const char *)c_name))) {
|
323
323
|
if (c_ns_uri == NULL) {
|
324
|
-
NOKO_WARN_DEPRECATION(
|
325
|
-
|
326
|
-
" Please update your query to reference this function as 'nokogiri:%s'."
|
327
|
-
" Invoking custom handler functions without a namespace is deprecated and support will be removed in a future release of Nokogiri.",
|
328
|
-
c_name, c_name);
|
324
|
+
NOKO_WARN_DEPRECATION("A custom XPath or CSS handler function named '%s' is being invoked without a namespace. Please update your query to reference this function as 'nokogiri:%s'. Invoking custom handler functions without a namespace is deprecated and will become an error in Nokogiri v1.17.0.",
|
325
|
+
c_name, c_name); // deprecated in v1.15.0, remove in v1.17.0
|
329
326
|
}
|
330
327
|
return method_caller;
|
331
328
|
}
|
data/gumbo-parser/Makefile
CHANGED
@@ -13,6 +13,20 @@ LDFLAGS := -pthread
|
|
13
13
|
|
14
14
|
all: check
|
15
15
|
|
16
|
+
fuzzers: fuzzer-normal fuzzer-asan fuzzer-ubsan fuzzer-msan
|
17
|
+
|
18
|
+
fuzzer-normal:
|
19
|
+
./fuzzer/build.sh
|
20
|
+
|
21
|
+
fuzzer-asan:
|
22
|
+
SANITIZER=asan ./fuzzer/build.sh
|
23
|
+
|
24
|
+
fuzzer-ubsan:
|
25
|
+
SANITIZER=ubsan ./fuzzer/build.sh
|
26
|
+
|
27
|
+
fuzzer-msan:
|
28
|
+
SANITIZER=msan ./fuzzer/build.sh
|
29
|
+
|
16
30
|
# don't try to regenerate ragel or gperf files in CI, that should be a development-only action and
|
17
31
|
# the generated files should be committed to SCM
|
18
32
|
ifneq ($(CI),true)
|
@@ -81,6 +95,7 @@ coverage:
|
|
81
95
|
|
82
96
|
clean:
|
83
97
|
$(RM) -r build
|
98
|
+
$(RM) -r fuzzer/build fuzzer/src-* fuzzer/gumbo_corpus
|
84
99
|
|
85
100
|
build/src/flags: | build/src
|
86
101
|
@echo 'old_CC := $(CC)' > $@
|
@@ -506,6 +506,7 @@ static void abandon_current_tag(GumboParser* parser) {
|
|
506
506
|
for (unsigned int i = 0; i < tag_state->_attributes.length; ++i) {
|
507
507
|
gumbo_destroy_attribute(tag_state->_attributes.data[i]);
|
508
508
|
}
|
509
|
+
gumbo_free(tag_state->_name);
|
509
510
|
gumbo_free(tag_state->_attributes.data);
|
510
511
|
mark_tag_state_as_empty(tag_state);
|
511
512
|
gumbo_string_buffer_destroy(&tag_state->_buffer);
|
@@ -302,7 +302,7 @@ module Nokogiri
|
|
302
302
|
end
|
303
303
|
|
304
304
|
def read_a_and_positive_b(values)
|
305
|
-
op = values[2]
|
305
|
+
op = values[2].strip
|
306
306
|
if op == "+"
|
307
307
|
a = values[0].to_i
|
308
308
|
b = values[3].to_i
|
@@ -335,25 +335,5 @@ module Nokogiri
|
|
335
335
|
end
|
336
336
|
end
|
337
337
|
end
|
338
|
-
|
339
|
-
module XPathVisitorAlwaysUseBuiltins # :nodoc:
|
340
|
-
def self.new
|
341
|
-
warn(
|
342
|
-
"Nokogiri::CSS::XPathVisitorAlwaysUseBuiltins is deprecated and will be removed in a future version of Nokogiri",
|
343
|
-
{ uplevel: 1 },
|
344
|
-
)
|
345
|
-
XPathVisitor.new(builtins: :always)
|
346
|
-
end
|
347
|
-
end
|
348
|
-
|
349
|
-
module XPathVisitorOptimallyUseBuiltins # :nodoc:
|
350
|
-
def self.new
|
351
|
-
warn(
|
352
|
-
"Nokogiri::CSS::XPathVisitorOptimallyUseBuiltins is deprecated and will be removed in a future version of Nokogiri",
|
353
|
-
{ uplevel: 1 },
|
354
|
-
)
|
355
|
-
XPathVisitor.new(builtins: :optimal)
|
356
|
-
end
|
357
|
-
end
|
358
338
|
end
|
359
339
|
end
|
@@ -92,7 +92,7 @@ module Nokogiri
|
|
92
92
|
title = XML::Node.new("title", self) << tnode
|
93
93
|
if (head = at_xpath("//head"))
|
94
94
|
head << title
|
95
|
-
elsif (meta =
|
95
|
+
elsif (meta = at_xpath("//meta[@charset]") || meta_content_type)
|
96
96
|
# better put after charset declaration
|
97
97
|
meta.add_next_sibling(title)
|
98
98
|
else
|
@@ -94,7 +94,7 @@ module Nokogiri
|
|
94
94
|
# no support for a call without len
|
95
95
|
|
96
96
|
unless @firstchunk
|
97
|
-
(@firstchunk = @io.read(len)) ||
|
97
|
+
(@firstchunk = @io.read(len)) || return
|
98
98
|
|
99
99
|
# This implementation expects that the first call from
|
100
100
|
# htmlReadIO() is made with a length long enough (~1KB) to
|
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
|
Binary file
|
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: 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:
|
23
|
+
date: 2023-12-13 00:00:00.000000000 Z
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mini_portile2
|
@@ -272,7 +272,7 @@ 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.
|
275
|
+
- ports/archives/libxml2-2.12.3.tar.xz
|
276
276
|
- ports/archives/libxslt-1.1.39.tar.xz
|
277
277
|
homepage: https://nokogiri.org
|
278
278
|
licenses:
|
@@ -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:
|
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
|
-
version:
|
302
|
+
version: 1.3.1
|
303
303
|
requirements: []
|
304
304
|
rubygems_version: 3.4.19
|
305
|
-
signing_key:
|
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
|