nokogiri 1.13.6 → 1.14.2
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 +39 -0
- data/LICENSE-DEPENDENCIES.md +830 -509
- data/LICENSE.md +1 -1
- data/README.md +18 -11
- data/dependencies.yml +33 -15
- data/ext/nokogiri/extconf.rb +100 -24
- data/ext/nokogiri/gumbo.c +21 -11
- data/ext/nokogiri/html4_document.c +2 -2
- data/ext/nokogiri/html4_element_description.c +1 -1
- data/ext/nokogiri/html4_entity_lookup.c +2 -2
- data/ext/nokogiri/html4_sax_parser_context.c +1 -6
- data/ext/nokogiri/html4_sax_push_parser.c +1 -1
- data/ext/nokogiri/nokogiri.c +38 -51
- data/ext/nokogiri/nokogiri.h +26 -14
- data/ext/nokogiri/test_global_handlers.c +1 -1
- data/ext/nokogiri/xml_attr.c +3 -3
- data/ext/nokogiri/xml_attribute_decl.c +5 -5
- data/ext/nokogiri/xml_cdata.c +3 -3
- data/ext/nokogiri/xml_comment.c +1 -1
- data/ext/nokogiri/xml_document.c +23 -14
- data/ext/nokogiri/xml_document_fragment.c +1 -1
- data/ext/nokogiri/xml_dtd.c +9 -9
- data/ext/nokogiri/xml_element_content.c +3 -3
- data/ext/nokogiri/xml_element_decl.c +5 -5
- data/ext/nokogiri/xml_encoding_handler.c +3 -3
- data/ext/nokogiri/xml_entity_decl.c +6 -6
- data/ext/nokogiri/xml_entity_reference.c +1 -1
- data/ext/nokogiri/xml_namespace.c +80 -14
- data/ext/nokogiri/xml_node.c +363 -82
- data/ext/nokogiri/xml_node_set.c +4 -6
- data/ext/nokogiri/xml_processing_instruction.c +1 -1
- data/ext/nokogiri/xml_reader.c +97 -22
- data/ext/nokogiri/xml_relax_ng.c +1 -3
- data/ext/nokogiri/xml_sax_parser.c +23 -17
- data/ext/nokogiri/xml_sax_parser_context.c +1 -6
- data/ext/nokogiri/xml_sax_push_parser.c +1 -3
- data/ext/nokogiri/xml_schema.c +4 -6
- data/ext/nokogiri/xml_syntax_error.c +1 -1
- data/ext/nokogiri/xml_text.c +2 -2
- data/ext/nokogiri/xml_xpath_context.c +91 -84
- data/ext/nokogiri/xslt_stylesheet.c +15 -14
- data/gumbo-parser/Makefile +10 -0
- data/gumbo-parser/src/attribute.h +1 -1
- data/gumbo-parser/src/error.c +2 -2
- data/gumbo-parser/src/error.h +1 -1
- data/gumbo-parser/src/foreign_attrs.c +2 -2
- data/gumbo-parser/src/{gumbo.h → nokogiri_gumbo.h} +1 -0
- data/gumbo-parser/src/parser.c +8 -5
- data/gumbo-parser/src/replacement.h +1 -1
- data/gumbo-parser/src/string_buffer.h +1 -1
- data/gumbo-parser/src/string_piece.c +1 -1
- data/gumbo-parser/src/svg_attrs.c +2 -2
- data/gumbo-parser/src/svg_tags.c +2 -2
- data/gumbo-parser/src/tag.c +2 -1
- data/gumbo-parser/src/tag_lookup.c +7 -7
- data/gumbo-parser/src/tag_lookup.gperf +1 -0
- data/gumbo-parser/src/tag_lookup.h +1 -1
- data/gumbo-parser/src/token_buffer.h +1 -1
- data/gumbo-parser/src/tokenizer.c +1 -1
- data/gumbo-parser/src/tokenizer.h +1 -1
- data/gumbo-parser/src/utf8.c +1 -1
- data/gumbo-parser/src/utf8.h +1 -1
- data/gumbo-parser/src/util.c +1 -3
- data/gumbo-parser/src/util.h +4 -0
- data/gumbo-parser/src/vector.h +1 -1
- data/lib/nokogiri/css/node.rb +2 -2
- data/lib/nokogiri/css/xpath_visitor.rb +5 -3
- data/lib/nokogiri/css.rb +6 -0
- data/lib/nokogiri/decorators/slop.rb +1 -1
- data/lib/nokogiri/encoding_handler.rb +57 -0
- data/lib/nokogiri/extension.rb +3 -2
- data/lib/nokogiri/html4/document.rb +2 -121
- data/lib/nokogiri/html4/element_description_defaults.rb +6 -12
- data/lib/nokogiri/html4/encoding_reader.rb +121 -0
- data/lib/nokogiri/html4.rb +1 -0
- data/lib/nokogiri/html5/document.rb +113 -36
- data/lib/nokogiri/html5/document_fragment.rb +9 -2
- data/lib/nokogiri/html5/node.rb +3 -5
- data/lib/nokogiri/html5.rb +127 -216
- data/lib/nokogiri/jruby/dependencies.rb +1 -19
- data/lib/nokogiri/jruby/nokogiri_jars.rb +43 -0
- data/lib/nokogiri/version/constant.rb +1 -1
- data/lib/nokogiri/version/info.rb +11 -10
- data/lib/nokogiri/xml/attr.rb +49 -0
- data/lib/nokogiri/xml/builder.rb +1 -1
- data/lib/nokogiri/xml/document.rb +103 -55
- data/lib/nokogiri/xml/document_fragment.rb +49 -6
- data/lib/nokogiri/xml/namespace.rb +42 -0
- data/lib/nokogiri/xml/node/save_options.rb +6 -4
- data/lib/nokogiri/xml/node.rb +190 -35
- data/lib/nokogiri/xml/node_set.rb +88 -9
- data/lib/nokogiri/xml/parse_options.rb +129 -50
- data/lib/nokogiri/xml/pp/node.rb +6 -4
- data/lib/nokogiri/xml/processing_instruction.rb +2 -1
- data/lib/nokogiri/xml/reader.rb +6 -8
- data/lib/nokogiri/xml/sax/parser.rb +2 -3
- data/lib/nokogiri/xslt.rb +1 -1
- data/lib/nokogiri.rb +3 -11
- data/lib/xsd/xmlparser/nokogiri.rb +3 -1
- data/ports/archives/libxml2-2.10.3.tar.xz +0 -0
- data/ports/archives/libxslt-1.1.37.tar.xz +0 -0
- metadata +11 -242
- data/patches/libxml2/0004-use-glibc-strlen.patch +0 -53
- data/patches/libxml2/0005-avoid-isnan-isinf.patch +0 -81
- data/patches/libxml2/0006-update-automake-files-for-arm64.patch +0 -3040
- data/patches/libxml2/0008-htmlParseComment-handle-abruptly-closed-comments.patch +0 -61
- data/ports/archives/libxml2-2.9.14.tar.xz +0 -0
- data/ports/archives/libxslt-1.1.35.tar.xz +0 -0
@@ -12,7 +12,7 @@ static VALUE
|
|
12
12
|
original_content(VALUE self)
|
13
13
|
{
|
14
14
|
xmlEntityPtr node;
|
15
|
-
|
15
|
+
Noko_Node_Get_Struct(self, xmlEntity, node);
|
16
16
|
|
17
17
|
if (!node->orig) { return Qnil; }
|
18
18
|
|
@@ -29,7 +29,7 @@ static VALUE
|
|
29
29
|
get_content(VALUE self)
|
30
30
|
{
|
31
31
|
xmlEntityPtr node;
|
32
|
-
|
32
|
+
Noko_Node_Get_Struct(self, xmlEntity, node);
|
33
33
|
|
34
34
|
if (!node->content) { return Qnil; }
|
35
35
|
|
@@ -46,7 +46,7 @@ static VALUE
|
|
46
46
|
entity_type(VALUE self)
|
47
47
|
{
|
48
48
|
xmlEntityPtr node;
|
49
|
-
|
49
|
+
Noko_Node_Get_Struct(self, xmlEntity, node);
|
50
50
|
|
51
51
|
return INT2NUM((int)node->etype);
|
52
52
|
}
|
@@ -61,7 +61,7 @@ static VALUE
|
|
61
61
|
external_id(VALUE self)
|
62
62
|
{
|
63
63
|
xmlEntityPtr node;
|
64
|
-
|
64
|
+
Noko_Node_Get_Struct(self, xmlEntity, node);
|
65
65
|
|
66
66
|
if (!node->ExternalID) { return Qnil; }
|
67
67
|
|
@@ -78,7 +78,7 @@ static VALUE
|
|
78
78
|
system_id(VALUE self)
|
79
79
|
{
|
80
80
|
xmlEntityPtr node;
|
81
|
-
|
81
|
+
Noko_Node_Get_Struct(self, xmlEntity, node);
|
82
82
|
|
83
83
|
if (!node->SystemID) { return Qnil; }
|
84
84
|
|
@@ -86,7 +86,7 @@ system_id(VALUE self)
|
|
86
86
|
}
|
87
87
|
|
88
88
|
void
|
89
|
-
noko_init_xml_entity_decl()
|
89
|
+
noko_init_xml_entity_decl(void)
|
90
90
|
{
|
91
91
|
assert(cNokogiriXmlNode);
|
92
92
|
cNokogiriXmlEntityDecl = rb_define_class_under(mNokogiriXml, "EntityDecl", cNokogiriXmlNode);
|
@@ -25,13 +25,14 @@
|
|
25
25
|
VALUE cNokogiriXmlNamespace ;
|
26
26
|
|
27
27
|
static void
|
28
|
-
|
28
|
+
_xml_namespace_dealloc(void *ptr)
|
29
29
|
{
|
30
30
|
/*
|
31
31
|
* this deallocator is only used for namespace nodes that are part of an xpath
|
32
32
|
* node set. see noko_xml_namespace_wrap().
|
33
33
|
*/
|
34
|
-
|
34
|
+
xmlNsPtr ns = ptr;
|
35
|
+
|
35
36
|
if (ns->href) {
|
36
37
|
xmlFree(DISCARD_CONST_QUAL_XMLCHAR(ns->href));
|
37
38
|
}
|
@@ -39,39 +40,100 @@ dealloc_namespace(xmlNsPtr ns)
|
|
39
40
|
xmlFree(DISCARD_CONST_QUAL_XMLCHAR(ns->prefix));
|
40
41
|
}
|
41
42
|
xmlFree(ns);
|
42
|
-
NOKOGIRI_DEBUG_END(ns) ;
|
43
43
|
}
|
44
44
|
|
45
|
+
#ifdef HAVE_RB_GC_LOCATION
|
46
|
+
static void
|
47
|
+
_xml_namespace_update_references(void *ptr)
|
48
|
+
{
|
49
|
+
xmlNsPtr ns = ptr;
|
50
|
+
if (ns->_private) {
|
51
|
+
ns->_private = (void *)rb_gc_location((VALUE)ns->_private);
|
52
|
+
}
|
53
|
+
}
|
54
|
+
#else
|
55
|
+
# define _xml_namespace_update_references 0
|
56
|
+
#endif
|
57
|
+
|
58
|
+
static const rb_data_type_t nokogiri_xml_namespace_type_with_dealloc = {
|
59
|
+
"Nokogiri/XMLNamespace/WithDealloc",
|
60
|
+
{0, _xml_namespace_dealloc, 0, _xml_namespace_update_references},
|
61
|
+
0, 0,
|
62
|
+
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
63
|
+
RUBY_TYPED_FREE_IMMEDIATELY,
|
64
|
+
#endif
|
65
|
+
};
|
66
|
+
|
67
|
+
static const rb_data_type_t nokogiri_xml_namespace_type_without_dealloc = {
|
68
|
+
"Nokogiri/XMLNamespace/WithoutDealloc",
|
69
|
+
{0, 0, 0, _xml_namespace_update_references},
|
70
|
+
0, 0,
|
71
|
+
#ifdef RUBY_TYPED_FREE_IMMEDIATELY
|
72
|
+
RUBY_TYPED_FREE_IMMEDIATELY,
|
73
|
+
#endif
|
74
|
+
};
|
45
75
|
|
46
76
|
/*
|
47
|
-
*
|
48
|
-
*
|
77
|
+
* :call-seq:
|
78
|
+
* prefix() → String or nil
|
79
|
+
*
|
80
|
+
* Return the prefix for this Namespace, or +nil+ if there is no prefix (e.g., default namespace).
|
81
|
+
*
|
82
|
+
* *Example*
|
49
83
|
*
|
50
|
-
*
|
84
|
+
* doc = Nokogiri::XML.parse(<<~XML)
|
85
|
+
* <?xml version="1.0"?>
|
86
|
+
* <root xmlns="http://nokogiri.org/ns/default" xmlns:noko="http://nokogiri.org/ns/noko">
|
87
|
+
* <child1 foo="abc" noko:bar="def"/>
|
88
|
+
* <noko:child2 foo="qwe" noko:bar="rty"/>
|
89
|
+
* </root>
|
90
|
+
* XML
|
91
|
+
*
|
92
|
+
* doc.root.elements.first.namespace.prefix
|
93
|
+
* # => nil
|
94
|
+
*
|
95
|
+
* doc.root.elements.last.namespace.prefix
|
96
|
+
* # => "noko"
|
51
97
|
*/
|
52
98
|
static VALUE
|
53
99
|
prefix(VALUE self)
|
54
100
|
{
|
55
101
|
xmlNsPtr ns;
|
56
102
|
|
57
|
-
|
103
|
+
Noko_Namespace_Get_Struct(self, xmlNs, ns);
|
58
104
|
if (!ns->prefix) { return Qnil; }
|
59
105
|
|
60
106
|
return NOKOGIRI_STR_NEW2(ns->prefix);
|
61
107
|
}
|
62
108
|
|
63
109
|
/*
|
64
|
-
*
|
65
|
-
*
|
110
|
+
* :call-seq:
|
111
|
+
* href() → String
|
112
|
+
*
|
113
|
+
* Returns the URI reference for this Namespace.
|
114
|
+
*
|
115
|
+
* *Example*
|
116
|
+
*
|
117
|
+
* doc = Nokogiri::XML.parse(<<~XML)
|
118
|
+
* <?xml version="1.0"?>
|
119
|
+
* <root xmlns="http://nokogiri.org/ns/default" xmlns:noko="http://nokogiri.org/ns/noko">
|
120
|
+
* <child1 foo="abc" noko:bar="def"/>
|
121
|
+
* <noko:child2 foo="qwe" noko:bar="rty"/>
|
122
|
+
* </root>
|
123
|
+
* XML
|
124
|
+
*
|
125
|
+
* doc.root.elements.first.namespace.href
|
126
|
+
* # => "http://nokogiri.org/ns/default"
|
66
127
|
*
|
67
|
-
*
|
128
|
+
* doc.root.elements.last.namespace.href
|
129
|
+
* # => "http://nokogiri.org/ns/noko"
|
68
130
|
*/
|
69
131
|
static VALUE
|
70
132
|
href(VALUE self)
|
71
133
|
{
|
72
134
|
xmlNsPtr ns;
|
73
135
|
|
74
|
-
|
136
|
+
Noko_Namespace_Get_Struct(self, xmlNs, ns);
|
75
137
|
if (!ns->href) { return Qnil; }
|
76
138
|
|
77
139
|
return NOKOGIRI_STR_NEW2(ns->href);
|
@@ -87,14 +149,18 @@ noko_xml_namespace_wrap(xmlNsPtr c_namespace, xmlDocPtr c_document)
|
|
87
149
|
}
|
88
150
|
|
89
151
|
if (c_document) {
|
90
|
-
rb_namespace =
|
152
|
+
rb_namespace = TypedData_Wrap_Struct(cNokogiriXmlNamespace,
|
153
|
+
&nokogiri_xml_namespace_type_without_dealloc,
|
154
|
+
c_namespace);
|
91
155
|
|
92
156
|
if (DOC_RUBY_OBJECT_TEST(c_document)) {
|
93
157
|
rb_iv_set(rb_namespace, "@document", DOC_RUBY_OBJECT(c_document));
|
94
158
|
rb_ary_push(DOC_NODE_CACHE(c_document), rb_namespace);
|
95
159
|
}
|
96
160
|
} else {
|
97
|
-
rb_namespace =
|
161
|
+
rb_namespace = TypedData_Wrap_Struct(cNokogiriXmlNamespace,
|
162
|
+
&nokogiri_xml_namespace_type_with_dealloc,
|
163
|
+
c_namespace);
|
98
164
|
}
|
99
165
|
|
100
166
|
c_namespace->_private = (void *)rb_namespace;
|
@@ -109,7 +175,7 @@ noko_xml_namespace_wrap_xpath_copy(xmlNsPtr c_namespace)
|
|
109
175
|
}
|
110
176
|
|
111
177
|
void
|
112
|
-
noko_init_xml_namespace()
|
178
|
+
noko_init_xml_namespace(void)
|
113
179
|
{
|
114
180
|
cNokogiriXmlNamespace = rb_define_class_under(mNokogiriXml, "Namespace", rb_cObject);
|
115
181
|
|