nokogiri 1.6.3.1-x86-mingw32 → 1.6.4-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.

@@ -10,13 +10,12 @@ rule
10
10
  result = [val.first, val.last].flatten
11
11
  }
12
12
  | prefixless_combinator_selector { result = val.flatten }
13
- | simple_selector_1toN { result = val.flatten }
13
+ | optional_S simple_selector_1toN { result = [val.last].flatten }
14
14
  ;
15
15
  combinator
16
16
  : PLUS { result = :DIRECT_ADJACENT_SELECTOR }
17
17
  | GREATER { result = :CHILD_SELECTOR }
18
18
  | TILDE { result = :FOLLOWING_SELECTOR }
19
- | S { result = :DESCENDANT_SELECTOR }
20
19
  | DOUBLESLASH { result = :DESCENDANT_SELECTOR }
21
20
  | SLASH { result = :CHILD_SELECTOR }
22
21
  ;
@@ -50,6 +49,9 @@ rule
50
49
  : simple_selector combinator simple_selector_1toN {
51
50
  result = Node.new(val[1], [val.first, val.last])
52
51
  }
52
+ | simple_selector S simple_selector_1toN {
53
+ result = Node.new(:DESCENDANT_SELECTOR, [val.first, val.last])
54
+ }
53
55
  | simple_selector
54
56
  ;
55
57
  class
@@ -241,6 +243,10 @@ rule
241
243
  | element_name hcap_1toN
242
244
  | hcap_1toN
243
245
  ;
246
+ optional_S
247
+ : S
248
+ |
249
+ ;
244
250
  end
245
251
 
246
252
  ---- header
@@ -94,7 +94,7 @@ class Tokenizer # :nodoc:
94
94
  when (text = @ss.scan(/[\s]*\)/))
95
95
  action { [:RPAREN, text] }
96
96
 
97
- when (text = @ss.scan(/[\s]*\[[\s]*/))
97
+ when (text = @ss.scan(/\[[\s]*/))
98
98
  action { [:LSQUARE, text] }
99
99
 
100
100
  when (text = @ss.scan(/[\s]*\]/))
@@ -34,7 +34,7 @@ rule
34
34
  {w}!={w} { [:NOT_EQUAL, text] }
35
35
  {w}={w} { [:EQUAL, text] }
36
36
  {w}\) { [:RPAREN, text] }
37
- {w}\[{w} { [:LSQUARE, text] }
37
+ \[{w} { [:LSQUARE, text] }
38
38
  {w}\] { [:RSQUARE, text] }
39
39
  {w}\+{w} { [:PLUS, text] }
40
40
  {w}>{w} { [:GREATER, text] }
@@ -1,6 +1,6 @@
1
1
  module Nokogiri
2
2
  # The version of Nokogiri you are using
3
- VERSION = '1.6.3.1'
3
+ VERSION = '1.6.4'
4
4
 
5
5
  class VersionInfo # :nodoc:
6
6
  def jruby?
@@ -61,6 +61,8 @@ module Nokogiri
61
61
  hash_info['libxml']['source'] = "packaged"
62
62
  hash_info['libxml']['libxml2_path'] = NOKOGIRI_LIBXML2_PATH
63
63
  hash_info['libxml']['libxslt_path'] = NOKOGIRI_LIBXSLT_PATH
64
+ hash_info['libxml']['libxml2_patches'] = NOKOGIRI_LIBXML2_PATCHES
65
+ hash_info['libxml']['libxslt_patches'] = NOKOGIRI_LIBXSLT_PATCHES
64
66
  else
65
67
  hash_info['libxml']['source'] = "system"
66
68
  end
@@ -274,6 +274,11 @@ module Nokogiri
274
274
  @parser.parse('a:active.foo')
275
275
  end
276
276
 
277
+ def test_significant_space
278
+ assert_xpath "//x//*[count(preceding-sibling::*) = 0]//*[@a]//*[@b]", @parser.parse("x :first-child [a] [b]")
279
+ assert_xpath "//*[@a]//*[@b]", @parser.parse(" [a] [b]")
280
+ end
281
+
277
282
  def test_star
278
283
  assert_xpath "//*", @parser.parse('*')
279
284
  assert_xpath "//*[contains(concat(' ', normalize-space(@class), ' '), ' pastoral ')]",
@@ -186,6 +186,23 @@ module Nokogiri
186
186
  ], @scanner)
187
187
  end
188
188
 
189
+ def test_significant_space
190
+ @scanner.scan('x :first-child [a] [b]')
191
+ assert_tokens([ [:IDENT, 'x'],
192
+ [:S, ' '],
193
+ [':', ':'],
194
+ [:IDENT, 'first-child'],
195
+ [:S, ' '],
196
+ [:LSQUARE, '['],
197
+ [:IDENT, 'a'],
198
+ [:RSQUARE, ']'],
199
+ [:S, ' '],
200
+ [:LSQUARE, '['],
201
+ [:IDENT, 'b'],
202
+ [:RSQUARE, ']'],
203
+ ], @scanner)
204
+ end
205
+
189
206
  def assert_tokens(tokens, scanner)
