nokogiri 1.11.7 → 1.12.5

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 (110) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE-DEPENDENCIES.md +243 -22
  3. data/LICENSE.md +1 -1
  4. data/README.md +6 -5
  5. data/ext/nokogiri/depend +35 -34
  6. data/ext/nokogiri/extconf.rb +185 -103
  7. data/ext/nokogiri/gumbo.c +584 -0
  8. data/ext/nokogiri/{html_document.c → html4_document.c} +8 -8
  9. data/ext/nokogiri/{html_element_description.c → html4_element_description.c} +21 -19
  10. data/ext/nokogiri/{html_entity_lookup.c → html4_entity_lookup.c} +7 -7
  11. data/ext/nokogiri/{html_sax_parser_context.c → html4_sax_parser_context.c} +6 -5
  12. data/ext/nokogiri/{html_sax_push_parser.c → html4_sax_push_parser.c} +4 -4
  13. data/ext/nokogiri/libxml2_backwards_compat.c +30 -30
  14. data/ext/nokogiri/nokogiri.c +51 -38
  15. data/ext/nokogiri/nokogiri.h +19 -9
  16. data/ext/nokogiri/xml_document.c +14 -14
  17. data/ext/nokogiri/xml_element_content.c +2 -0
  18. data/ext/nokogiri/xml_encoding_handler.c +11 -6
  19. data/ext/nokogiri/xml_namespace.c +4 -2
  20. data/ext/nokogiri/xml_node.c +107 -100
  21. data/ext/nokogiri/xml_node_set.c +20 -20
  22. data/ext/nokogiri/xml_reader.c +2 -0
  23. data/ext/nokogiri/xml_sax_parser.c +6 -6
  24. data/ext/nokogiri/xml_sax_parser_context.c +2 -0
  25. data/ext/nokogiri/xml_schema.c +2 -0
  26. data/ext/nokogiri/xml_xpath_context.c +67 -65
  27. data/ext/nokogiri/xslt_stylesheet.c +2 -1
  28. data/gumbo-parser/CHANGES.md +63 -0
  29. data/gumbo-parser/Makefile +101 -0
  30. data/gumbo-parser/THANKS +27 -0
  31. data/gumbo-parser/src/Makefile +34 -0
  32. data/gumbo-parser/src/README.md +41 -0
  33. data/gumbo-parser/src/ascii.c +75 -0
  34. data/gumbo-parser/src/ascii.h +115 -0
  35. data/gumbo-parser/src/attribute.c +42 -0
  36. data/gumbo-parser/src/attribute.h +17 -0
  37. data/gumbo-parser/src/char_ref.c +22225 -0
  38. data/gumbo-parser/src/char_ref.h +29 -0
  39. data/gumbo-parser/src/char_ref.rl +2154 -0
  40. data/gumbo-parser/src/error.c +626 -0
  41. data/gumbo-parser/src/error.h +148 -0
  42. data/gumbo-parser/src/foreign_attrs.c +104 -0
  43. data/gumbo-parser/src/foreign_attrs.gperf +27 -0
  44. data/gumbo-parser/src/gumbo.h +943 -0
  45. data/gumbo-parser/src/insertion_mode.h +33 -0
  46. data/gumbo-parser/src/macros.h +91 -0
  47. data/gumbo-parser/src/parser.c +4886 -0
  48. data/gumbo-parser/src/parser.h +41 -0
  49. data/gumbo-parser/src/replacement.h +33 -0
  50. data/gumbo-parser/src/string_buffer.c +103 -0
  51. data/gumbo-parser/src/string_buffer.h +68 -0
  52. data/gumbo-parser/src/string_piece.c +48 -0
  53. data/gumbo-parser/src/svg_attrs.c +174 -0
  54. data/gumbo-parser/src/svg_attrs.gperf +77 -0
  55. data/gumbo-parser/src/svg_tags.c +137 -0
  56. data/gumbo-parser/src/svg_tags.gperf +55 -0
  57. data/gumbo-parser/src/tag.c +222 -0
  58. data/gumbo-parser/src/tag_lookup.c +382 -0
  59. data/gumbo-parser/src/tag_lookup.gperf +169 -0
  60. data/gumbo-parser/src/tag_lookup.h +13 -0
  61. data/gumbo-parser/src/token_buffer.c +79 -0
  62. data/gumbo-parser/src/token_buffer.h +71 -0
  63. data/gumbo-parser/src/token_type.h +17 -0
  64. data/gumbo-parser/src/tokenizer.c +3463 -0
  65. data/gumbo-parser/src/tokenizer.h +112 -0
  66. data/gumbo-parser/src/tokenizer_states.h +339 -0
  67. data/gumbo-parser/src/utf8.c +245 -0
  68. data/gumbo-parser/src/utf8.h +164 -0
  69. data/gumbo-parser/src/util.c +68 -0
  70. data/gumbo-parser/src/util.h +30 -0
  71. data/gumbo-parser/src/vector.c +111 -0
  72. data/gumbo-parser/src/vector.h +45 -0
  73. data/lib/nokogiri/css/parser.rb +1 -1
  74. data/lib/nokogiri/css/parser.y +1 -1
  75. data/lib/nokogiri/css/syntax_error.rb +1 -1
  76. data/lib/nokogiri/css.rb +14 -14
  77. data/lib/nokogiri/extension.rb +7 -2
  78. data/lib/nokogiri/gumbo.rb +14 -0
  79. data/lib/nokogiri/html.rb +31 -27
  80. data/lib/nokogiri/{html → html4}/builder.rb +2 -2
  81. data/lib/nokogiri/{html → html4}/document.rb +4 -4
  82. data/lib/nokogiri/{html → html4}/document_fragment.rb +3 -3
  83. data/lib/nokogiri/{html → html4}/element_description.rb +1 -1
  84. data/lib/nokogiri/{html → html4}/element_description_defaults.rb +1 -1
  85. data/lib/nokogiri/{html → html4}/entity_lookup.rb +1 -1
  86. data/lib/nokogiri/{html → html4}/sax/parser.rb +11 -14
  87. data/lib/nokogiri/html4/sax/parser_context.rb +19 -0
  88. data/lib/nokogiri/{html → html4}/sax/push_parser.rb +5 -5
  89. data/lib/nokogiri/html4.rb +40 -0
  90. data/lib/nokogiri/html5/document.rb +74 -0
  91. data/lib/nokogiri/html5/document_fragment.rb +80 -0
  92. data/lib/nokogiri/html5/node.rb +93 -0
  93. data/lib/nokogiri/html5.rb +473 -0
  94. data/lib/nokogiri/version/constant.rb +1 -1
  95. data/lib/nokogiri/version/info.rb +11 -2
  96. data/lib/nokogiri/xml/builder.rb +38 -0
  97. data/lib/nokogiri/xml/document.rb +46 -0
  98. data/lib/nokogiri/xml/node/save_options.rb +1 -1
  99. data/lib/nokogiri/xml/node.rb +6 -5
  100. data/lib/nokogiri/xml/parse_options.rb +2 -0
  101. data/lib/nokogiri/xml/pp.rb +2 -2
  102. data/lib/nokogiri/xml/sax/document.rb +24 -30
  103. data/lib/nokogiri/xml/sax.rb +4 -4
  104. data/lib/nokogiri/xml/xpath.rb +2 -2
  105. data/lib/nokogiri/xml.rb +35 -36
  106. data/lib/nokogiri/xslt/stylesheet.rb +1 -1
  107. data/lib/nokogiri/xslt.rb +16 -16
  108. data/lib/nokogiri.rb +31 -29
  109. metadata +100 -58
  110. data/lib/nokogiri/html/sax/parser_context.rb +0 -17
