nokogiri 1.14.4-x86_64-darwin → 1.15.1-x86_64-darwin

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.

Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +9 -8
  3. data/dependencies.yml +6 -6
  4. data/ext/nokogiri/extconf.rb +66 -22
  5. data/ext/nokogiri/html4_document.c +1 -2
  6. data/ext/nokogiri/html4_element_description.c +19 -14
  7. data/ext/nokogiri/html4_sax_parser_context.c +10 -16
  8. data/ext/nokogiri/html4_sax_push_parser.c +2 -2
  9. data/ext/nokogiri/include/libexslt/exsltconfig.h +3 -3
  10. data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +52 -38
  11. data/ext/nokogiri/include/libxml2/libxml/HTMLtree.h +18 -18
  12. data/ext/nokogiri/include/libxml2/libxml/SAX.h +36 -36
  13. data/ext/nokogiri/include/libxml2/libxml/SAX2.h +37 -36
  14. data/ext/nokogiri/include/libxml2/libxml/c14n.h +4 -4
  15. data/ext/nokogiri/include/libxml2/libxml/catalog.h +36 -36
  16. data/ext/nokogiri/include/libxml2/libxml/chvalid.h +9 -9
  17. data/ext/nokogiri/include/libxml2/libxml/debugXML.h +28 -28
  18. data/ext/nokogiri/include/libxml2/libxml/dict.h +13 -13
  19. data/ext/nokogiri/include/libxml2/libxml/encoding.h +20 -19
  20. data/ext/nokogiri/include/libxml2/libxml/entities.h +19 -21
  21. data/ext/nokogiri/include/libxml2/libxml/globals.h +89 -59
  22. data/ext/nokogiri/include/libxml2/libxml/hash.h +25 -25
  23. data/ext/nokogiri/include/libxml2/libxml/list.h +26 -26
  24. data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +22 -22
  25. data/ext/nokogiri/include/libxml2/libxml/nanohttp.h +17 -17
  26. data/ext/nokogiri/include/libxml2/libxml/parser.h +100 -79
  27. data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +149 -143
  28. data/ext/nokogiri/include/libxml2/libxml/pattern.h +15 -15
  29. data/ext/nokogiri/include/libxml2/libxml/relaxng.h +26 -26
  30. data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +2 -2
  31. data/ext/nokogiri/include/libxml2/libxml/schematron.h +18 -18
  32. data/ext/nokogiri/include/libxml2/libxml/threads.h +23 -20
  33. data/ext/nokogiri/include/libxml2/libxml/tree.h +166 -164
  34. data/ext/nokogiri/include/libxml2/libxml/uri.h +15 -15
  35. data/ext/nokogiri/include/libxml2/libxml/valid.h +72 -87
  36. data/ext/nokogiri/include/libxml2/libxml/xinclude.h +10 -10
  37. data/ext/nokogiri/include/libxml2/libxml/xlink.h +5 -5
  38. data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +60 -59
  39. data/ext/nokogiri/include/libxml2/libxml/xmlautomata.h +21 -21
  40. data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +18 -46
  41. data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +14 -41
  42. data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +26 -24
  43. data/ext/nokogiri/include/libxml2/libxml/xmlmodule.h +4 -4
  44. data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +87 -87
  45. data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +30 -30
  46. data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +10 -10
  47. data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +30 -30
  48. data/ext/nokogiri/include/libxml2/libxml/xmlschemastypes.h +34 -34
  49. data/ext/nokogiri/include/libxml2/libxml/xmlstring.h +30 -30
  50. data/ext/nokogiri/include/libxml2/libxml/xmlunicode.h +166 -166
  51. data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +50 -27
  52. data/ext/nokogiri/include/libxml2/libxml/xmlwriter.h +80 -80
  53. data/ext/nokogiri/include/libxml2/libxml/xpath.h +41 -41
  54. data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +117 -117
  55. data/ext/nokogiri/include/libxml2/libxml/xpointer.h +21 -21
  56. data/ext/nokogiri/include/libxslt/attributes.h +1 -0
  57. data/ext/nokogiri/include/libxslt/variables.h +3 -3
  58. data/ext/nokogiri/include/libxslt/xsltInternals.h +14 -4
  59. data/ext/nokogiri/include/libxslt/xsltconfig.h +4 -4
  60. data/ext/nokogiri/include/libxslt/xsltlocale.h +14 -54
  61. data/ext/nokogiri/include/libxslt/xsltutils.h +35 -2
  62. data/ext/nokogiri/nokogiri.c +46 -24
  63. data/ext/nokogiri/nokogiri.h +13 -2
  64. data/ext/nokogiri/xml_attr.c +1 -1
  65. data/ext/nokogiri/xml_cdata.c +10 -2
  66. data/ext/nokogiri/xml_comment.c +1 -1
  67. data/ext/nokogiri/xml_document.c +102 -22
  68. data/ext/nokogiri/xml_document_fragment.c +1 -1
  69. data/ext/nokogiri/xml_dtd.c +1 -1
  70. data/ext/nokogiri/xml_element_content.c +32 -29
  71. data/ext/nokogiri/xml_element_decl.c +5 -5
  72. data/ext/nokogiri/xml_encoding_handler.c +12 -4
  73. data/ext/nokogiri/xml_entity_reference.c +1 -1
  74. data/ext/nokogiri/xml_namespace.c +11 -12
  75. data/ext/nokogiri/xml_node.c +7 -7
  76. data/ext/nokogiri/xml_node_set.c +125 -105
  77. data/ext/nokogiri/xml_processing_instruction.c +1 -1
  78. data/ext/nokogiri/xml_reader.c +37 -28
  79. data/ext/nokogiri/xml_relax_ng.c +65 -78
  80. data/ext/nokogiri/xml_sax_parser.c +24 -5
  81. data/ext/nokogiri/xml_sax_parser_context.c +46 -25
  82. data/ext/nokogiri/xml_sax_push_parser.c +29 -8
  83. data/ext/nokogiri/xml_schema.c +90 -116
  84. data/ext/nokogiri/xml_text.c +10 -2
  85. data/ext/nokogiri/xml_xpath_context.c +156 -83
  86. data/ext/nokogiri/xslt_stylesheet.c +103 -50
  87. data/lib/nokogiri/2.7/nokogiri.bundle +0 -0
  88. data/lib/nokogiri/3.0/nokogiri.bundle +0 -0
  89. data/lib/nokogiri/3.1/nokogiri.bundle +0 -0
  90. data/lib/nokogiri/3.2/nokogiri.bundle +0 -0
  91. data/lib/nokogiri/css/xpath_visitor.rb +2 -2
  92. data/lib/nokogiri/extension.rb +1 -1
  93. data/lib/nokogiri/html4/document_fragment.rb +1 -1
  94. data/lib/nokogiri/html4/element_description_defaults.rb +1821 -353
  95. data/lib/nokogiri/html5/document_fragment.rb +1 -1
  96. data/lib/nokogiri/html5/node.rb +5 -0
  97. data/lib/nokogiri/html5.rb +5 -2
  98. data/lib/nokogiri/version/constant.rb +1 -1
  99. data/lib/nokogiri/xml/attribute_decl.rb +4 -2
  100. data/lib/nokogiri/xml/document_fragment.rb +1 -1
  101. data/lib/nokogiri/xml/element_content.rb +10 -2
  102. data/lib/nokogiri/xml/element_decl.rb +4 -2
  103. data/lib/nokogiri/xml/entity_decl.rb +4 -2
  104. data/lib/nokogiri/xml/node/save_options.rb +8 -0
  105. data/lib/nokogiri/xml/node.rb +22 -13
  106. data/lib/nokogiri/xml/pp/node.rb +23 -12
  107. data/lib/nokogiri/xml/sax/document.rb +1 -1
  108. data/lib/nokogiri/xml/searchable.rb +18 -10
  109. data/lib/nokogiri/xslt.rb +73 -3
  110. data/lib/nokogiri.rb +12 -4
  111. data/lib/xsd/xmlparser/nokogiri.rb +1 -1
  112. metadata +2 -2
