nokogiri 1.0.6 → 1.0.7

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 (44) hide show
  1. data/History.ja.txt +11 -0
  2. data/History.txt +11 -0
  3. data/Manifest.txt +7 -0
  4. data/README.txt +7 -0
  5. data/Rakefile +43 -2
  6. data/ext/nokogiri/native.c +1 -0
  7. data/ext/nokogiri/native.h +1 -2
  8. data/ext/nokogiri/xml_cdata.c +3 -1
  9. data/ext/nokogiri/xml_comment.c +42 -0
  10. data/ext/nokogiri/xml_comment.h +9 -0
  11. data/ext/nokogiri/xml_document.c +1 -0
  12. data/ext/nokogiri/xml_node.c +21 -7
  13. data/ext/nokogiri/xml_sax_parser.c +26 -0
  14. data/ext/nokogiri/xml_syntax_error.c +4 -0
  15. data/ext/nokogiri/xml_text.c +16 -1
  16. data/ext/nokogiri/xml_xpath_context.c +4 -0
  17. data/ext/nokogiri/xslt_stylesheet.c +1 -1
  18. data/lib/action-nokogiri.rb +30 -0
  19. data/lib/nokogiri.rb +25 -4
  20. data/lib/nokogiri/css.rb +9 -4
  21. data/lib/nokogiri/css/generated_parser.rb +199 -171
  22. data/lib/nokogiri/css/parser.rb +11 -0
  23. data/lib/nokogiri/css/parser.y +16 -0
  24. data/lib/nokogiri/decorators.rb +1 -0
  25. data/lib/nokogiri/decorators/slop.rb +31 -0
  26. data/lib/nokogiri/hpricot.rb +2 -4
  27. data/lib/nokogiri/version.rb +1 -1
  28. data/lib/nokogiri/xml.rb +15 -0
  29. data/lib/nokogiri/xml/builder.rb +1 -1
  30. data/lib/nokogiri/xml/comment.rb +6 -0
  31. data/lib/nokogiri/xml/document.rb +22 -8
  32. data/lib/nokogiri/xml/sax/parser.rb +7 -3
  33. data/test/css/test_parser.rb +9 -0
  34. data/test/helper.rb +4 -1
  35. data/test/hpricot/load_files.rb +8 -4
  36. data/test/test_css_cache.rb +17 -10
  37. data/test/test_memory_leak.rb +38 -0
  38. data/test/test_nokogiri.rb +61 -0
  39. data/test/xml/sax/test_parser.rb +2 -0
  40. data/test/xml/test_comment.rb +16 -0
  41. data/test/xml/test_document.rb +2 -4
  42. data/test/xml/test_node.rb +13 -0
  43. data/vendor/hoe.rb +8 -22
  44. metadata +12 -3
@@ -13,12 +13,14 @@ module Nokogiri
13
13
  @parser.parse(f)
14
14
  }
15
15
  @parser.parse(File.read(XML_FILE))
16
+ assert(@parser.document.cdata_blocks.length > 0)
16
17
  end
17
18
 
18
19
  def test_parse_io
19
20
  File.open(XML_FILE, 'rb') { |f|
20
21
  @parser.parse_io(f)
21
22
  }
23
+ assert(@parser.document.cdata_blocks.length > 0)
22
24
  end
23
25
 
24
26
  def test_parse_file
@@ -0,0 +1,16 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', "helper"))
2
+
3
+ module Nokogiri
4
+ module XML
5
+ class TestComment < Nokogiri::TestCase
6
+ def setup
7
+ @xml = Nokogiri::XML.parse(File.read(XML_FILE), XML_FILE)
8
+ end
9
+
10
+ def test_new
11
+ comment = Nokogiri::XML::Comment.new(@xml, 'hello world')
12
+ assert_equal('<!--hello world-->', comment.to_s)
13
+ end
14
+ end
15
+ end
16
+ end
@@ -186,10 +186,8 @@ module Nokogiri
186
186
  end
187
187
 
188
188
  def util_decorate(document, x)
189
- document.decorators['document'] << x
190
- document.decorators['node'] << x
191
- document.decorators['element'] << x
192
- document.decorators['nodeset'] << x
189
+ document.decorators(XML::Node) << x
190
+ document.decorators(XML::NodeSet) << x
193
191
  document.decorate!
194
192
  end
195
193
  end
@@ -3,6 +3,19 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', "helper"))
3
3
  module Nokogiri
4
4
  module XML
5
5
  class TestNode < Nokogiri::TestCase
6
+ def test_add_previous_sibling
7
+ xml = Nokogiri::XML(<<-eoxml)
8
+ <root>
9
+ <a>Hello world</a>
10
+ </root>
11
+ eoxml
12
+ b_node = Nokogiri::XML::Node.new('a', xml)
13
+ b_node.content = 'first'
14
+ a_node = xml.xpath('//a').first
15
+ a_node.add_previous_sibling(b_node)
16
+ assert_equal('first', xml.xpath('//a').first.text)
17
+ end
18
+
6
19
  def test_find_by_css_with_tilde_eql
7
20
  xml = Nokogiri::XML.parse(<<-eoxml)
8
21
  <root>
@@ -444,9 +444,13 @@ class Hoe
444
444
  desc 'Run the default tasks.'
445
445
  task :default => :test
446
446
 