@@ -36,6 +36,7 @@ static void
36
36
  relink_namespace(xmlNodePtr reparented)
37
37
  {
38
38
  xmlNodePtr child;
39
+ xmlAttrPtr attr;
39
40
 
40
41
  if (reparented->type != XML_ATTRIBUTE_NODE &&
41
42
  reparented->type != XML_ELEMENT_NODE) { return; }
@@ -69,7 +70,9 @@ relink_namespace(xmlNodePtr reparented)
69
70
  if (reparented->type != XML_ELEMENT_NODE || !reparented->parent) { return; }
70
71
 
71
72
  /* Make sure that our reparented node has the correct namespaces */
72
- if (!reparented->ns && reparented->doc != (xmlDocPtr)reparented->parent) {
73
+ if (!reparented->ns &&
74
+ (reparented->doc != (xmlDocPtr)reparented->parent) &&
75
+ (rb_iv_get(DOC_RUBY_OBJECT(reparented->doc), "@namespace_inheritance") == Qtrue)) {
73
76
  xmlSetNs(reparented, reparented->parent->ns);
74
77
  }
75
78
 
@@ -132,10 +135,10 @@ relink_namespace(xmlNodePtr reparented)
132
135
  }
133
136
 
134
137
  if (reparented->type == XML_ELEMENT_NODE) {
135
- child = (xmlNodePtr)((xmlElementPtr)reparented)->attributes;
136
- while (NULL != child) {
137
- relink_namespace(child);
138
- child = child->next;
138
+ attr = reparented->properties;
139
+ while (NULL != attr) {
140
+ relink_namespace((xmlNodePtr)attr);
141
+ attr = attr->next;
139
142
  }
140
143
  }
141
144
  }
@@ -170,7 +173,7 @@ static VALUE
170
173
  reparent_node_with(VALUE pivot_obj, VALUE reparentee_obj, pivot_reparentee_func prf)
171
174
  {
172
175
  VALUE reparented_obj ;
173
- xmlNodePtr reparentee, pivot, reparented, next_text, new_next_text, parent ;
176
+ xmlNodePtr reparentee, original_reparentee, pivot, reparented, next_text, new_next_text, parent ;
174
177
  int original_ns_prefix_is_default = 0 ;
175
178
 
176
179
  if (!rb_obj_is_kind_of(reparentee_obj, cNokogiriXmlNode)) {
@@ -197,66 +200,66 @@ reparent_node_with(VALUE pivot_obj, VALUE reparentee_obj, pivot_reparentee_func
197
200
 
198
201
  if (parent) {
199
202
  switch (parent->type) {
200
- case XML_DOCUMENT_NODE:
201
- case XML_HTML_DOCUMENT_NODE:
202
- switch (reparentee->type) {
203
- case XML_ELEMENT_NODE:
204
- case XML_PI_NODE:
205
- case XML_COMMENT_NODE:
206
- case XML_DOCUMENT_TYPE_NODE:
207
- /*
208
- * The DOM specification says no to adding text-like nodes
209
- * directly to a document, but we allow it for compatibility.
210
- */
211
- case XML_TEXT_NODE:
212
- case XML_CDATA_SECTION_NODE:
213
- case XML_ENTITY_REF_NODE:
214
- goto ok;
215
- default:
203
+ case XML_DOCUMENT_NODE:
204
+ case XML_HTML_DOCUMENT_NODE:
205
+ switch (reparentee->type) {
206
+ case XML_ELEMENT_NODE:
207
+ case XML_PI_NODE:
208
+ case XML_COMMENT_NODE:
209
+ case XML_DOCUMENT_TYPE_NODE:
210
+ /*
211
+ * The DOM specification says no to adding text-like nodes
212
+ * directly to a document, but we allow it for compatibility.
213
+ */
214
+ case XML_TEXT_NODE:
215
+ case XML_CDATA_SECTION_NODE:
216
+ case XML_ENTITY_REF_NODE:
217
+ goto ok;
218
+ default:
219
+ break;
220
+ }
216
221
  break;
217
- }
218
- break;
219
- case XML_DOCUMENT_FRAG_NODE:
220
- case XML_ENTITY_REF_NODE:
221
- case XML_ELEMENT_NODE:
222
- switch (reparentee->type) {
223
- case XML_ELEMENT_NODE:
224
- case XML_PI_NODE:
225
- case XML_COMMENT_NODE:
226
- case XML_TEXT_NODE:
227
- case XML_CDATA_SECTION_NODE:
222
+ case XML_DOCUMENT_FRAG_NODE:
228
223
  case XML_ENTITY_REF_NODE:
229
- goto ok;
230
- default:
224
+ case XML_ELEMENT_NODE:
225
+ switch (reparentee->type) {
226
+ case XML_ELEMENT_NODE:
227
+ case XML_PI_NODE:
228
+ case XML_COMMENT_NODE:
229
+ case XML_TEXT_NODE:
230
+ case XML_CDATA_SECTION_NODE:
231
+ case XML_ENTITY_REF_NODE:
232
+ goto ok;
233
+ default:
234
+ break;
235
+ }
236
+ break;
237
+ case XML_ATTRIBUTE_NODE:
238
+ switch (reparentee->type) {
239
+ case XML_TEXT_NODE:
240
+ case XML_ENTITY_REF_NODE:
241
+ goto ok;
242
+ default:
243
+ break;
244
+ }
231
245
  break;
232
- }
233
- break;
234
- case XML_ATTRIBUTE_NODE:
235
- switch (reparentee->type) {
236
246
  case XML_TEXT_NODE:
237
- case XML_ENTITY_REF_NODE:
238
- goto ok;
247
+ /*
248
+ * xmlAddChild() breaks the DOM specification in that it allows
249
+ * adding a text node to another, in which case text nodes are
250
+ * coalesced, but since our JRuby version does not support such
251
+ * operation, we should inhibit it.
252
+ */
253
+ break;
239
254
  default:
240
255
  break;
241
- }
242
- break;
243
- case XML_TEXT_NODE:
244
- /*
245
- * xmlAddChild() breaks the DOM specification in that it allows
246
- * adding a text node to another, in which case text nodes are
247
- * coalesced, but since our JRuby version does not support such
248
- * operation, we should inhibit it.
249
- */
250
- break;
251
- default:
252
- break;
253
256
  }
254
257
 
255
258
  rb_raise(rb_eArgError, "cannot reparent %s there", rb_obj_classname(reparentee_obj));
256
259
  }
257
260
 
258
261
  ok:
259
- xmlUnlinkNode(reparentee);
262
+ original_reparentee = reparentee;
260
263
 
261
264
  if (reparentee->doc != pivot->doc || reparentee->type == XML_TEXT_NODE) {
262
265
  /*
@@ -308,11 +311,13 @@ ok:
308
311
  * issue #391, where new node's prefix may become the string "default"
309
312
  * see libxml2 tree.c xmlNewReconciliedNs which implements this behavior.
310
313
  */
311
- xmlFree((xmlChar *)reparentee->ns->prefix);
314
+ xmlFree(DISCARD_CONST_QUAL_XMLCHAR(reparentee->ns->prefix));
312
315
  reparentee->ns->prefix = NULL;
313
316
  }
314
317
  }
315
318
 
319
+ xmlUnlinkNode(original_reparentee);
320
+
316
321
  if (prf != xmlAddPrevSibling && prf != xmlAddNextSibling
317
322
  && reparentee->type == XML_TEXT_NODE && pivot->next && pivot->next->type == XML_TEXT_NODE) {
318
323
  /*
@@ -936,7 +941,7 @@ get(VALUE self, VALUE rattribute)
936
941
  Data_Get_Struct(self, xmlNode, node);
937
942
  attribute = xmlCharStrdup(StringValueCStr(rattribute));
938
943
 
939
- colon = (xmlChar *)(uintptr_t)xmlStrchr(attribute, (const xmlChar)':');
944
+ colon = DISCARD_CONST_QUAL_XMLCHAR(xmlStrchr(attribute, (const xmlChar)':'));
940
945
  if (colon) {
941
946
  /* split the attribute string into separate prefix and name by
942
947
  * null-terminating the prefix at the colon */
@@ -1641,12 +1646,12 @@ in_context(VALUE self, VALUE _str, VALUE _options)
1641
1646
 
1642
1647
  /* FIXME: This probably needs to handle more constants... */
1643
1648
  switch (error) {
1644
- case XML_ERR_INTERNAL_ERROR:
1645
- case XML_ERR_NO_MEMORY:
1646
- rb_raise(rb_eRuntimeError, "error parsing fragment (%d)", error);
1647
- break;
1648
- default:
1649
- break;
1649
+ case XML_ERR_INTERNAL_ERROR:
1650
+ case XML_ERR_NO_MEMORY:
1651
+ rb_raise(rb_eRuntimeError, "error parsing fragment (%d)", error);
1652
+ break;
1653
+ default:
1654
+ break;
1650
1655
  }
1651
1656
 
1652
1657
  set = xmlXPathNodeSetCreate(NULL);
@@ -1690,44 +1695,44 @@ noko_xml_node_wrap(VALUE rb_class, xmlNodePtr c_node)
1690
1695
 
1691
1696
  if (!RTEST(rb_class)) {
1692
1697
  switch (c_node->type) {
1693
- case XML_ELEMENT_NODE:
1694
- rb_class = cNokogiriXmlElement;
1695
- break;
1696
- case XML_TEXT_NODE:
1697
- rb_class = cNokogiriXmlText;
1698
- break;
1699
- case XML_ATTRIBUTE_NODE:
1700
- rb_class = cNokogiriXmlAttr;
1701
- break;
1702
- case XML_ENTITY_REF_NODE:
1703
- rb_class = cNokogiriXmlEntityReference;
1704
- break;
1705
- case XML_COMMENT_NODE:
1706
- rb_class = cNokogiriXmlComment;
1707
- break;
1708
- case XML_DOCUMENT_FRAG_NODE:
1709
- rb_class = cNokogiriXmlDocumentFragment;
1710
- break;
1711
- case XML_PI_NODE:
1712
- rb_class = cNokogiriXmlProcessingInstruction;
1713
- break;
1714
- case XML_ENTITY_DECL:
1715
- rb_class = cNokogiriXmlEntityDecl;
1716
- break;
1717
- case XML_CDATA_SECTION_NODE:
1718
- rb_class = cNokogiriXmlCData;
1719
- break;
1720
- case XML_DTD_NODE:
1721
- rb_class = cNokogiriXmlDtd;
1722
- break;
1723
- case XML_ATTRIBUTE_DECL:
1724
- rb_class = cNokogiriXmlAttributeDecl;
1725
- break;
1726
- case XML_ELEMENT_DECL:
1727
- rb_class = cNokogiriXmlElementDecl;
1728
- break;
1729
- default:
1730
- rb_class = cNokogiriXmlNode;
1698
+ case XML_ELEMENT_NODE:
1699
+ rb_class = cNokogiriXmlElement;
1700
+ break;
1701
+ case XML_TEXT_NODE:
1702
+ rb_class = cNokogiriXmlText;
1703
+ break;
1704
+ case XML_ATTRIBUTE_NODE:
1705
+ rb_class = cNokogiriXmlAttr;
1706
+ break;
1707
+ case XML_ENTITY_REF_NODE:
1708
+ rb_class = cNokogiriXmlEntityReference;
1709
+ break;
1710
+ case XML_COMMENT_NODE:
1711
+ rb_class = cNokogiriXmlComment;
1712
+ break;
1713
+ case XML_DOCUMENT_FRAG_NODE:
1714
+ rb_class = cNokogiriXmlDocumentFragment;
1715
+ break;
1716
+ case XML_PI_NODE:
1717
+ rb_class = cNokogiriXmlProcessingInstruction;
1718
+ break;
1719
+ case XML_ENTITY_DECL:
1720
+ rb_class = cNokogiriXmlEntityDecl;
1721
+ break;
1722
+ case XML_CDATA_SECTION_NODE:
1723
+ rb_class = cNokogiriXmlCData;
1724
+ break;
1725
+ case XML_DTD_NODE:
1726
+ rb_class = cNokogiriXmlDtd;
1727
+ break;
1728
+ case XML_ATTRIBUTE_DECL:
1729
+ rb_class = cNokogiriXmlAttributeDecl;
1730
+ break;
1731
+ case XML_ELEMENT_DECL:
1732
+ rb_class = cNokogiriXmlElementDecl;
1733
+ break;
1734
+ default:
1735
+ rb_class = cNokogiriXmlNode;
1731
1736
  }
1732
1737
  }
1733
1738
 
@@ -1770,6 +1775,8 @@ noko_init_xml_node()
1770
1775
  {
1771
1776
  cNokogiriXmlNode = rb_define_class_under(mNokogiriXml, "Node", rb_cObject);
1772
1777
 
1778
+ rb_undef_alloc_func(cNokogiriXmlNode);
1779
+
1773
1780
  rb_define_singleton_method(cNokogiriXmlNode, "new", rb_xml_node_new, -1);
1774
1781
 
1775
1782
  rb_define_method(cNokogiriXmlNode, "add_namespace_definition", add_namespace_definition, 2);
@@ -20,20 +20,20 @@ ruby_object_get(xmlNodePtr c_node)
20
20
  {
21
21
  /* see xmlElementType in libxml2 tree.h */
22
22
  switch (c_node->type) {
23
- case XML_NAMESPACE_DECL:
24
- /* _private is later in the namespace struct */
25
- return (VALUE)(((xmlNsPtr)c_node)->_private);
26
-
27
- case XML_DOCUMENT_NODE:
28
- case XML_HTML_DOCUMENT_NODE:
29
- /* in documents we use _private to store a tuple */
30
- if (DOC_RUBY_OBJECT_TEST(((xmlDocPtr)c_node))) {
31
- return DOC_RUBY_OBJECT((xmlDocPtr)c_node);
32
- }
33
- return (VALUE)NULL;
34
-
35
- default:
36
- return (VALUE)(c_node->_private);
23
+ case XML_NAMESPACE_DECL:
24
+ /* _private is later in the namespace struct */
25
+ return (VALUE)(((xmlNsPtr)c_node)->_private);
26
+
27
+ case XML_DOCUMENT_NODE:
28
+ case XML_HTML_DOCUMENT_NODE:
29
+ /* in documents we use _private to store a tuple */
30
+ if (DOC_RUBY_OBJECT_TEST(((xmlDocPtr)c_node))) {
31
+ return DOC_RUBY_OBJECT((xmlDocPtr)c_node);
32
+ }
33
+ return (VALUE)NULL;
34
+
35
+ default:
36
+ return (VALUE)(c_node->_private);
37
37
  }
38
38
  }
39
39
 
@@ -373,12 +373,12 @@ slice(int argc, VALUE *argv, VALUE self)
373
373
 
374
374
  /* if arg is Range */
375
375
  switch (rb_range_beg_len(arg, &beg, &len, (long)node_set->nodeNr, 0)) {
376
- case Qfalse:
377
- break;
378
- case Qnil:
379
- return Qnil;
380
- default:
381
- return subseq(self, beg, len);
376
+ case Qfalse:
377
+ break;
378
+ case Qnil:
379
+ return Qnil;
380
+ default:
381
+ return subseq(self, beg, len);
382
382
  }
383
383
 
384
384
  return index_at(self, NUM2LONG(arg));
@@ -662,6 +662,8 @@ noko_init_xml_reader()
662
662
  */
663
663
  cNokogiriXmlReader = rb_define_class_under(mNokogiriXml, "Reader", rb_cObject);
664
664
 
665
+ rb_undef_alloc_func(cNokogiriXmlReader);
666
+
665
667
  rb_define_singleton_method(cNokogiriXmlReader, "from_memory", from_memory, -1);
666
668
  rb_define_singleton_method(cNokogiriXmlReader, "from_io", from_io, -1);
667
669
 
@@ -30,12 +30,12 @@ start_document(void *ctx)
30
30
  version = ctxt->version ? NOKOGIRI_STR_NEW2(ctxt->version) : Qnil;
31
31
 
32
32
  switch (ctxt->standalone) {
33
- case 0:
34
- standalone = NOKOGIRI_STR_NEW2("no");
35
- break;
36
- case 1:
37
- standalone = NOKOGIRI_STR_NEW2("yes");
38
- break;
33
+ case 0:
34
+ standalone = NOKOGIRI_STR_NEW2("no");
35
+ break;
36
+ case 1:
37
+ standalone = NOKOGIRI_STR_NEW2("yes");
38
+ break;
39
39
  }
40
40
 
41
41
  rb_funcall(doc, id_xmldecl, 3, version, encoding, standalone);
@@ -265,6 +265,8 @@ noko_init_xml_sax_parser_context()
265
265
  {
266
266
  cNokogiriXmlSaxParserContext = rb_define_class_under(mNokogiriXmlSax, "ParserContext", rb_cObject);
267
267
 
268
+ rb_undef_alloc_func(cNokogiriXmlSaxParserContext);
269
+
268
270
  rb_define_singleton_method(cNokogiriXmlSaxParserContext, "io", parse_io, 2);
269
271
  rb_define_singleton_method(cNokogiriXmlSaxParserContext, "memory", parse_memory, 1);
270
272
  rb_define_singleton_method(cNokogiriXmlSaxParserContext, "file", parse_file, 1);
@@ -274,6 +274,8 @@ noko_init_xml_schema()
274
274
  {
275
275
  cNokogiriXmlSchema = rb_define_class_under(mNokogiriXml, "Schema", rb_cObject);
276
276
 
277
+ rb_undef_alloc_func(cNokogiriXmlSchema);
278
+
277
279
  rb_define_singleton_method(cNokogiriXmlSchema, "read_memory", read_memory, -1);
278
280
  rb_define_singleton_method(cNokogiriXmlSchema, "from_document", from_document, -1);
279
281
 
@@ -154,20 +154,20 @@ Nokogiri_marshal_xpath_funcall_and_return_values(xmlXPathParserContextPtr ctx, i
154
154
  do {
155
155
  obj = valuePop(ctx);
156
156
  switch (obj->type) {
157
- case XPATH_STRING:
158
- argv[i] = NOKOGIRI_STR_NEW2(obj->stringval);
159
- break;
160
- case XPATH_BOOLEAN:
161
- argv[i] = obj->boolval == 1 ? Qtrue : Qfalse;
162
- break;
163
- case XPATH_NUMBER:
164
- argv[i] = rb_float_new(obj->floatval);
165
- break;
166
- case XPATH_NODESET:
167
- argv[i] = noko_xml_node_set_wrap(obj->nodesetval, doc);
168
- break;
169
- default:
170
- argv[i] = NOKOGIRI_STR_NEW2(xmlXPathCastToString(obj));
157
+ case XPATH_STRING:
158
+ argv[i] = NOKOGIRI_STR_NEW2(obj->stringval);
159
+ break;
160
+ case XPATH_BOOLEAN:
161
+ argv[i] = obj->boolval == 1 ? Qtrue : Qfalse;
162
+ break;
163
+ case XPATH_NUMBER:
164
+ argv[i] = rb_float_new(obj->floatval);
165
+ break;
166
+ case XPATH_NODESET:
167
+ argv[i] = noko_xml_node_set_wrap(obj->nodesetval, doc);
168
+ break;
169
+ default:
170
+ argv[i] = NOKOGIRI_STR_NEW2(xmlXPathCastToString(obj));
171
171
  }
172
172
  xmlXPathFreeNodeSetList(obj);
173
173
  } while (i-- > 0);
@@ -181,43 +181,43 @@ Nokogiri_marshal_xpath_funcall_and_return_values(xmlXPathParserContextPtr ctx, i
181
181
  free(argv);
182
182
 
183
183
  switch (TYPE(result)) {
184
- case T_FLOAT:
185
- case T_BIGNUM:
186
- case T_FIXNUM:
187
- xmlXPathReturnNumber(ctx, NUM2DBL(result));
188
- break;
189
- case T_STRING:
190
- xmlXPathReturnString(
191
- ctx,
192
- xmlCharStrdup(StringValueCStr(result))
193
- );
194
- break;
195
- case T_TRUE:
196
- xmlXPathReturnTrue(ctx);
197
- break;
198
- case T_FALSE:
199
- xmlXPathReturnFalse(ctx);
200
- break;
201
- case T_NIL:
202
- break;
203
- case T_ARRAY: {
204
- VALUE args[2];
205
- args[0] = doc;
206
- args[1] = result;
207
- node_set = rb_class_new_instance(2, args, cNokogiriXmlNodeSet);
208
- Data_Get_Struct(node_set, xmlNodeSet, xml_node_set);
209
- xmlXPathReturnNodeSet(ctx, xmlXPathNodeSetMerge(NULL, xml_node_set));
210
- }
211
- break;
212
- case T_DATA:
213
- if (rb_obj_is_kind_of(result, cNokogiriXmlNodeSet)) {
214
- Data_Get_Struct(result, xmlNodeSet, xml_node_set);
215
- /* Copy the node set, otherwise it will get GC'd. */
216
- xmlXPathReturnNodeSet(ctx, xmlXPathNodeSetMerge(NULL, xml_node_set));
184
+ case T_FLOAT:
185
+ case T_BIGNUM:
186
+ case T_FIXNUM:
187
+ xmlXPathReturnNumber(ctx, NUM2DBL(result));
188
+ break;
189
+ case T_STRING:
190
+ xmlXPathReturnString(
191
+ ctx,
192
+ xmlCharStrdup(StringValueCStr(result))
193
+ );
194
+ break;
195
+ case T_TRUE:
196
+ xmlXPathReturnTrue(ctx);
197
+ break;
198
+ case T_FALSE:
199
+ xmlXPathReturnFalse(ctx);
217
200
  break;
201
+ case T_NIL:
202
+ break;
203
+ case T_ARRAY: {
204
+ VALUE args[2];
205
+ args[0] = doc;
206
+ args[1] = result;
207
+ node_set = rb_class_new_instance(2, args, cNokogiriXmlNodeSet);
208
+ Data_Get_Struct(node_set, xmlNodeSet, xml_node_set);
209
+ xmlXPathReturnNodeSet(ctx, xmlXPathNodeSetMerge(NULL, xml_node_set));
218
210
  }
219
- default:
220
- rb_raise(rb_eRuntimeError, "Invalid return type");
211
+ break;
212
+ case T_DATA:
213
+ if (rb_obj_is_kind_of(result, cNokogiriXmlNodeSet)) {
214
+ Data_Get_Struct(result, xmlNodeSet, xml_node_set);
215
+ /* Copy the node set, otherwise it will get GC'd. */
216
+ xmlXPathReturnNodeSet(ctx, xmlXPathNodeSetMerge(NULL, xml_node_set));
217
+ break;
218
+ }
219
+ default:
220
+ rb_raise(rb_eRuntimeError, "Invalid return type");
221
221
  }
222
222
  }
223
223
 
@@ -314,22 +314,22 @@ evaluate(int argc, VALUE *argv, VALUE self)
314
314
  assert(DOC_RUBY_OBJECT_TEST(ctx->doc));
315
315
 
316
316
  switch (xpath->type) {
317
- case XPATH_STRING:
318
- thing = NOKOGIRI_STR_NEW2(xpath->stringval);
319
- xmlFree(xpath->stringval);
320
- break;
321
- case XPATH_NODESET:
322
- thing = noko_xml_node_set_wrap(xpath->nodesetval,
323
- DOC_RUBY_OBJECT(ctx->doc));
324
- break;
325
- case XPATH_NUMBER:
326
- thing = rb_float_new(xpath->floatval);
327
- break;
328
- case XPATH_BOOLEAN:
329
- thing = xpath->boolval == 1 ? Qtrue : Qfalse;
330
- break;
331
- default:
332
- thing = noko_xml_node_set_wrap(NULL, DOC_RUBY_OBJECT(ctx->doc));
317
+ case XPATH_STRING:
318
+ thing = NOKOGIRI_STR_NEW2(xpath->stringval);
319
+ xmlFree(xpath->stringval);
320
+ break;
321
+ case XPATH_NODESET:
322
+ thing = noko_xml_node_set_wrap(xpath->nodesetval,
323
+ DOC_RUBY_OBJECT(ctx->doc));
324
+ break;
325
+ case XPATH_NUMBER:
326
+ thing = rb_float_new(xpath->floatval);
327
+ break;
328
+ case XPATH_BOOLEAN:
329
+ thing = xpath->boolval == 1 ? Qtrue : Qfalse;
330
+ break;
331
+ default:
332
+ thing = noko_xml_node_set_wrap(NULL, DOC_RUBY_OBJECT(ctx->doc));
333
333
  }
334
334
 
335
335
  xmlXPathFreeNodeSetList(xpath);
@@ -373,6 +373,8 @@ noko_init_xml_xpath_context(void)
373
373
  */
374
374
  cNokogiriXmlXpathContext = rb_define_class_under(mNokogiriXml, "XPathContext", rb_cObject);
375
375
 
376
+ rb_undef_alloc_func(cNokogiriXmlXpathContext);
377
+
376
378
  rb_define_singleton_method(cNokogiriXmlXpathContext, "new", new, 1);
377
379
 
378
380
  rb_define_method(cNokogiriXmlXpathContext, "evaluate", evaluate, -1);
@@ -64,7 +64,6 @@ parse_stylesheet_doc(VALUE klass, VALUE xmldocobj)
64
64
  VALUE errstr, exception;
65
65
  xsltStylesheetPtr ss ;
66
66
  Data_Get_Struct(xmldocobj, xmlDoc, xml);
67
- exsltRegisterAll();
68
67
 
69
68
  errstr = rb_str_new(0, 0);
70
69
  xsltSetGenericErrorFunc((void *)errstr, xslt_generic_error_handler);
@@ -257,6 +256,8 @@ noko_init_xslt_stylesheet()
257
256
 
258
257
  cNokogiriXsltStylesheet = rb_define_class_under(mNokogiriXslt, "Stylesheet", rb_cObject);
259
258
 
259
+ rb_undef_alloc_func(cNokogiriXsltStylesheet);
260
+
260
261
  rb_define_singleton_method(cNokogiriXsltStylesheet, "parse_stylesheet_doc", parse_stylesheet_doc, 1);
261
262
  rb_define_method(cNokogiriXsltStylesheet, "serialize", serialize, 1);
262
263
  rb_define_method(cNokogiriXsltStylesheet, "transform", transform, -1);
@@ -0,0 +1,63 @@
1
+ ## Gumbo 0.10.1 (2015-04-30)
2
+
3
+ Same as 0.10.0, but with the version number bumped because the last version-number commit to v0.9.4 makes GitHub think that v0.9.4 is the latest version and so it's not highlighted on the webpage.
4
+
5
+ ## Gumbo 0.10.0 (2015-04-30)
6
+
7
+ * Full support for `<template>` tag (kevinhendricks, nostrademons).
8
+ * Some fixes for `<rtc>`/`<rt>` handling (kevinhendricks, vmg).
9
+ * All html5lib-trunk tests pass now! (kevinhendricks, vmg, nostrademons)
10
+ * Support for fragment parsing (vmg)
11
+ * A couple additional example programs (kevinhendricks)
12
+ * Performance improvements totaling an estimated 30-40% total improvement (vmg, nostrademons).
13
+
14
+ ## Gumbo 0.9.4 (2015-04-30)
15
+
16
+ * Additional Visual Studio fixes (lowjoel, nostrademons)
17
+ * Fixed some unused variable warnings.
18
+ * Fix for glibtoolize vs. libtoolize build errors on Mac.
19
+ * Fixed `CDATA` end tag handling.
20
+
21
+ ## Gumbo 0.9.3 (2015-02-17)
22
+
23
+ * Bugfix for `&AElig;` entities (rgrove)
24
+ * Fix `CDATA` handling; `CDATA` sections now generate a `GUMBO_NODE_CDATA` node rather
25
+ than plain text.
26
+ * Fix `get_title example` to handle whitespace nodes (gsnedders)
27
+ * Visual Studio compilation fixes (fishioon)
28
+ * Take the namespace into account when determining whether a node matches a
29
+ certain tag (aroben)
30
+ * Replace the varargs tag functions with a tagset bytevector, for a 20-30%
31
+ speedup in overall parse time (kevinhendricks, vmg)
32
+ * Add MacOS X support to Travis CI, and fix the deployment/DLL issues this
33
+ uncovered (nostrademons, kevinhendricks, vmg)
34
+
35
+ ## Gumbo 0.9.2 (2014-09-21)
36
+
37
+ * Performance improvements: Ragel-based char ref decoder and DFA-based UTF8
38
+ decoder, totaling speedups of up to 300%.
39
+ * Added benchmarking program and some sample data.
40
+ * Fixed a compiler error under Visual Studio.
41
+ * Fix an error in the ctypes bindings that could lead to memory corruption in
42
+ the Python bindings.
43
+ * Fix duplicate attributes when parsing `<isindex>` tags.
44
+ * Don't leave semicolons behind when consuming entity references (rgrove)
45
+ * Internally rename some functions in preparation for an amalgamation file
46
+ (jdeng)
47
+ * Add proper cflags for gyp builds (skabbes)
48
+
49
+ ## Gumbo 0.9.1 (2014-08-07)
50
+
51
+ * First version listed on PyPi.
52
+ * Autotools files excluded from GitHub and generated via autogen.sh. (endgame)
53
+ * Numerous compiler warnings fixed. (bnoordhuis, craigbarnes)
54
+ * Google security audit passed.
55
+ * Gyp support (tfarina)
56
+ * Naming convention for structs changed to avoid C reserved words.
57
+ * Fix several integer and buffer overflows (Maxime2)
58
+ * Some Visual Studio compiler support (bugparty)
59
+ * Python3 compatibility for the ctypes bindings.
60
+
61
+ ## Gumbo 0.9.0 (2013-08-13)
62
+
63
+ * Initial release open-sourced by Google.