nokogiri 1.4.1-x86-mingw32 → 1.4.2.1-x86-mingw32

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. data/CHANGELOG.ja.rdoc +45 -0
  2. data/CHANGELOG.rdoc +53 -1
  3. data/Manifest.txt +3 -3
  4. data/README.ja.rdoc +1 -1
  5. data/README.rdoc +11 -5
  6. data/Rakefile +13 -79
  7. data/ext/nokogiri/extconf.rb +25 -74
  8. data/ext/nokogiri/html_document.c +17 -8
  9. data/ext/nokogiri/html_element_description.c +20 -16
  10. data/ext/nokogiri/html_entity_lookup.c +2 -2
  11. data/ext/nokogiri/html_sax_parser_context.c +10 -8
  12. data/ext/nokogiri/nokogiri.c +0 -1
  13. data/ext/nokogiri/nokogiri.h +33 -28
  14. data/ext/nokogiri/xml_attr.c +7 -5
  15. data/ext/nokogiri/xml_attribute_decl.c +5 -2
  16. data/ext/nokogiri/xml_cdata.c +4 -2
  17. data/ext/nokogiri/xml_comment.c +4 -2
  18. data/ext/nokogiri/xml_document.c +93 -15
  19. data/ext/nokogiri/xml_document.h +0 -1
  20. data/ext/nokogiri/xml_document_fragment.c +4 -2
  21. data/ext/nokogiri/xml_dtd.c +18 -8
  22. data/ext/nokogiri/xml_element_content.c +2 -2
  23. data/ext/nokogiri/xml_entity_decl.c +15 -2
  24. data/ext/nokogiri/xml_entity_reference.c +4 -2
  25. data/ext/nokogiri/xml_io.c +1 -1
  26. data/ext/nokogiri/xml_namespace.c +5 -3
  27. data/ext/nokogiri/xml_node.c +353 -114
  28. data/ext/nokogiri/xml_node_set.c +35 -22
  29. data/ext/nokogiri/xml_node_set.h +1 -1
  30. data/ext/nokogiri/xml_processing_instruction.c +4 -2
  31. data/ext/nokogiri/xml_reader.c +119 -47
  32. data/ext/nokogiri/xml_relax_ng.c +21 -12
  33. data/ext/nokogiri/xml_sax_parser.c +6 -3
  34. data/ext/nokogiri/xml_sax_parser.h +13 -17
  35. data/ext/nokogiri/xml_sax_parser_context.c +8 -6
  36. data/ext/nokogiri/xml_sax_push_parser.c +7 -6
  37. data/ext/nokogiri/xml_schema.c +62 -13
  38. data/ext/nokogiri/xml_syntax_error.c +18 -12
  39. data/ext/nokogiri/xml_syntax_error.h +1 -1
  40. data/ext/nokogiri/xml_text.c +4 -2
  41. data/ext/nokogiri/xml_xpath_context.c +60 -23
  42. data/ext/nokogiri/xslt_stylesheet.c +14 -3
  43. data/lib/nokogiri.rb +17 -0
  44. data/lib/nokogiri/1.8/nokogiri.so +0 -0
  45. data/lib/nokogiri/1.9/nokogiri.so +0 -0
  46. data/lib/nokogiri/css/generated_parser.rb +72 -62
  47. data/lib/nokogiri/css/generated_tokenizer.rb +23 -23
  48. data/lib/nokogiri/css/parser.y +3 -1
  49. data/lib/nokogiri/css/tokenizer.rex +3 -3
  50. data/lib/nokogiri/css/xpath_visitor.rb +8 -3
  51. data/lib/nokogiri/ffi/html/sax/parser_context.rb +3 -3
  52. data/lib/nokogiri/ffi/libxml.rb +16 -2
  53. data/lib/nokogiri/ffi/structs/common_node.rb +15 -3
  54. data/lib/nokogiri/ffi/structs/xml_document.rb +13 -4
  55. data/lib/nokogiri/ffi/structs/xml_xpath_context.rb +3 -2
  56. data/lib/nokogiri/ffi/weak_bucket.rb +40 -0
  57. data/lib/nokogiri/ffi/xml/document.rb +27 -0
  58. data/lib/nokogiri/ffi/xml/entity_decl.rb +9 -0
  59. data/lib/nokogiri/ffi/xml/node.rb +142 -61
  60. data/lib/nokogiri/ffi/xml/node_set.rb +15 -12
  61. data/lib/nokogiri/ffi/xml/reader.rb +5 -0
  62. data/lib/nokogiri/ffi/xml/schema.rb +17 -0
  63. data/lib/nokogiri/ffi/xml/syntax_error.rb +4 -4
  64. data/lib/nokogiri/ffi/xml/xpath.rb +0 -10
  65. data/lib/nokogiri/ffi/xml/xpath_context.rb +22 -9
  66. data/lib/nokogiri/ffi/xslt/stylesheet.rb +3 -0
  67. data/lib/nokogiri/html/document.rb +5 -3
  68. data/lib/nokogiri/html/document_fragment.rb +28 -7
  69. data/lib/nokogiri/version.rb +6 -2
  70. data/lib/nokogiri/version_warning.rb +6 -3
  71. data/lib/nokogiri/xml.rb +1 -1
  72. data/lib/nokogiri/xml/builder.rb +35 -22
  73. data/lib/nokogiri/xml/document.rb +44 -12
  74. data/lib/nokogiri/xml/document_fragment.rb +16 -12
  75. data/lib/nokogiri/xml/entity_decl.rb +4 -0
  76. data/lib/nokogiri/xml/node.rb +152 -95
  77. data/lib/nokogiri/xml/node_set.rb +2 -1
  78. data/lib/nokogiri/xml/sax/push_parser.rb +1 -1
  79. data/lib/nokogiri/xml/schema.rb +1 -5
  80. data/lib/nokogiri/xml/syntax_error.rb +4 -0
  81. data/lib/nokogiri/xml/text.rb +9 -0
  82. data/lib/nokogiri/xml/xpath/syntax_error.rb +3 -0
  83. data/tasks/cross_compile.rb +158 -0
  84. data/tasks/test.rb +0 -6
  85. data/test/css/test_xpath_visitor.rb +9 -0
  86. data/test/helper.rb +49 -11
  87. data/test/html/sax/test_parser.rb +11 -1
  88. data/test/html/test_document.rb +8 -0
  89. data/test/html/test_document_fragment.rb +14 -2
  90. data/test/html/test_element_description.rb +5 -1
  91. data/test/html/test_node.rb +5 -66
  92. data/test/test_reader.rb +28 -0
  93. data/test/test_xslt_transforms.rb +14 -0
  94. data/test/xml/test_builder.rb +43 -0
  95. data/test/xml/test_cdata.rb +12 -0
  96. data/test/xml/test_document.rb +74 -39
  97. data/test/xml/test_document_fragment.rb +36 -0
  98. data/test/xml/test_entity_decl.rb +37 -0
  99. data/test/xml/test_node.rb +192 -65
  100. data/test/xml/test_node_reparenting.rb +253 -236
  101. data/test/xml/test_node_set.rb +67 -0
  102. data/test/xml/test_text.rb +8 -0
  103. data/test/xml/test_xpath.rb +32 -0
  104. metadata +151 -79
  105. data/ext/nokogiri/iconv.dll +0 -0
  106. data/ext/nokogiri/libexslt.dll +0 -0
  107. data/ext/nokogiri/libxml2.dll +0 -0
  108. data/ext/nokogiri/libxslt.dll +0 -0
  109. data/ext/nokogiri/xml_xpath.c +0 -53
  110. data/ext/nokogiri/xml_xpath.h +0 -11
  111. data/ext/nokogiri/zlib1.dll +0 -0
  112. data/lib/nokogiri/xml/fragment_handler.rb +0 -79
