nokogiri 1.10.3 → 1.11.4
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 +3 -0
- data/LICENSE-DEPENDENCIES.md +1015 -947
- data/LICENSE.md +1 -1
- data/README.md +173 -94
- data/dependencies.yml +28 -26
- data/ext/nokogiri/depend +37 -358
- data/ext/nokogiri/extconf.rb +611 -391
- data/ext/nokogiri/html_document.c +78 -82
- data/ext/nokogiri/html_element_description.c +84 -71
- data/ext/nokogiri/html_entity_lookup.c +21 -16
- data/ext/nokogiri/html_sax_parser_context.c +69 -66
- data/ext/nokogiri/html_sax_push_parser.c +42 -34
- data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
- data/ext/nokogiri/nokogiri.c +192 -87
- data/ext/nokogiri/nokogiri.h +181 -89
- data/ext/nokogiri/test_global_handlers.c +40 -0
- data/ext/nokogiri/xml_attr.c +15 -15
- data/ext/nokogiri/xml_attribute_decl.c +18 -18
- data/ext/nokogiri/xml_cdata.c +13 -18
- data/ext/nokogiri/xml_comment.c +19 -26
- data/ext/nokogiri/xml_document.c +255 -183
- data/ext/nokogiri/xml_document_fragment.c +13 -15
- data/ext/nokogiri/xml_dtd.c +54 -48
- data/ext/nokogiri/xml_element_content.c +30 -27
- data/ext/nokogiri/xml_element_decl.c +22 -22
- data/ext/nokogiri/xml_encoding_handler.c +17 -11
- data/ext/nokogiri/xml_entity_decl.c +32 -30
- data/ext/nokogiri/xml_entity_reference.c +16 -18
- data/ext/nokogiri/xml_namespace.c +56 -49
- data/ext/nokogiri/xml_node.c +387 -316
- data/ext/nokogiri/xml_node_set.c +168 -156
- data/ext/nokogiri/xml_processing_instruction.c +17 -19
- data/ext/nokogiri/xml_reader.c +195 -172
- data/ext/nokogiri/xml_relax_ng.c +52 -28
- data/ext/nokogiri/xml_sax_parser.c +118 -118
- data/ext/nokogiri/xml_sax_parser_context.c +103 -86
- data/ext/nokogiri/xml_sax_push_parser.c +36 -27
- data/ext/nokogiri/xml_schema.c +111 -34
- data/ext/nokogiri/xml_syntax_error.c +42 -21
- data/ext/nokogiri/xml_text.c +13 -17
- data/ext/nokogiri/xml_xpath_context.c +206 -123
- data/ext/nokogiri/xslt_stylesheet.c +158 -165
- data/lib/nokogiri/css/node.rb +1 -0
- data/lib/nokogiri/css/parser.rb +63 -62
- data/lib/nokogiri/css/parser.y +2 -2
- data/lib/nokogiri/css/parser_extras.rb +39 -36
- data/lib/nokogiri/css/syntax_error.rb +1 -0
- data/lib/nokogiri/css/tokenizer.rb +105 -103
- data/lib/nokogiri/css/xpath_visitor.rb +73 -43
- data/lib/nokogiri/css.rb +1 -0
- data/lib/nokogiri/decorators/slop.rb +1 -0
- data/lib/nokogiri/extension.rb +26 -0
- data/lib/nokogiri/html/builder.rb +1 -0
- data/lib/nokogiri/html/document.rb +13 -26
- data/lib/nokogiri/html/document_fragment.rb +16 -15
- data/lib/nokogiri/html/element_description.rb +1 -0
- data/lib/nokogiri/html/element_description_defaults.rb +1 -0
- data/lib/nokogiri/html/entity_lookup.rb +1 -0
- data/lib/nokogiri/html/sax/parser.rb +1 -0
- data/lib/nokogiri/html/sax/parser_context.rb +1 -0
- data/lib/nokogiri/html/sax/push_parser.rb +1 -0
- data/lib/nokogiri/html.rb +1 -0
- data/lib/nokogiri/jruby/dependencies.rb +20 -0
- data/lib/nokogiri/syntax_error.rb +1 -0
- data/lib/nokogiri/version/constant.rb +5 -0
- data/lib/nokogiri/version/info.rb +205 -0
- data/lib/nokogiri/version.rb +3 -109
- data/lib/nokogiri/xml/attr.rb +1 -0
- data/lib/nokogiri/xml/attribute_decl.rb +1 -0
- data/lib/nokogiri/xml/builder.rb +36 -32
- data/lib/nokogiri/xml/cdata.rb +1 -0
- data/lib/nokogiri/xml/character_data.rb +1 -0
- data/lib/nokogiri/xml/document.rb +92 -41
- data/lib/nokogiri/xml/document_fragment.rb +5 -6
- data/lib/nokogiri/xml/dtd.rb +1 -0
- data/lib/nokogiri/xml/element_content.rb +1 -0
- data/lib/nokogiri/xml/element_decl.rb +1 -0
- data/lib/nokogiri/xml/entity_decl.rb +1 -0
- data/lib/nokogiri/xml/entity_reference.rb +1 -0
- data/lib/nokogiri/xml/namespace.rb +1 -0
- data/lib/nokogiri/xml/node/save_options.rb +1 -0
- data/lib/nokogiri/xml/node.rb +625 -290
- data/lib/nokogiri/xml/node_set.rb +1 -0
- data/lib/nokogiri/xml/notation.rb +1 -0
- data/lib/nokogiri/xml/parse_options.rb +10 -3
- data/lib/nokogiri/xml/pp/character_data.rb +1 -0
- data/lib/nokogiri/xml/pp/node.rb +1 -0
- data/lib/nokogiri/xml/pp.rb +1 -0
- data/lib/nokogiri/xml/processing_instruction.rb +1 -0
- data/lib/nokogiri/xml/reader.rb +9 -12
- data/lib/nokogiri/xml/relax_ng.rb +7 -2
- data/lib/nokogiri/xml/sax/document.rb +1 -0
- data/lib/nokogiri/xml/sax/parser.rb +1 -0
- data/lib/nokogiri/xml/sax/parser_context.rb +1 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +1 -0
- data/lib/nokogiri/xml/sax.rb +1 -0
- data/lib/nokogiri/xml/schema.rb +13 -4
- data/lib/nokogiri/xml/searchable.rb +25 -16
- data/lib/nokogiri/xml/syntax_error.rb +1 -0
- data/lib/nokogiri/xml/text.rb +1 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +2 -1
- data/lib/nokogiri/xml/xpath.rb +2 -3
- data/lib/nokogiri/xml/xpath_context.rb +1 -0
- data/lib/nokogiri/xml.rb +1 -0
- data/lib/nokogiri/xslt/stylesheet.rb +1 -0
- data/lib/nokogiri/xslt.rb +1 -0
- data/lib/nokogiri.rb +6 -27
- data/lib/xsd/xmlparser/nokogiri.rb +1 -0
- data/patches/libxml2/{0002-Remove-script-macro-support.patch → 0001-Remove-script-macro-support.patch} +0 -0
- data/patches/libxml2/{0003-Update-entities-to-remove-handling-of-ssi.patch → 0002-Update-entities-to-remove-handling-of-ssi.patch} +0 -0
- data/patches/libxml2/0003-libxml2.la-is-in-top_builddir.patch +25 -0
- data/patches/libxml2/0004-use-glibc-strlen.patch +53 -0
- data/patches/libxml2/0005-avoid-isnan-isinf.patch +81 -0
- data/patches/libxml2/0006-update-automake-files-for-arm64.patch +2511 -0
- data/patches/libxslt/0001-update-automake-files-for-arm64.patch +2511 -0
- data/patches/libxslt/0002-Fix-xml2-config-check-in-configure-script.patch +19 -0
- data/ports/archives/libxml2-2.9.12.tar.gz +0 -0
- data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
- metadata +102 -147
- data/ext/nokogiri/html_document.h +0 -10
- data/ext/nokogiri/html_element_description.h +0 -10
- data/ext/nokogiri/html_entity_lookup.h +0 -8
- data/ext/nokogiri/html_sax_parser_context.h +0 -11
- data/ext/nokogiri/html_sax_push_parser.h +0 -9
- data/ext/nokogiri/xml_attr.h +0 -9
- data/ext/nokogiri/xml_attribute_decl.h +0 -9
- data/ext/nokogiri/xml_cdata.h +0 -9
- data/ext/nokogiri/xml_comment.h +0 -9
- data/ext/nokogiri/xml_document.h +0 -23
- data/ext/nokogiri/xml_document_fragment.h +0 -10
- data/ext/nokogiri/xml_dtd.h +0 -10
- data/ext/nokogiri/xml_element_content.h +0 -10
- data/ext/nokogiri/xml_element_decl.h +0 -9
- data/ext/nokogiri/xml_encoding_handler.h +0 -8
- data/ext/nokogiri/xml_entity_decl.h +0 -10
- data/ext/nokogiri/xml_entity_reference.h +0 -9
- data/ext/nokogiri/xml_io.c +0 -61
- data/ext/nokogiri/xml_io.h +0 -11
- data/ext/nokogiri/xml_libxml2_hacks.c +0 -112
- data/ext/nokogiri/xml_libxml2_hacks.h +0 -12
- data/ext/nokogiri/xml_namespace.h +0 -14
- data/ext/nokogiri/xml_node.h +0 -13
- data/ext/nokogiri/xml_node_set.h +0 -12
- data/ext/nokogiri/xml_processing_instruction.h +0 -9
- data/ext/nokogiri/xml_reader.h +0 -10
- data/ext/nokogiri/xml_relax_ng.h +0 -9
- data/ext/nokogiri/xml_sax_parser.h +0 -39
- data/ext/nokogiri/xml_sax_parser_context.h +0 -10
- data/ext/nokogiri/xml_sax_push_parser.h +0 -9
- data/ext/nokogiri/xml_schema.h +0 -9
- data/ext/nokogiri/xml_syntax_error.h +0 -13
- data/ext/nokogiri/xml_text.h +0 -9
- data/ext/nokogiri/xml_xpath_context.h +0 -10
- data/ext/nokogiri/xslt_stylesheet.h +0 -14
- data/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch +0 -78
- data/patches/libxslt/0001-Fix-security-framework-bypass.patch +0 -120
- data/ports/archives/libxml2-2.9.9.tar.gz +0 -0
- data/ports/archives/libxslt-1.1.33.tar.gz +0 -0
data/ext/nokogiri/xml_attr.c
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
#include <
|
1
|
+
#include <nokogiri.h>
|
2
|
+
|
3
|
+
VALUE cNokogiriXmlAttr;
|
2
4
|
|
3
5
|
/*
|
4
6
|
* call-seq:
|
@@ -7,7 +9,8 @@
|
|
7
9
|
* Set the value for this Attr to +content+. Use `nil` to remove the value
|
8
10
|
* (e.g., a HTML boolean attribute).
|
9
11
|
*/
|
10
|
-
static VALUE
|
12
|
+
static VALUE
|
13
|
+
set_value(VALUE self, VALUE content)
|
11
14
|
{
|
12
15
|
xmlAttrPtr attr;
|
13
16
|
xmlChar *value;
|
@@ -49,7 +52,8 @@ static VALUE set_value(VALUE self, VALUE content)
|
|
49
52
|
*
|
50
53
|
* Create a new Attr element on the +document+ with +name+
|
51
54
|
*/
|
52
|
-
static VALUE
|
55
|
+
static VALUE
|
56
|
+
new (int argc, VALUE *argv, VALUE klass)
|
53
57
|
{
|
54
58
|
xmlDocPtr xml_doc;
|
55
59
|
VALUE document;
|
@@ -72,9 +76,9 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
|
|
72
76
|
NULL
|
73
77
|
);
|
74
78
|
|
75
|
-
|
79
|
+
noko_xml_document_pin_node((xmlNodePtr)node);
|
76
80
|
|
77
|
-
rb_node =
|
81
|
+
rb_node = noko_xml_node_wrap(klass, (xmlNodePtr)node);
|
78
82
|
rb_obj_call_init(rb_node, argc, argv);
|
79
83
|
|
80
84
|
if (rb_block_given_p()) {
|
@@ -84,20 +88,16 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
|
|
84
88
|
return rb_node;
|
85
89
|
}
|
86
90
|
|
87
|
-
|
88
|
-
|
91
|
+
void
|
92
|
+
noko_init_xml_attr()
|
89
93
|
{
|
90
|
-
|
91
|
-
VALUE xml = rb_define_module_under(nokogiri, "XML");
|
92
|
-
VALUE node = rb_define_class_under(xml, "Node", rb_cObject);
|
93
|
-
|
94
|
+
assert(cNokogiriXmlNode);
|
94
95
|
/*
|
95
96
|
* Attr represents a Attr node in an xml document.
|
96
97
|
*/
|
97
|
-
|
98
|
+
cNokogiriXmlAttr = rb_define_class_under(mNokogiriXml, "Attr", cNokogiriXmlNode);
|
98
99
|
|
99
|
-
cNokogiriXmlAttr
|
100
|
+
rb_define_singleton_method(cNokogiriXmlAttr, "new", new, -1);
|
100
101
|
|
101
|
-
|
102
|
-
rb_define_method(klass, "value=", set_value, 1);
|
102
|
+
rb_define_method(cNokogiriXmlAttr, "value=", set_value, 1);
|
103
103
|
}
|
@@ -1,4 +1,6 @@
|
|
1
|
-
#include <
|
1
|
+
#include <nokogiri.h>
|
2
|
+
|
3
|
+
VALUE cNokogiriXmlAttributeDecl;
|
2
4
|
|
3
5
|
/*
|
4
6
|
* call-seq:
|
@@ -6,7 +8,8 @@
|
|
6
8
|
*
|
7
9
|
* The attribute_type for this AttributeDecl
|
8
10
|
*/
|
9
|
-
static VALUE
|
11
|
+
static VALUE
|
12
|
+
attribute_type(VALUE self)
|
10
13
|
{
|
11
14
|
xmlAttributePtr node;
|
12
15
|
Data_Get_Struct(self, xmlAttribute, node);
|
@@ -19,12 +22,13 @@ static VALUE attribute_type(VALUE self)
|
|
19
22
|
*
|
20
23
|
* The default value
|
21
24
|
*/
|
22
|
-
static VALUE
|
25
|
+
static VALUE
|
26
|
+
default_value(VALUE self)
|
23
27
|
{
|
24
28
|
xmlAttributePtr node;
|
25
29
|
Data_Get_Struct(self, xmlAttribute, node);
|
26
30
|
|
27
|
-
if(node->defaultValue) return NOKOGIRI_STR_NEW2(node->defaultValue);
|
31
|
+
if (node->defaultValue) { return NOKOGIRI_STR_NEW2(node->defaultValue); }
|
28
32
|
return Qnil;
|
29
33
|
}
|
30
34
|
|
@@ -34,7 +38,8 @@ static VALUE default_value(VALUE self)
|
|
34
38
|
*
|
35
39
|
* An enumeration of possible values
|
36
40
|
*/
|
37
|
-
static VALUE
|
41
|
+
static VALUE
|
42
|
+
enumeration(VALUE self)
|
38
43
|
{
|
39
44
|
xmlAttributePtr node;
|
40
45
|
xmlEnumerationPtr enm;
|
@@ -45,7 +50,7 @@ static VALUE enumeration(VALUE self)
|
|
45
50
|
list = rb_ary_new();
|
46
51
|
enm = node->tree;
|
47
52
|
|
48
|
-
while(enm) {
|
53
|
+
while (enm) {
|
49
54
|
rb_ary_push(list, NOKOGIRI_STR_NEW2(enm->name));
|
50
55
|
enm = enm->next;
|
51
56
|
}
|
@@ -53,18 +58,13 @@ static VALUE enumeration(VALUE self)
|
|
53
58
|
return list;
|
54
59
|
}
|
55
60
|
|
56
|
-
|
57
|
-
|
58
|
-
void init_xml_attribute_decl()
|
61
|
+
void
|
62
|
+
noko_init_xml_attribute_decl()
|
59
63
|
{
|
60
|
-
|
61
|
-
|
62
|
-
VALUE node = rb_define_class_under(xml, "Node", rb_cObject);
|
63
|
-
VALUE klass = rb_define_class_under(xml, "AttributeDecl", node);
|
64
|
-
|
65
|
-
cNokogiriXmlAttributeDecl = klass;
|
64
|
+
assert(cNokogiriXmlNode);
|
65
|
+
cNokogiriXmlAttributeDecl = rb_define_class_under(mNokogiriXml, "AttributeDecl", cNokogiriXmlNode);
|
66
66
|
|
67
|
-
rb_define_method(
|
68
|
-
rb_define_method(
|
69
|
-
rb_define_method(
|
67
|
+
rb_define_method(cNokogiriXmlAttributeDecl, "attribute_type", attribute_type, 0);
|
68
|
+
rb_define_method(cNokogiriXmlAttributeDecl, "default", default_value, 0);
|
69
|
+
rb_define_method(cNokogiriXmlAttributeDecl, "enumeration", enumeration, 0);
|
70
70
|
}
|
data/ext/nokogiri/xml_cdata.c
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
#include <
|
1
|
+
#include <nokogiri.h>
|
2
|
+
|
3
|
+
VALUE cNokogiriXmlCData;
|
2
4
|
|
3
5
|
/*
|
4
6
|
* call-seq:
|
@@ -9,7 +11,8 @@
|
|
9
11
|
* If +content+ cannot be implicitly converted to a string, this method will
|
10
12
|
* raise a TypeError exception.
|
11
13
|
*/
|
12
|
-
static VALUE
|
14
|
+
static VALUE
|
15
|
+
new (int argc, VALUE *argv, VALUE klass)
|
13
16
|
{
|
14
17
|
xmlDocPtr xml_doc;
|
15
18
|
xmlNodePtr node;
|
@@ -31,32 +34,24 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
|
|
31
34
|
|
32
35
|
node = xmlNewCDataBlock(xml_doc->doc, content_str, content_str_len);
|
33
36
|
|
34
|
-
|
37
|
+
noko_xml_document_pin_node(node);
|
35
38
|
|
36
|
-
rb_node =
|
39
|
+
rb_node = noko_xml_node_wrap(klass, node);
|
37
40
|
rb_obj_call_init(rb_node, argc, argv);
|
38
41
|
|
39
|
-
if(rb_block_given_p()) { rb_yield(rb_node); }
|
42
|
+
if (rb_block_given_p()) { rb_yield(rb_node); }
|
40
43
|
|
41
44
|
return rb_node;
|
42
45
|
}
|
43
46
|
|
44
|
-
|
45
|
-
|
47
|
+
void
|
48
|
+
noko_init_xml_cdata()
|
46
49
|
{
|
47
|
-
|
48
|
-
VALUE xml = rb_define_module_under(nokogiri, "XML");
|
49
|
-
VALUE node = rb_define_class_under(xml, "Node", rb_cObject);
|
50
|
-
VALUE char_data = rb_define_class_under(xml, "CharacterData", node);
|
51
|
-
VALUE text = rb_define_class_under(xml, "Text", char_data);
|
52
|
-
|
50
|
+
assert(cNokogiriXmlText);
|
53
51
|
/*
|
54
52
|
* CData represents a CData node in an xml document.
|
55
53
|
*/
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
cNokogiriXmlCData = klass;
|
54
|
+
cNokogiriXmlCData = rb_define_class_under(mNokogiriXml, "CDATA", cNokogiriXmlText);
|
60
55
|
|
61
|
-
rb_define_singleton_method(
|
56
|
+
rb_define_singleton_method(cNokogiriXmlCData, "new", new, -1);
|
62
57
|
}
|
data/ext/nokogiri/xml_comment.c
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
#include <
|
1
|
+
#include <nokogiri.h>
|
2
|
+
|
3
|
+
VALUE cNokogiriXmlComment;
|
2
4
|
|
3
5
|
static ID document_id ;
|
4
6
|
|
@@ -9,7 +11,8 @@ static ID document_id ;
|
|
9
11
|
* Create a new Comment element on the +document+ with +content+.
|
10
12
|
* Alternatively, if a +node+ is passed, the +node+'s document is used.
|
11
13
|
*/
|
12
|
-
static VALUE
|
14
|
+
static VALUE
|
15
|
+
new (int argc, VALUE *argv, VALUE klass)
|
13
16
|
{
|
14
17
|
xmlDocPtr xml_doc;
|
15
18
|
xmlNodePtr node;
|
@@ -20,50 +23,40 @@ static VALUE new(int argc, VALUE *argv, VALUE klass)
|
|
20
23
|
|
21
24
|
rb_scan_args(argc, argv, "2*", &document, &content, &rest);
|
22
25
|
|
23
|
-
if (rb_obj_is_kind_of(document, cNokogiriXmlNode))
|
24
|
-
{
|
26
|
+
if (rb_obj_is_kind_of(document, cNokogiriXmlNode)) {
|
25
27
|
document = rb_funcall(document, document_id, 0);
|
26
|
-
}
|
27
|
-
|
28
|
-
&& !rb_obj_is_kind_of(document, cNokogiriXmlDocumentFragment))
|
29
|
-
{
|
28
|
+
} else if (!rb_obj_is_kind_of(document, cNokogiriXmlDocument)
|
29
|
+
&& !rb_obj_is_kind_of(document, cNokogiriXmlDocumentFragment)) {
|
30
30
|
rb_raise(rb_eArgError, "first argument must be a XML::Document or XML::Node");
|
31
31
|
}
|
32
32
|
|
33
33
|
Data_Get_Struct(document, xmlDoc, xml_doc);
|
34
34
|
|
35
35
|
node = xmlNewDocComment(
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
xml_doc,
|
37
|
+
(const xmlChar *)StringValueCStr(content)
|
38
|
+
);
|
39
39
|
|
40
|
-
rb_node =
|
40
|
+
rb_node = noko_xml_node_wrap(klass, node);
|
41
41
|
rb_obj_call_init(rb_node, argc, argv);
|
42
42
|
|
43
|
-
|
43
|
+
noko_xml_document_pin_node(node);
|
44
44
|
|
45
|
-
if(rb_block_given_p()) rb_yield(rb_node);
|
45
|
+
if (rb_block_given_p()) { rb_yield(rb_node); }
|
46
46
|
|
47
47
|
return rb_node;
|
48
48
|
}
|
49
49
|
|
50
|
-
|
51
|
-
|
50
|
+
void
|
51
|
+
noko_init_xml_comment()
|
52
52
|
{
|
53
|
-
|
54
|
-
VALUE xml = rb_define_module_under(nokogiri, "XML");
|
55
|
-
VALUE node = rb_define_class_under(xml, "Node", rb_cObject);
|
56
|
-
VALUE char_data = rb_define_class_under(xml, "CharacterData", node);
|
57
|
-
|
53
|
+
assert(cNokogiriXmlCharacterData);
|
58
54
|
/*
|
59
55
|
* Comment represents a comment node in an xml document.
|
60
56
|
*/
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
cNokogiriXmlComment = klass;
|
57
|
+
cNokogiriXmlComment = rb_define_class_under(mNokogiriXml, "Comment", cNokogiriXmlCharacterData);
|
65
58
|
|
66
|
-
rb_define_singleton_method(
|
59
|
+
rb_define_singleton_method(cNokogiriXmlComment, "new", new, -1);
|
67
60
|
|
68
61
|
document_id = rb_intern("document");
|
69
62
|
}
|