nokogiri 1.4.1 → 1.4.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.

Files changed (107) 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 +22 -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/css/generated_parser.rb +72 -62
  45. data/lib/nokogiri/css/generated_tokenizer.rb +23 -24
  46. data/lib/nokogiri/css/parser.y +3 -1
  47. data/lib/nokogiri/css/tokenizer.rex +3 -3
  48. data/lib/nokogiri/css/xpath_visitor.rb +8 -3
  49. data/lib/nokogiri/ffi/html/sax/parser_context.rb +3 -3
  50. data/lib/nokogiri/ffi/libxml.rb +16 -2
  51. data/lib/nokogiri/ffi/structs/common_node.rb +15 -3
  52. data/lib/nokogiri/ffi/structs/xml_document.rb +13 -4
  53. data/lib/nokogiri/ffi/structs/xml_xpath_context.rb +3 -2
  54. data/lib/nokogiri/ffi/weak_bucket.rb +40 -0
  55. data/lib/nokogiri/ffi/xml/document.rb +27 -0
  56. data/lib/nokogiri/ffi/xml/entity_decl.rb +9 -0
  57. data/lib/nokogiri/ffi/xml/node.rb +142 -61
  58. data/lib/nokogiri/ffi/xml/node_set.rb +15 -12
  59. data/lib/nokogiri/ffi/xml/reader.rb +5 -0
  60. data/lib/nokogiri/ffi/xml/schema.rb +17 -0
  61. data/lib/nokogiri/ffi/xml/syntax_error.rb +4 -4
  62. data/lib/nokogiri/ffi/xml/xpath.rb +0 -10
  63. data/lib/nokogiri/ffi/xml/xpath_context.rb +22 -9
  64. data/lib/nokogiri/ffi/xslt/stylesheet.rb +3 -0
  65. data/lib/nokogiri/html/document.rb +5 -3
  66. data/lib/nokogiri/html/document_fragment.rb +28 -7
  67. data/lib/nokogiri/version.rb +6 -2
  68. data/lib/nokogiri/version_warning.rb +6 -3
  69. data/lib/nokogiri/xml.rb +1 -1
  70. data/lib/nokogiri/xml/builder.rb +35 -22
  71. data/lib/nokogiri/xml/document.rb +44 -12
  72. data/lib/nokogiri/xml/document_fragment.rb +16 -12
  73. data/lib/nokogiri/xml/entity_decl.rb +4 -0
  74. data/lib/nokogiri/xml/node.rb +152 -95
  75. data/lib/nokogiri/xml/node_set.rb +2 -1
  76. data/lib/nokogiri/xml/sax/push_parser.rb +1 -1
  77. data/lib/nokogiri/xml/schema.rb +1 -5
  78. data/lib/nokogiri/xml/syntax_error.rb +4 -0
  79. data/lib/nokogiri/xml/text.rb +9 -0
  80. data/lib/nokogiri/xml/xpath/syntax_error.rb +3 -0
  81. data/tasks/cross_compile.rb +158 -0
  82. data/tasks/test.rb +0 -6
  83. data/test/css/test_xpath_visitor.rb +9 -0
  84. data/test/helper.rb +49 -11
  85. data/test/html/sax/test_parser.rb +11 -1
  86. data/test/html/test_document.rb +8 -0
  87. data/test/html/test_document_fragment.rb +14 -2
  88. data/test/html/test_element_description.rb +5 -1
  89. data/test/html/test_node.rb +5 -66
  90. data/test/test_reader.rb +28 -0
  91. data/test/test_xslt_transforms.rb +14 -0
  92. data/test/xml/test_builder.rb +43 -0
  93. data/test/xml/test_cdata.rb +12 -0
  94. data/test/xml/test_document.rb +74 -39
  95. data/test/xml/test_document_fragment.rb +36 -0
  96. data/test/xml/test_entity_decl.rb +37 -0
  97. data/test/xml/test_node.rb +192 -65
  98. data/test/xml/test_node_reparenting.rb +253 -236
  99. data/test/xml/test_node_set.rb +67 -0
  100. data/test/xml/test_text.rb +8 -0
  101. data/test/xml/test_xpath.rb +32 -0
  102. metadata +103 -48
  103. data.tar.gz.sig +0 -0
  104. data/ext/nokogiri/xml_xpath.c +0 -53
  105. data/ext/nokogiri/xml_xpath.h +0 -11
  106. data/lib/nokogiri/xml/fragment_handler.rb +0 -79
  107. metadata.gz.sig +0 -0
@@ -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
metadata.gz.sig DELETED
Binary file