nokogiri 1.6.4.1-x64-mingw32 → 1.6.5-x64-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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a67713ef58d3ff42436697122ad70f58cfcdafb0
4
- data.tar.gz: 40873a5c2f155345e36db002b69f662fda924425
3
+ metadata.gz: dce098a9830086f0b961036a06291b1d35873313
4
+ data.tar.gz: 32153b0d7caf19bbfae65c2342b8b5d318950831
5
5
  SHA512:
6
- metadata.gz: a942253238058275631e755fcbfeb12d50242802799fc2afa31056e5a6b5df81e9e0e4f204d086d7a9ae6e0419e12c3788b45320d087971ffab0b2dfe7f6a31e
7
- data.tar.gz: 9f35d6e82475d1dd57d850d0321dcc1e0ae3d51a030d12f3f0499c4aa6a93b1223d6af68c4276a8ff3c08625b16022049426390a20c218b8c3b4dd784ae854cc
6
+ metadata.gz: 66268301e8c0efc342e7f46f099ac7572dfa578adc9d721de18960b99a114f151866a1e67f090d0a5cbf4f1b39a8989717c49a2e75f525590ac90579c579b410
7
+ data.tar.gz: 0864d5bc9bb15fbdadcca046e987845387c80544c80a44cc957d255e7bf6f5a05472bb7d8a6409f72270700770fa03ac9a1468a9d80ce727a22f6adc2cbc7fdf
@@ -1,6 +1,20 @@
1
+ === 1.6.5 / 未リリース
2
+
3
+ ==== 機能
4
+
5
+ * Slop#respond_to_missing? を実装 (#1176)
6
+ * Optimized the XPath query generated by an `an+b` CSS query.
7
+
8
+
9
+ ==== バグ修正
10
+
11
+ * Capture non-parse errors from Document#dup in Document#errors. (#1196)
12
+ * (JRuby) Document#canonicalize parameters are now consistent with MRI. (#1189)
13
+
14
+
1
15
  === 1.6.4.1 / 2014年11月5日
2
16
 
3
- ==== Bug fixes
17
+ ==== バグ修正
4
18
 
5
19
  * (MRI) 渡したCFLAGSが反映されないバグを修正 (#1188)
6
20
  * CSSセレクタの :nth(n) が動かなかったのを修正 (#1187)
@@ -1,3 +1,17 @@
1
+ === 1.6.5 / unreleased
2
+
3
+ ==== Features
4
+
5
+ * Implement Slop#respond_to_missing?. (#1176)
6
+ * Optimized the XPath query generated by an `an+b` CSS query.
7
+
8
+
9
+ ==== Bug fixes
10
+
11
+ * Capture non-parse errors from Document#dup in Document#errors. (#1196)
12
+ * (JRuby) Document#canonicalize parameters are now consistent with MRI. (#1189)
13
+
14
+
1
15
  === 1.6.4.1 / 2014-11-05
2
16
 
3
17
  ==== Bug fixes
@@ -317,21 +317,29 @@ static VALUE read_memory( VALUE klass,
317
317
  * Copy this Document. An optional depth may be passed in, but it defaults
318
318
  * to a deep copy. 0 is a shallow copy, 1 is a deep copy.
319
319
  */
320
- static VALUE duplicate_node(int argc, VALUE *argv, VALUE self)
320
+ static VALUE duplicate_document(int argc, VALUE *argv, VALUE self)
321
321
  {
322
322
  xmlDocPtr doc, dup;
323
+ VALUE copy;
323
324
  VALUE level;
325
+ VALUE error_list = rb_ary_new();
324
326
 
325
327
  if(rb_scan_args(argc, argv, "01", &level) == 0)
326
328
  level = INT2NUM((long)1);
327
329
 
328
330
  Data_Get_Struct(self, xmlDoc, doc);
329
331
 
332
+ xmlResetLastError();
333
+ xmlSetStructuredErrorFunc((void *)error_list, Nokogiri_error_array_pusher);
330
334
  dup = xmlCopyDoc(doc, (int)NUM2INT(level));
335
+ xmlSetStructuredErrorFunc(NULL, NULL);
336
+
331
337
  if(dup == NULL) return Qnil;
332
338
 
333
339
  dup->type = doc->type;
334
- return Nokogiri_wrap_xml_document(rb_obj_class(self), dup);
340
+ copy = Nokogiri_wrap_xml_document(rb_obj_class(self), dup);
341
+ rb_iv_set(copy, "@errors", error_list);
342
+ return copy ;
335
343
  }
336
344
 
337
345
  /*
@@ -566,7 +574,7 @@ void init_xml_document()
566
574
  rb_define_method(klass, "encoding=", set_encoding, 1);
567
575
  rb_define_method(klass, "version", version, 0);
568
576
  rb_define_method(klass, "canonicalize", canonicalize, -1);
569
- rb_define_method(klass, "dup", duplicate_node, -1);
577
+ rb_define_method(klass, "dup", duplicate_document, -1);
570
578
  rb_define_method(klass, "url", url, 0);
571
579
  rb_define_method(klass, "create_entity", create_entity, -1);
572
580
  rb_define_method(klass, "remove_namespaces!", remove_namespaces_bang, 0);
Binary file
Binary file
@@ -183,11 +183,15 @@ module Nokogiri
183
183
  options[:last] ? "(last()-position()+1)" : "position()"
184
184
  end
185
185
 
186
- if (b == 0)
187
- return "(#{position} mod #{a}) = 0"
186
+ if b.zero?
187
+ "(#{position} mod #{a}) = 0"
188
188
  else
189
- compare = (a < 0) ? "<=" : ">="
190
- return "(#{position} #{compare} #{b}) and (((#{position}-#{b}) mod #{a.abs}) = 0)"
189
+ compare = a < 0 ? "<=" : ">="
190
+ if a.abs == 1
191
+ "#{position} #{compare} #{b}"
192
+ else
193
+ "(#{position} #{compare} #{b}) and (((#{position}-#{b}) mod #{a.abs}) = 0)"
194
+ end
191
195
  end
192
196
  end
193
197
 
@@ -30,6 +30,14 @@ module Nokogiri
30
30
  super if list.empty?
31
31
  list.length == 1 ? list.first : list
32
32
  end
33
+
34
+ def respond_to_missing? name, include_private = false
35
+ prefix = implied_xpath_context
36
+
37
+ list = xpath("#{prefix}#{name.to_s.sub(/^_/, '')}")
38
+
39
+ !list.empty?
40
+ end
33
41
  end
34
42
  end
35
43
  end
@@ -1,6 +1,6 @@
1
1
  module Nokogiri
2
2
  # The version of Nokogiri you are using
3
- VERSION = '1.6.4.1'
3
+ VERSION = '1.6.5'
4
4
 
5
5
  class VersionInfo # :nodoc:
6
6
  def jruby?
@@ -193,20 +193,20 @@ module Nokogiri
193
193
  assert_xpath '//a[(position() mod 2) = 0]', @parser.parse('a:nth-of-type(even)')
194
194
  assert_xpath '//a[(position() >= 1) and (((position()-1) mod 2) = 0)]', @parser.parse('a:nth-of-type(odd)')
195
195
  assert_xpath '//a[(position() >= 3) and (((position()-3) mod 4) = 0)]', @parser.parse('a:nth-of-type(4n+3)')
196
- assert_xpath '//a[(position() <= 3) and (((position()-3) mod 1) = 0)]', @parser.parse('a:nth-of-type(-1n+3)')
197
- assert_xpath '//a[(position() <= 3) and (((position()-3) mod 1) = 0)]', @parser.parse('a:nth-of-type(-n+3)')
198
- assert_xpath '//a[(position() >= 3) and (((position()-3) mod 1) = 0)]', @parser.parse('a:nth-of-type(1n+3)')
199
- assert_xpath '//a[(position() >= 3) and (((position()-3) mod 1) = 0)]', @parser.parse('a:nth-of-type(n+3)')
196
+ assert_xpath '//a[position() <= 3]', @parser.parse('a:nth-of-type(-1n+3)')
197
+ assert_xpath '//a[position() <= 3]', @parser.parse('a:nth-of-type(-n+3)')
198
+ assert_xpath '//a[position() >= 3]', @parser.parse('a:nth-of-type(1n+3)')
199
+ assert_xpath '//a[position() >= 3]', @parser.parse('a:nth-of-type(n+3)')
200
200
 
201
201
  assert_xpath '//a[((last()-position()+1) mod 2) = 0]', @parser.parse('a:nth-last-of-type(2n)')
202
202
  assert_xpath '//a[((last()-position()+1) >= 1) and ((((last()-position()+1)-1) mod 2) = 0)]', @parser.parse('a:nth-last-of-type(2n+1)')
203
203
  assert_xpath '//a[((last()-position()+1) mod 2) = 0]', @parser.parse('a:nth-last-of-type(even)')
204
204
  assert_xpath '//a[((last()-position()+1) >= 1) and ((((last()-position()+1)-1) mod 2) = 0)]', @parser.parse('a:nth-last-of-type(odd)')
205
205
  assert_xpath '//a[((last()-position()+1) >= 3) and ((((last()-position()+1)-3) mod 4) = 0)]', @parser.parse('a:nth-last-of-type(4n+3)')
206
- assert_xpath '//a[((last()-position()+1) <= 3) and ((((last()-position()+1)-3) mod 1) = 0)]', @parser.parse('a:nth-last-of-type(-1n+3)')
207
- assert_xpath '//a[((last()-position()+1) <= 3) and ((((last()-position()+1)-3) mod 1) = 0)]', @parser.parse('a:nth-last-of-type(-n+3)')
208
- assert_xpath '//a[((last()-position()+1) >= 3) and ((((last()-position()+1)-3) mod 1) = 0)]', @parser.parse('a:nth-last-of-type(1n+3)')
209
- assert_xpath '//a[((last()-position()+1) >= 3) and ((((last()-position()+1)-3) mod 1) = 0)]', @parser.parse('a:nth-last-of-type(n+3)')
206
+ assert_xpath '//a[(last()-position()+1) <= 3]', @parser.parse('a:nth-last-of-type(-1n+3)')
207
+ assert_xpath '//a[(last()-position()+1) <= 3]', @parser.parse('a:nth-last-of-type(-n+3)')
208
+ assert_xpath '//a[(last()-position()+1) >= 3]', @parser.parse('a:nth-last-of-type(1n+3)')
209
+ assert_xpath '//a[(last()-position()+1) >= 3]', @parser.parse('a:nth-last-of-type(n+3)')
210
210
  end
211
211
 
212
212
  def test_preceding_selector
@@ -9,8 +9,12 @@ module Nokogiri
9
9
  <description>this is the foo thing</description>
10
10
  </item>
11
11
  eoxml
12
- assert doc.item.title
13
- assert doc.item._description, 'should have description'
12
+ assert doc.item.respond_to?(:title)
13
+ assert_equal 'foo', doc.item.title.text
14
+ assert doc.item.respond_to?(:_description), 'should have description'
15
+ assert 'this is the foo thing', doc.item._description.text
16
+ assert !doc.item.respond_to?(:foo)
17
+ assert_raise(NoMethodError) { doc.item.foo }
14
18
  end
15
19
  end
16
20
  end
@@ -47,6 +47,19 @@ module Nokogiri
47
47
  end
48
48
  end
49
49
 
50
+ def stress_memory_while &block
51
+ # force the test to explicitly declare a skip
52
+ raise "JRuby doesn't do GC" if Nokogiri.jruby?
53
+
54
+ old_stress = GC.stress
55
+ begin
56
+ GC.stress = true
57
+ yield
58
+ ensure
59
+ GC.stress = old_stress
60
+ end
61
+ end
62
+
50
63
  def assert_indent amount, doc, message = nil
51
64
  nodes = []
52
65
  doc.traverse do |node|
@@ -452,8 +452,7 @@ eohtml
452
452
  end
453
453
 
454
454
  def test_content_size
455
- html = Nokogiri::HTML('<div>
456
- </div>')
455
+ html = Nokogiri::HTML("<div>\n</div>")
457
456
  assert_equal 1, html.content.size
458
457
  assert_equal 1, html.content.split("").size
459
458
  assert_equal "\n", html.content
@@ -520,7 +519,7 @@ eohtml
520
519
  end
521
520
 
522
521
  def test_inner_html
523
- html = Nokogiri::HTML(<<-eohtml)
522
+ html = Nokogiri::HTML <<-EOHTML
524
523
  <html>
525
524
  <body>
526
525
  <div>
@@ -530,9 +529,9 @@ eohtml
530
529
  </div>
531
530
  </body>
532
531
  </html>
533
- eohtml
534
- node = html.xpath('//div').first
535
- assert_equal('<p>Helloworld!</p>', node.inner_html.gsub(/\s/, ''))
532
+ EOHTML
533
+ node = html.xpath("//div").first
534
+ assert_equal("<p>Helloworld!</p>", node.inner_html.gsub(%r{\s}, ""))
536
535
  end
537
536
 
538
537
  def test_round_trip
@@ -613,6 +612,15 @@ eohtml
613
612
  assert_equal "", Nokogiri::HTML.parse(nil).text
614
613
  assert_equal "", Nokogiri::HTML.parse("").text
615
614
  end
615
+
616
+ def test_capturing_nonparse_errors_during_clone
617
+ # see https://github.com/sparklemotion/nokogiri/issues/1196 for background
618
+ original = Nokogiri::HTML.parse("<div id='unique'></div><div id='unique'></div>")
619
+ original_errors = original.errors
620
+
621
+ copy = original.dup
622
+ assert_equal original_errors, copy.errors
623
+ end
616
624
  end
617
625
  end
618
626
  end
@@ -104,46 +104,65 @@ module Nokogiri
104
104
  def test_c14n_modes
105
105
  # http://www.w3.org/TR/xml-exc-c14n/#sec-Enveloping
106
106
 
107
- doc1 = Nokogiri.XML <<-eoxml
107
+ doc1 = Nokogiri.XML <<-EOXML
108
108
  <n0:local xmlns:n0="http://foobar.org" xmlns:n3="ftp://example.org">
109
109
  <n1:elem2 xmlns:n1="http://example.net" xml:lang="en">
110
110
  <n3:stuff xmlns:n3="ftp://example.org"/>
111
111
  </n1:elem2>
112
112
  </n0:local>
113
- eoxml
114
- doc2 = Nokogiri.XML <<-eoxml
113
+ EOXML
114
+
115
+ doc2 = Nokogiri.XML <<-EOXML
115
116
  <n2:pdu xmlns:n1="http://example.com"
116
117
  xmlns:n2="http://foo.example"
118
+ xmlns:n4="http://foo.example"
117
119
  xml:lang="fr"
118
120
  xml:space="retain">
119
121
  <n1:elem2 xmlns:n1="http://example.net" xml:lang="en">
120
122
  <n3:stuff xmlns:n3="ftp://example.org"/>
123
+ <n4:stuff />
121
124
  </n1:elem2>
122
125
  </n2:pdu>
123
- eoxml
126
+ EOXML
124
127
 
125
128
  c14n = doc1.at_xpath('//n1:elem2', {'n1' => 'http://example.net'}).canonicalize
126
129
  assert_equal '<n1:elem2 xmlns:n0="http://foobar.org" xmlns:n1="http://example.net" xmlns:n3="ftp://example.org" xml:lang="en">
127
130
  <n3:stuff></n3:stuff>
128
131
  </n1:elem2>', c14n
129
- c14n = doc2.at_xpath('//n1:elem2', {'n1' => 'http://example.net'}).canonicalize
130
- assert_equal '<n1:elem2 xmlns:n1="http://example.net" xmlns:n2="http://foo.example" xml:lang="en" xml:space="retain">
132
+
133
+ expected = '<n1:elem2 xmlns:n1="http://example.net" xmlns:n2="http://foo.example" xmlns:n4="http://foo.example" xml:lang="en" xml:space="retain">
131
134
  <n3:stuff xmlns:n3="ftp://example.org"></n3:stuff>
132
- </n1:elem2>', c14n
135
+ <n4:stuff></n4:stuff>
136
+ </n1:elem2>'
137
+ c14n = doc2.at_xpath('//n1:elem2', {'n1' => 'http://example.net'}).canonicalize
138
+ assert_equal expected, c14n
133
139
 
134
- excl_c14n = '<n1:elem2 xmlns:n1="http://example.net" xml:lang="en">
140
+ expected = '<n1:elem2 xmlns:n1="http://example.net" xml:lang="en">
135
141
  <n3:stuff xmlns:n3="ftp://example.org"></n3:stuff>
136
142
  </n1:elem2>'
137
143
  c14n = doc1.at_xpath('//n1:elem2', {'n1' => 'http://example.net'}).canonicalize(XML::XML_C14N_EXCLUSIVE_1_0)
138
- assert_equal excl_c14n, c14n
144
+ assert_equal expected, c14n
145
+
146
+ expected = '<n1:elem2 xmlns:n1="http://example.net" xml:lang="en">
147
+ <n3:stuff xmlns:n3="ftp://example.org"></n3:stuff>
148
+ <n4:stuff xmlns:n4="http://foo.example"></n4:stuff>
149
+ </n1:elem2>'
139
150
  c14n = doc2.at_xpath('//n1:elem2', {'n1' => 'http://example.net'}).canonicalize(XML::XML_C14N_EXCLUSIVE_1_0)
140
- assert_equal excl_c14n, c14n
151
+ assert_equal expected, c14n
141
152
 
142
- c14n = doc2.at_xpath('//n1:elem2', {'n1' => 'http://example.net'}).canonicalize(XML::XML_C14N_EXCLUSIVE_1_0, ['n2'])
143
- assert_equal '<n1:elem2 xmlns:n1="http://example.net" xmlns:n2="http://foo.example" xml:lang="en">
153
+ expected = '<n1:elem2 xmlns:n1="http://example.net" xmlns:n2="http://foo.example" xml:lang="en">
144
154
  <n3:stuff xmlns:n3="ftp://example.org"></n3:stuff>
145
- </n1:elem2>', c14n
155
+ <n4:stuff xmlns:n4="http://foo.example"></n4:stuff>
156
+ </n1:elem2>'
157
+ c14n = doc2.at_xpath('//n1:elem2', {'n1' => 'http://example.net'}).canonicalize(XML::XML_C14N_EXCLUSIVE_1_0, ['n2'])
158
+ assert_equal expected, c14n
146
159
 
160
+ expected = '<n1:elem2 xmlns:n1="http://example.net" xmlns:n2="http://foo.example" xmlns:n4="http://foo.example" xml:lang="en">
161
+ <n3:stuff xmlns:n3="ftp://example.org"></n3:stuff>
162
+ <n4:stuff></n4:stuff>
163
+ </n1:elem2>'
164
+ c14n = doc2.at_xpath('//n1:elem2', {'n1' => 'http://example.net'}).canonicalize(XML::XML_C14N_EXCLUSIVE_1_0, ['n2', 'n4'])
165
+ assert_equal expected, c14n
147
166
  end
148
167
 
149
168
  def test_wrong_params
@@ -100,12 +100,8 @@ module Nokogiri
100
100
  text = Nokogiri::XML::Text.new 'bar', document
101
101
  attribute.add_child(text)
102
102
 
103
- begin
104
- gc_previous = GC.stress
105
- GC.stress = true
103
+ stress_memory_while do
106
104
  node['visible'] = 'attr'
107
- ensure
108
- GC.stress = gc_previous
109
105
  end
110
106
  end
111
107
  end
@@ -123,17 +123,11 @@ module Nokogiri
123
123
 
124
124
  def test_value_lookup_segfault
125
125
  skip("JRuby doesn't do GC.") if Nokogiri.jruby?
126
- old_stress = GC.stress
127
-
128
- begin
129
- GC.stress = true
130
-
126
+ stress_memory_while do
131
127
  while node = @reader.read
132
128
  nodes = node.send(:attr_nodes)
133
129
  nodes.first.name if nodes.first
134
130
  end
135
- ensure
136
- GC.stress = old_stress
137
131
  end
138
132
  end
139
133
  end
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.4.1
4
+ version: 1.6.5
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Aaron Patterson
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2014-11-07 00:00:00.000000000 Z
15
+ date: 2014-11-26 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: mini_portile