Binary file
Binary file
Binary file
Binary file
@@ -1,53 +0,0 @@
1
- #include <xml_xpath.h>
2
-
3
- static void deallocate(xmlXPathObjectPtr xpath)
4
- {
5
- NOKOGIRI_DEBUG_START(xpath);
6
- xmlXPathFreeNodeSetList(xpath); // despite the name, this frees the xpath but not the contained node set
7
- NOKOGIRI_DEBUG_END(xpath);
8
- }
9
-
10
- VALUE Nokogiri_wrap_xml_xpath(xmlXPathObjectPtr xpath)
11
- {
12
- return Data_Wrap_Struct(cNokogiriXmlXpath, 0, deallocate, xpath);
13
- }
14
-
15
- /*
16
- * call-seq:
17
- * node_set
18
- *
19
- * Fetch the node set associated with this xpath context.
20
- */
21
- static VALUE node_set(VALUE self)
22
- {
23
- xmlXPathObjectPtr xpath;
24
- Data_Get_Struct(self, xmlXPathObject, xpath);
25
-
26
- VALUE node_set = Qnil;
27
-
28
- if (xpath->nodesetval)
29
- node_set = Nokogiri_wrap_xml_node_set(xpath->nodesetval);
30
-
31
- if(NIL_P(node_set))
32
- node_set = Nokogiri_wrap_xml_node_set(xmlXPathNodeSetCreate(NULL));
33
-
34
- rb_funcall(node_set, rb_intern("document="), 1, rb_iv_get(self, "@document"));
35
-
36
- return node_set;
37
- }
38
-
39
- VALUE cNokogiriXmlXpath;
40
- void init_xml_xpath(void)
41
- {
42
- VALUE module = rb_define_module("Nokogiri");
43
- VALUE xml = rb_define_module_under(module, "XML");
44
-
45
- /*
46
- * This class wraps an XPath object and should only be instantiated from
47
- * XPathContext.
48
- */
49
- VALUE klass = rb_define_class_under(xml, "XPath", rb_cObject);
50
-
51
- cNokogiriXmlXpath = klass;
52
- rb_define_method(klass, "node_set", node_set, 0);
53
- }
@@ -1,11 +0,0 @@
1
- #ifndef NOKOGIRI_XML_XPATH
2
- #define NOKOGIRI_XML_XPATH
3
-
4
- #include <nokogiri.h>
5
-
6
- void init_xml_xpath();
7
- VALUE Nokogiri_wrap_xml_xpath(xmlXPathObjectPtr xpath);
8
-
9
- extern VALUE cNokogiriXmlXpath;
10
- #endif
11
-
Binary file
@@ -1,79 +0,0 @@
1
- module Nokogiri
2
- module XML
3
- class FragmentHandler < Nokogiri::XML::SAX::Document # :nodoc:
4
- QNAME_REGEX = /(.*):(.*)/
5
-
6
- def initialize node, original_html
7
- @doc_started = false
8
- @document = node.document
9
- @stack = [node]
10
- @html_eh = node.kind_of? HTML::DocumentFragment
11
- @original_html = prepare_for_regex(original_html.strip)
12
- end
13
-
14
- def start_element name, attrs = []
15
- regex = @html_eh ? %r{^\s*<#{Regexp.escape(name)}}i :
16
- %r{^\s*<#{Regexp.escape(name)}}
17
-
18
- if ! @doc_started && @original_html =~ regex
19
- @doc_started = true
20
- end
21
- return unless @doc_started
22
-
23
- ns = nil
24
- if @document.root
25
- match = name.match(QNAME_REGEX)
26
- if match
27
- prefix, name = match[1], match[2]
28
- ns = @document.root.namespace_definitions.detect { |x|
29
- x.prefix == prefix
30
- }
31
- end
32
- end
33
-
34
- node = Element.new(name, @document)
35
- attrs << "" unless (attrs.length % 2) == 0
36
- Hash[*attrs].each do |k,v|
37
- node[k] = v
38
- end
39
-
40
- node.namespace = ns if ns
41
-
42
- @stack.last << node
43
- @stack << node
44
- end
45
-
46
- def characters string
47
- @doc_started = true
48
- @stack.last << Text.new(string, @document)
49
- end
50
-
51
- def comment string
52
- @stack.last << Comment.new(@document, string)
53
- end
54
-
55
- def cdata_block string
56
- @stack.last << CDATA.new(@document, string)
57
- end
58
-
59
- def end_element name
60
- return unless @stack.last.name == name
61
- @stack.pop
62
- end
63
-
64
- private
65
-
66
- #
67
- # the regexes used in start_element() and characters() anchor at
68
- # start-of-line, but we really only want them to anchor at
69
- # start-of-doc. so let's only save up to the first newline.
70
- #
71
- # this implementation choice was the result of some benchmarks, if
72
- # you're curious: http://gist.github.com/115936
73
- #
74
- def prepare_for_regex(string)
75
- (newline_index = string.index("\n")) ? string.slice(0,newline_index) : string
76
- end
77
- end
78
- end
79
- end