nokogiri 1.16.0 → 1.16.6
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.
Potentially problematic release.
This version of nokogiri might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +11 -5
- data/dependencies.yml +6 -6
- data/ext/nokogiri/xml_document.c +4 -0
- data/ext/nokogiri/xml_reader.c +25 -4
- data/ext/nokogiri/xslt_stylesheet.c +8 -3
- data/gumbo-parser/Makefile +3 -0
- data/gumbo-parser/src/parser.c +8 -5
- data/lib/nokogiri/version/constant.rb +1 -1
- data/lib/nokogiri/xml/reader.rb +10 -9
- data/lib/nokogiri/xslt/stylesheet.rb +29 -7
- data/ports/archives/libxml2-2.12.8.tar.xz +0 -0
- metadata +7 -7
- data/ports/archives/libxml2-2.12.3.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: 265995b2c377e4457aca61465f5adb40912633b08a56df3aa709570d3274a3e2
|
4
|
+
data.tar.gz: 61e6f5f65e8b272032089b21e046f460f1f1ad39dba13f847fb8b6fc29bafd01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e01dfe5f6511eb28d7db99dabb4ecd9b82ee6e749e1ad5a54251914f1068b9491d5b41676cd0f82a848466ceaacd0c65182d66f2d123c4545d11c9152d9150b
|
7
|
+
data.tar.gz: 74684f41f6c6170e21ab0f0e561cf4ed75764deda9f4c8442fcc317eafdf99503df2b623c948f4272348cbb4a5ca5af6ca5da140ba6eb04d58d833b75d01c45d
|
data/Gemfile
CHANGED
@@ -5,19 +5,25 @@ source "https://rubygems.org"
|
|
5
5
|
gemspec
|
6
6
|
|
7
7
|
group :development do
|
8
|
+
# ruby 3.4.0-dev removed some gems from the default set
|
9
|
+
#
|
10
|
+
# TODO: we should be able to remove these as our gem dependencies sort it out and we pull them in
|
11
|
+
# transitively.
|
12
|
+
gem "mutex_m"
|
13
|
+
|
8
14
|
# bootstrapping
|
9
15
|
gem "bundler", "~> 2.3"
|
10
16
|
gem "rake", "13.1.0"
|
11
17
|
|
12
18
|
# building extensions
|
13
|
-
gem "rake-compiler", "1.2.
|
19
|
+
gem "rake-compiler", "1.2.6"
|
14
20
|
gem "rake-compiler-dock", "1.4.0"
|
15
21
|
|
16
22
|
# parser generator
|
17
23
|
gem "rexical", "= 1.0.7"
|
18
24
|
|
19
25
|
# tests
|
20
|
-
gem "minitest", "5.
|
26
|
+
gem "minitest", "5.21.2"
|
21
27
|
gem "minitest-parallel_fork", "2.0.0"
|
22
28
|
gem "ruby_memcheck", "2.3.0"
|
23
29
|
gem "rubyzip", "~> 2.3.2"
|
@@ -25,10 +31,10 @@ group :development do
|
|
25
31
|
|
26
32
|
# rubocop
|
27
33
|
if Gem::Requirement.new("~> 3.0").satisfied_by?(Gem::Version.new(RUBY_VERSION))
|
28
|
-
gem "rubocop", "1.
|
29
|
-
gem "rubocop-minitest", "0.34.
|
34
|
+
gem "rubocop", "1.60.2"
|
35
|
+
gem "rubocop-minitest", "0.34.5"
|
30
36
|
gem "rubocop-packaging", "0.5.2"
|
31
|
-
gem "rubocop-performance", "1.20.
|
37
|
+
gem "rubocop-performance", "1.20.2"
|
32
38
|
gem "rubocop-rake", "= 0.6.0"
|
33
39
|
gem "rubocop-shopify", "2.14.0"
|
34
40
|
end
|
data/dependencies.yml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
|
1
|
+
---
|
2
2
|
libxml2:
|
3
|
-
version: "2.12.
|
4
|
-
sha256: "
|
5
|
-
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.12/libxml2-2.12.
|
3
|
+
version: "2.12.8"
|
4
|
+
sha256: "43ad877b018bc63deb2468d71f95219c2fac196876ef36d1bee51d226173ec93"
|
5
|
+
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.12/libxml2-2.12.8.sha256sum
|
6
6
|
|
7
7
|
libxslt:
|
8
8
|
version: "1.1.39"
|
@@ -10,8 +10,8 @@ libxslt:
|
|
10
10
|
# sha-256 hash provided in https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.39.sha256sum
|
11
11
|
|
12
12
|
zlib:
|
13
|
-
version: "1.3"
|
14
|
-
sha256: "
|
13
|
+
version: "1.3.1"
|
14
|
+
sha256: "9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23"
|
15
15
|
# SHA-256 hash provided on http://zlib.net/
|
16
16
|
|
17
17
|
libiconv:
|
data/ext/nokogiri/xml_document.c
CHANGED
@@ -74,8 +74,10 @@ dealloc(void *data)
|
|
74
74
|
|
75
75
|
ruby_xfree(doc->_private);
|
76
76
|
|
77
|
+
#if defined(__GNUC__) && __GNUC__ >= 5
|
77
78
|
#pragma GCC diagnostic push
|
78
79
|
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" // xmlDeregisterNodeDefault is deprecated as of libxml2 2.11.0
|
80
|
+
#endif
|
79
81
|
/*
|
80
82
|
* libxml-ruby < 3.0.0 uses xmlDeregisterNodeDefault. If the user is using one of those older
|
81
83
|
* versions, the registered callback from libxml-ruby will access the _private pointers set by
|
@@ -90,7 +92,9 @@ dealloc(void *data)
|
|
90
92
|
if (xmlDeregisterNodeDefaultValue) {
|
91
93
|
remove_private((xmlNodePtr)doc);
|
92
94
|
}
|
95
|
+
#if defined(__GNUC__) && __GNUC__ >= 5
|
93
96
|
#pragma GCC diagnostic pop
|
97
|
+
#endif
|
94
98
|
|
95
99
|
xmlFreeDoc(doc);
|
96
100
|
}
|
data/ext/nokogiri/xml_reader.c
CHANGED
@@ -5,8 +5,14 @@ VALUE cNokogiriXmlReader;
|
|
5
5
|
static void
|
6
6
|
xml_reader_deallocate(void *data)
|
7
7
|
{
|
8
|
+
// free the document separately because we _may_ have triggered preservation by calling
|
9
|
+
// xmlTextReaderCurrentDoc during a read_more.
|
8
10
|
xmlTextReaderPtr reader = data;
|
11
|
+
xmlDocPtr doc = xmlTextReaderCurrentDoc(reader);
|
9
12
|
xmlFreeTextReader(reader);
|
13
|
+
if (doc) {
|
14
|
+
xmlFreeDoc(doc);
|
15
|
+
}
|
10
16
|
}
|
11
17
|
|
12
18
|
static const rb_data_type_t xml_reader_type = {
|
@@ -515,6 +521,7 @@ read_more(VALUE self)
|
|
515
521
|
xmlErrorConstPtr error;
|
516
522
|
VALUE error_list;
|
517
523
|
int ret;
|
524
|
+
xmlDocPtr c_document;
|
518
525
|
|
519
526
|
TypedData_Get_Struct(self, xmlTextReader, &xml_reader_type, reader);
|
520
527
|
|
@@ -524,6 +531,17 @@ read_more(VALUE self)
|
|
524
531
|
ret = xmlTextReaderRead(reader);
|
525
532
|
xmlSetStructuredErrorFunc(NULL, NULL);
|
526
533
|
|
534
|
+
c_document = xmlTextReaderCurrentDoc(reader);
|
535
|
+
if (c_document && c_document->encoding == NULL) {
|
536
|
+
VALUE constructor_encoding = rb_iv_get(self, "@encoding");
|
537
|
+
if (RTEST(constructor_encoding)) {
|
538
|
+
c_document->encoding = xmlStrdup(BAD_CAST StringValueCStr(constructor_encoding));
|
539
|
+
} else {
|
540
|
+
rb_iv_set(self, "@encoding", NOKOGIRI_STR_NEW2("UTF-8"));
|
541
|
+
c_document->encoding = xmlStrdup(BAD_CAST "UTF-8");
|
542
|
+
}
|
543
|
+
}
|
544
|
+
|
527
545
|
if (ret == 1) { return self; }
|
528
546
|
if (ret == 0) { return Qnil; }
|
529
547
|
|
@@ -707,15 +725,18 @@ rb_xml_reader_encoding(VALUE rb_reader)
|
|
707
725
|
const char *parser_encoding;
|
708
726
|
VALUE constructor_encoding;
|
709
727
|
|
728
|
+
TypedData_Get_Struct(rb_reader, xmlTextReader, &xml_reader_type, c_reader);
|
729
|
+
parser_encoding = (const char *)xmlTextReaderConstEncoding(c_reader);
|
730
|
+
if (parser_encoding) {
|
731
|
+
return NOKOGIRI_STR_NEW2(parser_encoding);
|
732
|
+
}
|
733
|
+
|
710
734
|
constructor_encoding = rb_iv_get(rb_reader, "@encoding");
|
711
735
|
if (RTEST(constructor_encoding)) {
|
712
736
|
return constructor_encoding;
|
713
737
|
}
|
714
738
|
|
715
|
-
|
716
|
-
parser_encoding = (const char *)xmlTextReaderConstEncoding(c_reader);
|
717
|
-
if (parser_encoding == NULL) { return Qnil; }
|
718
|
-
return NOKOGIRI_STR_NEW2(parser_encoding);
|
739
|
+
return Qnil;
|
719
740
|
}
|
720
741
|
|
721
742
|
void
|
@@ -71,7 +71,12 @@ Nokogiri_wrap_xslt_stylesheet(xsltStylesheetPtr ss)
|
|
71
71
|
* call-seq:
|
72
72
|
* parse_stylesheet_doc(document)
|
73
73
|
*
|
74
|
-
* Parse
|
74
|
+
* Parse an XSLT::Stylesheet from +document+.
|
75
|
+
*
|
76
|
+
* [Parameters]
|
77
|
+
* - +document+ (Nokogiri::XML::Document) the document to be parsed.
|
78
|
+
*
|
79
|
+
* [Returns] Nokogiri::XSLT::Stylesheet
|
75
80
|
*/
|
76
81
|
static VALUE
|
77
82
|
parse_stylesheet_doc(VALUE klass, VALUE xmldocobj)
|
@@ -104,7 +109,7 @@ parse_stylesheet_doc(VALUE klass, VALUE xmldocobj)
|
|
104
109
|
* call-seq:
|
105
110
|
* serialize(document)
|
106
111
|
*
|
107
|
-
* Serialize +document+ to an xml string.
|
112
|
+
* Serialize +document+ to an xml string, as specified by the +method+ parameter in the Stylesheet.
|
108
113
|
*/
|
109
114
|
static VALUE
|
110
115
|
rb_xslt_stylesheet_serialize(VALUE self, VALUE xmlobj)
|
@@ -133,7 +138,7 @@ rb_xslt_stylesheet_serialize(VALUE self, VALUE xmlobj)
|
|
133
138
|
* transform(document)
|
134
139
|
* transform(document, params = {})
|
135
140
|
*
|
136
|
-
*
|
141
|
+
* Transform an XML::Document as defined by an XSLT::Stylesheet.
|
137
142
|
*
|
138
143
|
* [Parameters]
|
139
144
|
* - +document+ (Nokogiri::XML::Document) the document to be transformed.
|
data/gumbo-parser/Makefile
CHANGED
data/gumbo-parser/src/parser.c
CHANGED
@@ -4826,14 +4826,17 @@ GumboOutput* gumbo_parse_with_options (
|
|
4826
4826
|
// to a token.
|
4827
4827
|
if (token.type == GUMBO_TOKEN_END_TAG &&
|
4828
4828
|
token.v.end_tag.tag == GUMBO_TAG_UNKNOWN)
|
4829
|
+
{
|
4829
4830
|
gumbo_free(token.v.end_tag.name);
|
4831
|
+
token.v.end_tag.name = NULL;
|
4832
|
+
}
|
4833
|
+
if (unlikely(state->_open_elements.length > max_tree_depth)) {
|
4834
|
+
parser._output->status = GUMBO_STATUS_TREE_TOO_DEEP;
|
4835
|
+
gumbo_debug("Tree depth limit exceeded.\n");
|
4836
|
+
break;
|
4837
|
+
}
|
4830
4838
|
}
|
4831
4839
|
|
4832
|
-
if (unlikely(state->_open_elements.length > max_tree_depth)) {
|
4833
|
-
parser._output->status = GUMBO_STATUS_TREE_TOO_DEEP;
|
4834
|
-
gumbo_debug("Tree depth limit exceeded.\n");
|
4835
|
-
break;
|
4836
|
-
}
|
4837
4840
|
|
4838
4841
|
++loop_count;
|
4839
4842
|
assert(loop_count < 1000000000UL);
|
data/lib/nokogiri/xml/reader.rb
CHANGED
@@ -3,9 +3,11 @@
|
|
3
3
|
module Nokogiri
|
4
4
|
module XML
|
5
5
|
###
|
6
|
-
# Nokogiri::XML::Reader parses an XML document similar to the way a cursor
|
7
|
-
#
|
8
|
-
#
|
6
|
+
# Nokogiri::XML::Reader parses an XML document similar to the way a cursor would move. The
|
7
|
+
# Reader is given an XML document, and yields nodes to an each block.
|
8
|
+
#
|
9
|
+
# The Reader parser might be good for when you need the speed and low memory usage of the SAX
|
10
|
+
# parser, but do not want to write a Document handler.
|
9
11
|
#
|
10
12
|
# Here is an example of usage:
|
11
13
|
#
|
@@ -22,13 +24,12 @@ module Nokogiri
|
|
22
24
|
#
|
23
25
|
# end
|
24
26
|
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
# need during the first iteration.
|
27
|
+
# ⚠ Nokogiri::XML::Reader#each can only be called once! Once the cursor moves through the entire
|
28
|
+
# document, you must parse the document again. It may be better to capture all information you
|
29
|
+
# need during a single iteration.
|
29
30
|
#
|
30
|
-
#
|
31
|
-
#
|
31
|
+
# ⚠ libxml2 does not support error recovery in the Reader parser. The `RECOVER` ParseOption is
|
32
|
+
# ignored. If a syntax error is encountered during parsing, an exception will be raised.
|
32
33
|
class Reader
|
33
34
|
include Enumerable
|
34
35
|
|
@@ -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
|
-
#
|
13
|
+
# xslt.transform(doc) # => Nokogiri::XML::Document
|
14
14
|
#
|
15
|
-
#
|
16
|
-
#
|
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
|
-
#
|
20
|
-
#
|
21
|
-
#
|
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
|
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.16.
|
4
|
+
version: 1.16.6
|
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: 2024-06-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.12.
|
275
|
+
- ports/archives/libxml2-2.12.8.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
|
@@ -301,8 +301,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
301
301
|
- !ruby/object:Gem::Version
|
302
302
|
version: '0'
|
303
303
|
requirements: []
|
304
|
-
rubygems_version: 3.
|
305
|
-
signing_key:
|
304
|
+
rubygems_version: 3.5.11
|
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
|