@@ -2,17 +2,22 @@
2
2
 
3
3
  VALUE cNokogiriXmlElementContent;
4
4
 
5
+ static const rb_data_type_t element_content_data_type = {
6
+ .wrap_struct_name = "Nokogiri::XML::ElementContent",
7
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
8
+ };
9
+
5
10
  /*
6
11
  * call-seq:
7
- * name
12
+ * name → String
8
13
  *
9
- * Get the require element +name+
14
+ * [Returns] The content element's +name+
10
15
  */
11
16
  static VALUE
12
17
  get_name(VALUE self)
13
18
  {
14
19
  xmlElementContentPtr elem;
15
- Data_Get_Struct(self, xmlElementContent, elem);
20
+ TypedData_Get_Struct(self, xmlElementContent, &element_content_data_type, elem);
16
21
 
17
22
  if (!elem->name) { return Qnil; }
18
23
  return NOKOGIRI_STR_NEW2(elem->name);
@@ -20,47 +25,40 @@ get_name(VALUE self)
20
25
 
21
26
  /*
22
27
  * call-seq:
23
- * type
28
+ * type → Integer
24
29
  *
25
- * Get the element content +type+. Possible values are PCDATA, ELEMENT, SEQ,
26
- * or OR.
30
+ * [Returns] The content element's +type+. Possible values are +PCDATA+, +ELEMENT+, +SEQ+, or +OR+.
27
31
  */
28
32
  static VALUE
29
33
  get_type(VALUE self)
30
34
  {
31
35
  xmlElementContentPtr elem;
32
- Data_Get_Struct(self, xmlElementContent, elem);
36
+ TypedData_Get_Struct(self, xmlElementContent, &element_content_data_type, elem);
33
37
 
34
38
  return INT2NUM(elem->type);
35
39
  }
36
40
 
37
41
  /*
38
- * call-seq:
39
- * c1
40
- *
41
42
  * Get the first child.
42
43
  */
43
44
  static VALUE
44
45
  get_c1(VALUE self)
45
46
  {
46
47
  xmlElementContentPtr elem;
47
- Data_Get_Struct(self, xmlElementContent, elem);
48
+ TypedData_Get_Struct(self, xmlElementContent, &element_content_data_type, elem);
48
49
 
49
50
  if (!elem->c1) { return Qnil; }
50
51
  return noko_xml_element_content_wrap(rb_iv_get(self, "@document"), elem->c1);
51
52
  }
52
53
 
53
54
  /*
54
- * call-seq:
55
- * c2
56
- *
57
- * Get the first child.
55
+ * Get the second child.
58
56
  */
59
57
  static VALUE
60
58
  get_c2(VALUE self)
61
59
  {
62
60
  xmlElementContentPtr elem;
63
- Data_Get_Struct(self, xmlElementContent, elem);
61
+ TypedData_Get_Struct(self, xmlElementContent, &element_content_data_type, elem);
64
62
 
65
63
  if (!elem->c2) { return Qnil; }
66
64
  return noko_xml_element_content_wrap(rb_iv_get(self, "@document"), elem->c2);
@@ -68,45 +66,50 @@ get_c2(VALUE self)
68
66
 
69
67
  /*
70
68
  * call-seq:
71
- * occur
69
+ * occur → Integer
72
70
  *
73
- * Get the element content +occur+ flag. Possible values are ONCE, OPT, MULT
74
- * or PLUS.
71
+ * [Returns] The content element's +occur+ flag. Possible values are +ONCE+, +OPT+, +MULT+ or +PLUS+.
75
72
  */
76
73
  static VALUE
77
74
  get_occur(VALUE self)
78
75
  {
79
76
  xmlElementContentPtr elem;
80
- Data_Get_Struct(self, xmlElementContent, elem);
77
+ TypedData_Get_Struct(self, xmlElementContent, &element_content_data_type, elem);
81
78
 
82
79
  return INT2NUM(elem->ocur);
83
80
  }
84
81
 
85
82
  /*
86
83
  * call-seq:
87
- * prefix
84
+ * prefix → String
88
85
  *
89
- * Get the element content namespace +prefix+.
86
+ * [Returns] The content element's namespace +prefix+.
90
87
  */
91
88
  static VALUE
92
89
  get_prefix(VALUE self)
93
90
  {
94
91
  xmlElementContentPtr elem;
95
- Data_Get_Struct(self, xmlElementContent, elem);
92
+ TypedData_Get_Struct(self, xmlElementContent, &element_content_data_type, elem);
96
93
 
97
94
  if (!elem->prefix) { return Qnil; }
98
95
 
99
96
  return NOKOGIRI_STR_NEW2(elem->prefix);
100
97
  }
101
98
 
99
+ /*
100
+ * create a Nokogiri::XML::ElementContent object around an +element+.
101
+ */
102
102
  VALUE
103
- noko_xml_element_content_wrap(VALUE doc, xmlElementContentPtr element)
103
+ noko_xml_element_content_wrap(VALUE rb_document, xmlElementContentPtr c_element_content)
104
104
  {
105
- VALUE elem = Data_Wrap_Struct(cNokogiriXmlElementContent, 0, 0, element);
106
-
107
- /* Setting the document is necessary so that this does not get GC'd until */
108
- /* the document is GC'd */
109
- rb_iv_set(elem, "@document", doc);
105
+ VALUE elem = TypedData_Wrap_Struct(
106
+ cNokogiriXmlElementContent,
107
+ &element_content_data_type,
108
+ c_element_content
109
+ );
110
+
111
+ /* keep a handle on the document for GC marking */
112
+ rb_iv_set(elem, "@document", rb_document);
110
113
 
111
114
  return elem;
112
115
  }
@@ -6,7 +6,7 @@ static ID id_document;
6
6
 
7
7
  /*
8
8
  * call-seq:
9
- * element_type
9
+ * element_type → Integer
10
10
  *
11
11
  * The element_type
12
12
  */
@@ -20,9 +20,9 @@ element_type(VALUE self)
20
20
 
21
21
  /*
22
22
  * call-seq:
23
- * content
23
+ * content → Nokogiri::XML::ElementContent
24
24
  *
25
- * The allowed content for this ElementDecl
25
+ * [Returns] The root of this element declaration's content tree.
26
26
  */
27
27
  static VALUE
28
28
  content(VALUE self)
@@ -40,9 +40,9 @@ content(VALUE self)
40
40
 
41
41
  /*
42
42
  * call-seq:
43
- * prefix
43
+ * prefix → String
44
44
  *
45
- * The namespace prefix for this ElementDecl
45
+ * [Returns] The namespace +prefix+ for this element declaration.
46
46
  */
47
47
  static VALUE
48
48
  prefix(VALUE self)
@@ -2,14 +2,22 @@
2
2
 
3
3
  VALUE cNokogiriEncodingHandler;
4
4
 
5
-
6
5
  static void
7
- _xml_encoding_handler_dealloc(xmlCharEncodingHandlerPtr c_handler)
6
+ xml_encoding_handler_dealloc(void *data)
8
7
  {
9
8
  /* make sure iconv handlers are cleaned up and freed */
9
+ xmlCharEncodingHandlerPtr c_handler = data;
10
10
  xmlCharEncCloseFunc(c_handler);
11
11
  }
12
12
 
13
+ static const rb_data_type_t xml_encoding_handler_type = {
14
+ .wrap_struct_name = "Nokogiri::EncodingHandler",
15
+ .function = {
16
+ .dfree = xml_encoding_handler_dealloc,
17
+ },
18
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
19
+ };
20
+
13
21
 
14
22
  /*
15
23
  * call-seq: Nokogiri::EncodingHandler.[](name)
@@ -23,7 +31,7 @@ rb_xml_encoding_handler_s_get(VALUE klass, VALUE key)
23
31
 
24
32
  handler = xmlFindCharEncodingHandler(StringValueCStr(key));
25
33
  if (handler) {
26
- return Data_Wrap_Struct(klass, NULL, _xml_encoding_handler_dealloc, handler);
34
+ return TypedData_Wrap_Struct(klass, &xml_encoding_handler_type, handler);
27
35
  }
28
36
 
29
37
  return Qnil;
@@ -82,7 +90,7 @@ rb_xml_encoding_handler_name(VALUE self)
82
90
  {
83
91
  xmlCharEncodingHandlerPtr handler;
84
92
 
85
- Data_Get_Struct(self, xmlCharEncodingHandler, handler);
93
+ TypedData_Get_Struct(self, xmlCharEncodingHandler, &xml_encoding_handler_type, handler);
86
94
 
87
95
  return NOKOGIRI_STR_NEW2(handler->name);
88
96
  }
@@ -20,7 +20,7 @@ new (int argc, VALUE *argv, VALUE klass)
20
20
 
21
21
  rb_scan_args(argc, argv, "2*", &document, &name, &rest);
22
22
 
23
- Data_Get_Struct(document, xmlDoc, xml_doc);
23
+ xml_doc = noko_xml_document_unwrap(document);
24
24
 
25
25
  node = xmlNewReference(
26
26
  xml_doc,
@@ -56,21 +56,20 @@ _xml_namespace_update_references(void *ptr)
56
56
  #endif
57
57
 
58
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
59
+ .wrap_struct_name = "Nokogiri::XML::Namespace#with_dealloc",
60
+ .function = {
61
+ .dfree = _xml_namespace_dealloc,
62
+ .dcompact = _xml_namespace_update_references,
63
+ },
64
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
65
65
  };
66
66
 
67
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
68
+ .wrap_struct_name = "Nokogiri::XML::Namespace#without_dealloc",
69
+ .function = {
70
+ .dcompact = _xml_namespace_update_references,
71
+ },
72
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
74
73
  };
75
74
 
76
75
  /*
@@ -43,12 +43,12 @@ _xml_node_update_references(void *ptr)
43
43
  #endif
44
44
 
45
45
  static const rb_data_type_t nokogiri_node_type = {
46
- "Nokogiri/XMLNode",
47
- {_xml_node_mark, 0, 0, _xml_node_update_references},
48
- 0, 0,
49
- #ifdef RUBY_TYPED_FREE_IMMEDIATELY
50
- RUBY_TYPED_FREE_IMMEDIATELY,
51
- #endif
46
+ .wrap_struct_name = "Nokogiri::XML::Node",
47
+ .function = {
48
+ .dmark = _xml_node_mark,
49
+ .dcompact = _xml_node_update_references,
50
+ },
51
+ .flags = RUBY_TYPED_FREE_IMMEDIATELY,
52
52
  };
53
53
 
54
54
  static void
@@ -984,7 +984,7 @@ duplicate_node(int argc, VALUE *argv, VALUE self)
984
984
  if (n_args < 2) {
985
985
  new_parent_doc = node->doc;
986
986
  } else {
987
- Data_Get_Struct(r_new_parent_doc, xmlDoc, new_parent_doc);
987
+ new_parent_doc = noko_xml_document_unwrap(r_new_parent_doc);
988
988
  }
989
989
 
990
990
  dup = xmlDocCopyNode(node, new_parent_doc, level);