447
- desc 'Run the test suite. Use FILTER to add to the command line.'
448
- task :test do
449
- run_tests
447
+ Rake::TestTask.new do |t|
448
+ %w[ ext lib bin test ].each do |dir|
449
+ t.libs << dir
450
+ end
451
+ t.test_files = FileList['test/**/test_*.rb'] +
452
+ FileList['test/**/*_test.rb']
453
+ t.verbose = true
450
454
  end
451
455
 
452
456
  desc 'Show which test files fail when run alone.'
@@ -465,7 +469,7 @@ class Hoe
465
469
 
466
470
  desc 'Run the test suite using multiruby.'
467
471
  task :multi do
468
- run_tests :multi
472
+ sh "multiruby -S rake clean test"
469
473
  end
470
474
 
471
475
  ############################################################
@@ -976,24 +980,6 @@ class Hoe
976
980
  return subject, title, body, urls
977
981
  end
978
982
 
979
- def run_tests(multi=false) # :nodoc:
980
- msg = multi ? :sh : :ruby
981
- cmd = if test ?f, 'test/test_all.rb' then
982
- "#{RUBY_FLAGS} test/test_all.rb #{FILTER}"
983
- else
984
- tests = ["rubygems", self.testlib] +
985
- test_globs.map { |g| Dir.glob(g) }.flatten
986
- tests.map! {|f| %Q(require "#{f}")}
987
- "#{RUBY_FLAGS} -e '#{tests.join("; ")}' #{FILTER}"
988
- end
989
-
990
- excludes = multiruby_skip.join(":")
991
- ENV['EXCLUDED_VERSIONS'] = excludes
992
- cmd = "multiruby #{cmd}" if multi
993
-
994
- send msg, cmd
995
- end
996
-
997
983
  ##
998
984
  # Reads a file at +path+ and spits out an array of the +paragraphs+ specified.
999
985
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2008-11-14 00:00:00 -08:00
13
+ date: 2008-12-02 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies: []
16
16
 
@@ -21,7 +21,7 @@ email:
21
21
  executables: []
22
22
 
23
23
  extensions:
24
- - Rakefile
24
+ - ext/nokogiri/extconf.rb
25
25
  extra_rdoc_files:
26
26
  - History.ja.txt
27
27
  - History.txt
@@ -44,6 +44,8 @@ files:
44
44
  - ext/nokogiri/native.h
45
45
  - ext/nokogiri/xml_cdata.c
46
46
  - ext/nokogiri/xml_cdata.h
47
+ - ext/nokogiri/xml_comment.c
48
+ - ext/nokogiri/xml_comment.h
47
49
  - ext/nokogiri/xml_document.c
48
50
  - ext/nokogiri/xml_document.h
49
51
  - ext/nokogiri/xml_dtd.c
@@ -68,6 +70,7 @@ files:
68
70
  - ext/nokogiri/xml_xpath_context.h
69
71
  - ext/nokogiri/xslt_stylesheet.c
70
72
  - ext/nokogiri/xslt_stylesheet.h
73
+ - lib/action-nokogiri.rb
71
74
  - lib/nokogiri.rb
72
75
  - lib/nokogiri/css.rb
73
76
  - lib/nokogiri/css/generated_parser.rb
@@ -84,6 +87,7 @@ files:
84
87
  - lib/nokogiri/decorators/hpricot/node.rb
85
88
  - lib/nokogiri/decorators/hpricot/node_set.rb
86
89
  - lib/nokogiri/decorators/hpricot/xpath_visitor.rb
90
+ - lib/nokogiri/decorators/slop.rb
87
91
  - lib/nokogiri/hpricot.rb
88
92
  - lib/nokogiri/html.rb
89
93
  - lib/nokogiri/html/builder.rb
@@ -95,6 +99,7 @@ files:
95
99
  - lib/nokogiri/xml/before_handler.rb
96
100
  - lib/nokogiri/xml/builder.rb
97
101
  - lib/nokogiri/xml/cdata.rb
102
+ - lib/nokogiri/xml/comment.rb
98
103
  - lib/nokogiri/xml/document.rb
99
104
  - lib/nokogiri/xml/dtd.rb
100
105
  - lib/nokogiri/xml/element.rb
@@ -145,12 +150,14 @@ files:
145
150
  - test/test_convert_xpath.rb
146
151
  - test/test_css_cache.rb
147
152
  - test/test_gc.rb
153
+ - test/test_memory_leak.rb
148
154
  - test/test_nokogiri.rb
149
155
  - test/test_reader.rb
150
156
  - test/test_xslt_transforms.rb
151
157
  - test/xml/sax/test_parser.rb
152
158
  - test/xml/test_builder.rb
153
159
  - test/xml/test_cdata.rb
160
+ - test/xml/test_comment.rb
154
161
  - test/xml/test_document.rb
155
162
  - test/xml/test_dtd.rb
156
163
  - test/xml/test_node.rb
@@ -202,12 +209,14 @@ test_files:
202
209
  - test/test_convert_xpath.rb
203
210
  - test/test_css_cache.rb
204
211
  - test/test_gc.rb
212
+ - test/test_memory_leak.rb
205
213
  - test/test_nokogiri.rb
206
214
  - test/test_reader.rb
207
215
  - test/test_xslt_transforms.rb
208
216
  - test/xml/sax/test_parser.rb
209
217
  - test/xml/test_builder.rb
210
218
  - test/xml/test_cdata.rb
219
+ - test/xml/test_comment.rb
211
220
  - test/xml/test_document.rb
212
221
  - test/xml/test_dtd.rb
213
222
  - test/xml/test_node.rb