190
207
  toks = []
191
208
  while tok = @scanner.next_token
@@ -221,7 +221,7 @@ eohtml
221
221
  title = doc.at('/html/head/title')
222
222
  assert_not_nil title
223
223
  assert_equal 'new', title.text
224
- assert_equal -1, doc.at('meta[@http-equiv]') <=> title
224
+ assert_equal(-1, doc.at('meta[@http-equiv]') <=> title)
225
225
 
226
226
  doc = Nokogiri::HTML(<<eohtml)
227
227
  <html>
@@ -236,7 +236,7 @@ eohtml
236
236
  title = doc.at('/html//title')
237
237
  assert_not_nil title
238
238
  assert_equal 'new', title.text
239
- assert_equal -1, title <=> doc.at('body')
239
+ assert_equal(-1, title <=> doc.at('body'))
240
240
 
241
241
  doc = Nokogiri::HTML(<<eohtml)
242
242
  <html>
@@ -248,14 +248,14 @@ eohtml
248
248
  eohtml
249
249
  doc.title = 'new'
250
250
  assert_equal 'new', doc.title
251
- assert_equal -1, doc.at('meta[@charset]') <=> doc.at('title')
252
- assert_equal -1, doc.at('title') <=> doc.at('body')
251
+ assert_equal(-1, doc.at('meta[@charset]') <=> doc.at('title'))
252
+ assert_equal(-1, doc.at('title') <=> doc.at('body'))
253
253
 
254
254
  doc = Nokogiri::HTML('<!DOCTYPE html><p>hello')
255
255
  doc.title = 'new'
256
256
  assert_equal 'new', doc.title
257
257
  assert_instance_of Nokogiri::XML::DTD, doc.children.first
258
- assert_equal -1, doc.at('title') <=> doc.at('p')
258
+ assert_equal(-1, doc.at('title') <=> doc.at('p'))
259
259
 
260
260
  doc = Nokogiri::HTML('')
261
261
  doc.title = 'new'
@@ -230,6 +230,11 @@ module Nokogiri
230
230
  fragment.to_s)
231
231
  end
232
232
 
233
+ def test_element_children_counts
234
+ doc = Nokogiri::HTML::DocumentFragment.parse(" <div> </div>\n ")
235
+ assert doc.element_children.count == 1
236
+ end
237
+
233
238
  def test_malformed_fragment_is_corrected
234
239
  fragment = HTML::DocumentFragment.parse("<div </div>")
235
240
  assert_equal "<div></div>", fragment.to_s
@@ -14,7 +14,7 @@ module Nokogiri
14
14
  end
15
15
 
16
16
  def test_builder_multiple_nodes
17
- builder = Nokogiri::XML::Builder.new do |xml|
17
+ Nokogiri::XML::Builder.new do |xml|
18
18
  0.upto(10) do
19
19
  xml.text "test"
20
20
  end
@@ -54,7 +54,7 @@ module Nokogiri
54
54
  root << txt
55
55
  root << ent
56
56
  d << root
