nokogiri 1.10.0 → 1.10.1

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
  SHA256:
3
- metadata.gz: 18bb8a03de528a72a8c0c68ea5e7530ea6ae9fe0d7affb831bf94eaa75b0a256
4
- data.tar.gz: a997d0ecbc481a79e1a873fa1351b29db6ae2ce2839ae09fa711525fae3d34b5
3
+ metadata.gz: ac43bbc311b7a753e3127e21b02ddc66c844c7831e1a7f3b278e16de48ecf12b
4
+ data.tar.gz: 4abe8a5a0374101f9831a7d97e825abb6e43bf62e73535370d52a029a16aec6a
5
5
  SHA512:
6
- metadata.gz: ccaac7b81396074dbdd660794dbb46f47c222ba10ab7dc9e672f5d87d02308165e5df0cb7cd3d05ae08332eb82558fa4409099c321c4dea0149af395a9ee84fb
7
- data.tar.gz: e8c7f43e049ba1bd450f2363693ff8ba515f925086056e59bb5fe86901b50ba8e519751f95b552de659268927c610508891ea1f71477e9758613bb4b0673451f
6
+ metadata.gz: 3fcaf321d4426fd1cafd21de42e02b8c247c50f2373099e9d78981231e73261175265c7c77ed57519aae9fa751cc86ec30ab78d98ed9557d3f5cfa98c8f04684
7
+ data.tar.gz: 07bd86c502206e5139d1a80179837a9d152d7d96788bdcc7495b8d20915f06be8d49975ba4ebe82d8a3c1969049840ed7bf744cac4417535ddb719e7d3d94922
data/README.md CHANGED
@@ -12,14 +12,16 @@ or CSS3 selectors.
12
12
  * http://nokogiri.org
13
13
  * [Installation Help](http://nokogiri.org/tutorials/installing_nokogiri.html)
14
14
  * [Tutorials](http://nokogiri.org)
15
+ * [Cheat Sheet](https://github.com/sparklemotion/nokogiri/wiki/Cheat-sheet)
15
16
  * [GitHub](https://github.com/sparklemotion/nokogiri)
16
17
  * [Mailing List](https://groups.google.com/group/nokogiri-talk)
17
- * [Bug Reports](https://github.com/sparklemotion/nokogiri/issues)
18
18
  * [Chat/Gitter](https://gitter.im/sparklemotion/nokogiri)
19
19
 
20
20
  [![Concourse CI](https://ci.nokogiri.org/api/v1/teams/nokogiri-core/pipelines/nokogiri/jobs/ruby-2.4-system/badge)](https://ci.nokogiri.org/teams/nokogiri-core/pipelines/nokogiri?groups=master)
21
+
21
22
  [![Code Climate](https://codeclimate.com/github/sparklemotion/nokogiri.svg)](https://codeclimate.com/github/sparklemotion/nokogiri)
22
- [![Join the chat at https://gitter.im/sparklemotion/nokogiri](https://badges.gitter.im/sparklemotion/nokogiri.svg)](https://gitter.im/sparklemotion/nokogiri?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
23
+ [![Gem Version](https://badge.fury.io/rb/nokogiri.svg)](https://rubygems.org/gems/nokogiri)
24
+ [![SemVer compatibility](https://api.dependabot.com/badges/compatibility_score?dependency-name=nokogiri&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score.html?dependency-name=nokogiri&package-manager=bundler&version-scheme=semver)
23
25
  [![Tidelift dependencies](https://tidelift.com/badges/github/sparklemotion/nokogiri)](https://tidelift.com/subscription/pkg/rubygems-nokogiri?utm_source=rubygems-nokogiri&utm_medium=referral&utm_campaign=readme)
24
26
 
25
27
 
@@ -177,6 +179,12 @@ explicitly setting the encoding to EUC-JP on the parser:
177
179
  bundle exec rake
178
180
  ```
179
181
 
182
+
183
+ ## Code of Conduct
184
+
185
+ We've adopted the Contributor Covenant code of conduct, which you can read in full in [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md).
186
+
187
+
180
188
  ## License
181
189
 
182
190
  This project is licensed under the terms of the MIT license.
@@ -392,6 +392,10 @@ when arg_config('--clean')
392
392
  do_clean
393
393
  end
394
394
 
395
+ if darwin?
396
+ ENV['CFLAGS'] = "#{ENV['CFLAGS']} -I /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2"
397
+ end
398
+
395
399
  if openbsd? && !using_system_libraries?
396
400
  if `#{ENV['CC'] || '/usr/bin/cc'} -v 2>&1` !~ /clang/
397
401
  ENV['CC'] ||= find_executable('egcc') or
@@ -51,10 +51,6 @@ static void relink_namespace(xmlNodePtr reparented)
51
51
 
52
52
  ns = xmlSearchNs(reparented->doc, reparented, prefix);
53
53
 
54
- if (ns == NULL && reparented->parent) {
55
- ns = xmlSearchNs(reparented->doc, reparented->parent, prefix);
56
- }
57
-
58
54
  if (ns != NULL) {
59
55
  xmlNodeSetName(reparented, name);
60
56
  xmlSetNs(reparented, ns);
@@ -1133,7 +1129,8 @@ static VALUE set_native_content(VALUE self, VALUE content)
1133
1129
  * call-seq:
1134
1130
  * content
1135
1131
  *
1136
- * Returns the content for this Node
1132
+ * Returns the plaintext content for this Node. Note that entities will always
1133
+ * be expanded in the returned string.
1137
1134
  */
1138
1135
  static VALUE get_native_content(VALUE self)
1139
1136
  {
@@ -165,7 +165,7 @@ static VALUE transform(int argc, VALUE* argv, VALUE self)
165
165
 
166
166
  errstr = rb_str_new(0, 0);
167
167
  xsltSetGenericErrorFunc((void *)errstr, xslt_generic_error_handler);
168
- xmlSetGenericErrorFunc(NULL, (xmlGenericErrorFunc)&swallow_superfluous_xml_errors);
168
+ xmlSetGenericErrorFunc((void *)errstr, xslt_generic_error_handler);
169
169
 
170
170
  result = xsltApplyStylesheet(wrapper->ss, xml, params);
171
171
  free(params);
@@ -51,7 +51,7 @@ module Nokogiri
51
51
  when /^comment\(/
52
52
  "comment()"
53
53
  when /^has\(/
54
- node.value[1].accept(self)
54
+ ".//#{node.value[1].accept(self)}"
55
55
  else
56
56
  args = ['.'] + node.value[1..-1]
57
57
  "#{node.value.first}#{args.join(', ')})"
@@ -1,6 +1,6 @@
1
1
  module Nokogiri
2
2
  # The version of Nokogiri you are using
3
- VERSION = '1.10.0'
3
+ VERSION = '1.10.1'
4
4
 
5
5
  class VersionInfo # :nodoc:
6
6
  def jruby?
@@ -41,7 +41,7 @@ module Nokogiri
41
41
  #
42
42
  # Nokogiri.XML() is a convenience method which will call this method.
43
43
  #
44
- def self.parse string_or_io, url = nil, encoding = nil, options = ParseOptions::DEFAULT_XML, &block
44
+ def self.parse string_or_io, url = nil, encoding = nil, options = ParseOptions::DEFAULT_XML
45
45
  options = Nokogiri::XML::ParseOptions.new(options) if Integer === options
46
46
  # Give the options to the user
47
47
  yield options if block_given?
@@ -495,7 +495,7 @@ module Nokogiri
495
495
  end
496
496
 
497
497
  ###
498
- # Returns a Hash of {prefix => value} for all namespaces on this
498
+ # Returns a Hash of +{prefix => value}+ for all namespaces on this
499
499
  # node and its ancestors.
500
500
  #
501
501
  # This method returns the same namespaces as #namespace_scopes.
@@ -807,7 +807,7 @@ module Nokogiri
807
807
  # Do xinclude substitution on the subtree below node. If given a block, a
808
808
  # Nokogiri::XML::ParseOptions object initialized from +options+, will be
809
809
  # passed to it, allowing more convenient modification of the parser options.
810
- def do_xinclude options = XML::ParseOptions::DEFAULT_XML, &block
810
+ def do_xinclude options = XML::ParseOptions::DEFAULT_XML
811
811
  options = Nokogiri::XML::ParseOptions.new(options) if Integer === options
812
812
 
813
813
  # give options to user
@@ -44,7 +44,7 @@ module Nokogiri
44
44
 
45
45
  ###
46
46
  # Returns the index of the first node in self that is == to +node+ or meets the given block. Returns nil if no match is found.
47
- def index(node = nil, &block)
47
+ def index(node = nil)
48
48
  if node
49
49
  warn "given block not used" if block_given?
50
50
  each_with_index { |member, j| return j if member == node }
@@ -171,16 +171,50 @@ module Nokogiri
171
171
  end
172
172
 
173
173
  ###
174
- # Set the attribute +key+ to +value+ or the return value of +blk+
175
- # on all Node objects in the NodeSet.
176
- def attr key, value = nil, &blk
177
- unless Hash === key || key && (value || blk)
178
- return first.attribute(key)
174
+ # Set attributes on each Node in the NodeSet, or get an
175
+ # attribute from the first Node in the NodeSet.
176
+ #
177
+ # To get an attribute from the first Node in a NodeSet:
178
+ #
179
+ # node_set.attr("href") # => "https://www.nokogiri.org"
180
+ #
181
+ # Note that an empty NodeSet will return nil when +#attr+ is called as a getter.
182
+ #
183
+ # To set an attribute on each node, +key+ can either be an
184
+ # attribute name, or a Hash of attribute names and values. When
185
+ # called as a setter, +#attr+ returns the NodeSet.
186
+ #
187
+ # If +key+ is an attribute name, then either +value+ or +block+
188
+ # must be passed.
189
+ #
190
+ # If +key+ is a Hash then attributes will be set for each
191
+ # key/value pair:
192
+ #
193
+ # node_set.attr("href" => "https://www.nokogiri.org", "class" => "member")
194
+ #
195
+ # If +value+ is passed, it will be used as the attribute value
196
+ # for all nodes:
197
+ #
198
+ # node_set.attr("href", "https://www.nokogiri.org")
199
+ #
200
+ # If +block+ is passed, it will be called on each Node object in
201
+ # the NodeSet and the return value used as the attribute value
202
+ # for that node:
203
+ #
204
+ # node_set.attr("class") { |node| node.name }
205
+ #
206
+ def attr key, value = nil, &block
207
+ unless key.is_a?(Hash) || (key && (value || block))
208
+ return first ? first.attribute(key) : nil
179
209
  end
180
210
 
181
211
  hash = key.is_a?(Hash) ? key : { key => value }
182
212
 
183
- hash.each { |k,v| each { |el| el[k] = v || blk[el] } }
213
+ hash.each do |k,v|
214
+ each do |node|
215
+ node[k] = v || block.call(node)
216
+ end
217
+ end
184
218
 
185
219
  self
186
220
  end
@@ -197,7 +231,7 @@ module Nokogiri
197
231
 
198
232
  ###
199
233
  # Iterate over each node, yielding to +block+
200
- def each(&block)
234
+ def each
201
235
  return to_enum unless block_given?
202
236
 
203
237
  0.upto(length - 1) do |x|
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.10.0
4
+ version: 1.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2019-01-04 00:00:00.000000000 Z
17
+ date: 2019-01-13 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: mini_portile2
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.4.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: concourse
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.15'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '0.15'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: hoe-bundler
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -92,70 +106,70 @@ dependencies:
92
106
  requirements:
93
107
  - - "~>"
94
108
  - !ruby/object:Gem::Version
95
- version: 5.8.4
109
+ version: '5.8'
96
110
  type: :development
97
111
  prerelease: false
98
112
  version_requirements: !ruby/object:Gem::Requirement
99
113
  requirements:
100
114
  - - "~>"
101
115
  - !ruby/object:Gem::Version
102
- version: 5.8.4
116
+ version: '5.8'
103
117
  - !ruby/object:Gem::Dependency
104
- name: rake
118
+ name: racc
105
119
  requirement: !ruby/object:Gem::Requirement
106
120
  requirements:
107
121
  - - "~>"
108
122
  - !ruby/object:Gem::Version
109
- version: '12.0'
123
+ version: 1.4.14
110
124
  type: :development
111
125
  prerelease: false
112
126
  version_requirements: !ruby/object:Gem::Requirement
113
127
  requirements:
114
128
  - - "~>"
115
129
  - !ruby/object:Gem::Version
116
- version: '12.0'
130
+ version: 1.4.14
117
131
  - !ruby/object:Gem::Dependency
118
- name: rake-compiler
132
+ name: rake
119
133
  requirement: !ruby/object:Gem::Requirement
120
134
  requirements:
121
135
  - - "~>"
122
136
  - !ruby/object:Gem::Version
123
- version: 1.0.3
137
+ version: '12.0'
124
138
  type: :development
125
139
  prerelease: false
126
140
  version_requirements: !ruby/object:Gem::Requirement
127
141
  requirements:
128
142
  - - "~>"
129
143
  - !ruby/object:Gem::Version
130
- version: 1.0.3
144
+ version: '12.0'
131
145
  - !ruby/object:Gem::Dependency
132
- name: rake-compiler-dock
146
+ name: rake-compiler
133
147
  requirement: !ruby/object:Gem::Requirement
134
148
  requirements:
135
149
  - - "~>"
136
150
  - !ruby/object:Gem::Version
137
- version: 0.7.0
151
+ version: 1.0.3
138
152
  type: :development
139
153
  prerelease: false
140
154
  version_requirements: !ruby/object:Gem::Requirement
141
155
  requirements:
142
156
  - - "~>"
143
157
  - !ruby/object:Gem::Version
144
- version: 0.7.0
158
+ version: 1.0.3
145
159
  - !ruby/object:Gem::Dependency
146
- name: racc
160
+ name: rake-compiler-dock
147
161
  requirement: !ruby/object:Gem::Requirement
148
162
  requirements:
149
163
  - - "~>"
150
164
  - !ruby/object:Gem::Version
151
- version: 1.4.14
165
+ version: 0.7.0
152
166
  type: :development
153
167
  prerelease: false
154
168
  version_requirements: !ruby/object:Gem::Requirement
155
169
  requirements:
156
170
  - - "~>"
157
171
  - !ruby/object:Gem::Version
158
- version: 1.4.14
172
+ version: 0.7.0
159
173
  - !ruby/object:Gem::Dependency
160
174
  name: rexical
161
175
  requirement: !ruby/object:Gem::Requirement
@@ -171,19 +185,19 @@ dependencies:
171
185
  - !ruby/object:Gem::Version
172
186
  version: 1.0.5
173
187
  - !ruby/object:Gem::Dependency
174
- name: concourse
188
+ name: simplecov
175
189
  requirement: !ruby/object:Gem::Requirement
176
190
  requirements:
177
191
  - - "~>"
178
192
  - !ruby/object:Gem::Version
179
- version: '0.15'
193
+ version: '0.16'
180
194
  type: :development
181
195
  prerelease: false
182
196
  version_requirements: !ruby/object:Gem::Requirement
183
197
  requirements:
184
198
  - - "~>"
185
199
  - !ruby/object:Gem::Version
186
- version: '0.15'
200
+ version: '0.16'
187
201
  - !ruby/object:Gem::Dependency
188
202
  name: rdoc
189
203
  requirement: !ruby/object:Gem::Requirement