57
- assert_match /&#8217;/, d.to_html
57
+ assert_match(/&#8217;/, d.to_html)
58
58
  end
59
59
 
60
60
  def test_document_with_initial_space
@@ -376,14 +376,6 @@ module Nokogiri
376
376
  end
377
377
  end
378
378
 
379
- def test_prepend_child_fragment_with_multiple_nodes
380
- doc = Nokogiri::XML::Document.new
381
- fragment = doc.fragment('<hello /><goodbye />')
382
- assert_raises(RuntimeError) do
383
- doc.prepend_child fragment
384
- end
385
- end
386
-
387
379
  def test_prepend_child_with_multiple_roots
388
380
  assert_raises(RuntimeError) do
389
381
  @xml.prepend_child Node.new('foo', @xml)
@@ -26,7 +26,7 @@ EOF
26
26
  doc = Nokogiri::XML xml
27
27
  lf_node = Nokogiri::XML::EntityReference.new(doc, "#xa")
28
28
  doc.xpath('/item').first.add_child(lf_node)
29
- assert_match /&#xa;/, doc.to_xml
29
+ assert_match(/&#xa;/, doc.to_xml)
30
30
  end
31
31
  end
32
32
 
@@ -236,9 +236,15 @@ EOF
236
236
  reader = Nokogiri::XML::Reader html, path do |cfg|
237
237
  cfg.default_xml
238
238
  end
239
- assert_raises(Nokogiri::XML::SyntaxError) do
240
- reader.each { |n| n }
239
+ if Nokogiri.uses_libxml? && Nokogiri::LIBXML_PARSER_VERSION.to_i >= 20900
240
+ # Unknown entity is not fatal in libxml2 >= 2.9
241
+ assert_equal 8, reader.count
242
+ else
243
+ assert_raises(Nokogiri::XML::SyntaxError) {
244
+ assert_equal 5, reader.count
245
+ }
241
246
  end
247
+ assert_operator reader.errors.size, :>, 0
242
248
  end
243
249
  end
244
250
  end
@@ -858,7 +858,7 @@ b"></div>
858
858
  ne = d1.root.xpath('//a').first.dup(1)
859
859
  ne.content += "& < & > \" &"
860
860
  d2.root << ne
861
- assert_match /<a>&amp;&amp; &lt; &amp; &gt; \" &amp;<\/a>/, d2.to_s
861
+ assert_match(/<a>&amp;&amp; &lt; &amp; &gt; \" &amp;<\/a>/, d2.to_s)
862
862
  end
863
863
 
864
864
  def test_content_after_appending_text
@@ -7,6 +7,24 @@ module Nokogiri
7
7
  error = Nokogiri::XML::SyntaxError.new 'hello'
8
8
  assert_equal 'hello', error.message
9
9
  end
10
+
11
+ def test_pushing_to_array
12
+ reader = Nokogiri::XML::Reader(StringIO.new('&bogus;'))
13
+ assert_raises(SyntaxError) {
14
+ reader.read
15
+ }
16
+ assert_equal [SyntaxError], reader.errors.map(&:class) unless Nokogiri.jruby? # needs investigation
17
+ end
18
+
19
+ def test_pushing_to_non_array
20
+ reader = Nokogiri::XML::Reader(StringIO.new('&bogus;'))
21
+ def reader.errors
22
+ 1
23
+ end
24
+ assert_raises(TypeError) {
25
+ reader.read
26
+ }
27
+ end unless Nokogiri.jruby? # which does not internally call `errors`
10
28
  end
11
29
  end
12
30
  end
@@ -156,6 +156,8 @@ module Nokogiri
156
156
 
157
157
  # issue #741 (xpath() around 10x slower in JRuby)
158
158
  def test_slow_jruby_xpath
159
+ skip("MRI will exceed this timeout when running under valgrind") unless Nokogiri.jruby?
160
+
159
161
  doc = Nokogiri::XML(File.open(XPATH_FILE))
160
162
  start = Time.now
161
163
 
data/test_all CHANGED
@@ -10,7 +10,7 @@
10
10
  # (e.g., 1.9.3's glob_helper). ["rake test:valgrind:suppression"]
11
11
  #
12
12
 
13
- RUBIES="ruby-1.9.3 ruby-1.9.2 ruby-2.0 ruby-2.1 jruby-1.7"
13
+ RUBIES="ruby-2.2.0-preview1 ruby-2.1 ruby-2.0.0-p481 ruby-1.9.3 jruby-1.7.15"
14
14
  TEST_LOG=test.log
15
15
  VALGRIND_LOG=valgrind.log
16
16
 
@@ -29,7 +29,7 @@ set -o errexit
29
29
 
30
30
  function rvm_use {
31
31
  current_ruby=$1
32
- rvm use "${1}@nokogiri" --create || rvm -v
32
+ rvm use "${1}@nokogiri" --create
33
33
  }
34
34
 
35
35
  function generate_parser_and_tokenizer {
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.6.3.1
4
+ version: 1.6.4
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Aaron Patterson
@@ -12,20 +12,20 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-07-22 00:00:00.000000000 Z
15
+ date: 2014-11-05 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: mini_portile
19
19
  requirement: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - '='
21
+ - - ~>
22
22
  - !ruby/object:Gem::Version
23
23
  version: 0.6.0
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - '='
28
+ - - ~>
29
29
  - !ruby/object:Gem::Version
30
30
  version: 0.6.0
31
31
  - !ruby/object:Gem::Dependency
@@ -174,14 +174,14 @@ dependencies:
174
174
  requirements:
175
175
  - - ~>
176
176
  - !ruby/object:Gem::Version
177
- version: '3.7'
177
+ version: '3.13'
178
178
  type: :development
179
179
  prerelease: false
180
180
  version_requirements: !ruby/object:Gem::Requirement
181
181
  requirements:
182
182
  - - ~>
183
183
  - !ruby/object:Gem::Version
184
- version: '3.7'
184
+ version: '3.13'
185
185
  description: |-
186
186
  Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. Among Nokogiri's
187
187
  many features is the ability to search documents via XPath or CSS3 selectors.
@@ -513,7 +513,7 @@ licenses:
513
513
  - MIT
514
514
  metadata: {}
515
515
  post_install_message: |
516
- Nokogiri is built with the packaged libraries: libxml2-2.8.0, libxslt-1.1.28, zlib-1.2.8, libiconv-1.14.
516
+ Nokogiri is built with the packaged libraries: libxml2-2.9.2, libxslt-1.1.28, zlib-1.2.8, libiconv-1.14.
517
517
  rdoc_options:
518
518
  - --main
519
519
  - README.rdoc
@@ -530,8 +530,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
530
530
  - !ruby/object:Gem::Version
531
531
  version: '0'
532
532
  requirements: []
533
- rubyforge_project: nokogiri
534
- rubygems_version: 2.2.2
533
+ rubyforge_project:
534
+ rubygems_version: 2.4.2
535
535
  signing_key:
536
536
  specification_version: 4
537
537
  summary: Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser