nokogiri 1.6.7.2-java → 1.6.8-java
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 +4 -4
- data/.cross_rubies +2 -0
- data/.travis.yml +19 -9
- data/CHANGELOG.rdoc +73 -5
- data/CONTRIBUTING.md +42 -0
- data/Gemfile +10 -9
- data/LICENSE.txt +1 -1
- data/Manifest.txt +7 -2
- data/README.md +23 -27
- data/ROADMAP.md +11 -1
- data/Rakefile +36 -17
- data/bin/nokogiri +2 -2
- data/dependencies.yml +29 -4
- data/ext/java/nokogiri/HtmlElementDescription.java +5 -2
- data/ext/java/nokogiri/NokogiriService.java +19 -0
- data/ext/java/nokogiri/XmlAttr.java +3 -1
- data/ext/java/nokogiri/XmlDocumentFragment.java +0 -14
- data/ext/java/nokogiri/XmlNode.java +106 -63
- data/ext/java/nokogiri/XmlXpathContext.java +12 -12
- data/ext/java/nokogiri/XsltStylesheet.java +11 -4
- data/ext/java/nokogiri/internals/HtmlDomParserContext.java +8 -1
- data/ext/java/nokogiri/internals/NokogiriErrorHandler.java +1 -2
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +7 -7
- data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler4NekoHtml.java +1 -1
- data/ext/java/nokogiri/internals/NokogiriStrictErrorHandler.java +0 -1
- data/ext/java/nokogiri/internals/NokogiriXsltErrorListener.java +3 -3
- data/ext/java/nokogiri/internals/ParserContext.java +4 -0
- data/ext/java/nokogiri/internals/SaveContextVisitor.java +18 -13
- data/ext/nokogiri/extconf.rb +163 -79
- data/ext/nokogiri/html_document.c +6 -6
- data/ext/nokogiri/html_element_description.c +1 -1
- data/ext/nokogiri/html_entity_lookup.c +1 -1
- data/ext/nokogiri/html_sax_parser_context.c +4 -4
- data/ext/nokogiri/html_sax_push_parser.c +2 -2
- data/ext/nokogiri/nokogiri.c +0 -7
- data/ext/nokogiri/nokogiri.h +1 -34
- data/ext/nokogiri/xml_attr.c +2 -2
- data/ext/nokogiri/xml_comment.c +1 -1
- data/ext/nokogiri/xml_document.c +20 -22
- data/ext/nokogiri/xml_encoding_handler.c +3 -3
- data/ext/nokogiri/xml_entity_reference.c +1 -1
- data/ext/nokogiri/xml_namespace.c +56 -17
- data/ext/nokogiri/xml_node.c +73 -67
- data/ext/nokogiri/xml_node_set.c +164 -146
- data/ext/nokogiri/xml_node_set.h +3 -4
- data/ext/nokogiri/xml_processing_instruction.c +2 -2
- data/ext/nokogiri/xml_reader.c +5 -18
- data/ext/nokogiri/xml_sax_parser.c +9 -12
- data/ext/nokogiri/xml_sax_parser_context.c +1 -1
- data/ext/nokogiri/xml_sax_push_parser.c +1 -1
- data/ext/nokogiri/xml_schema.c +1 -1
- data/ext/nokogiri/xml_syntax_error.c +0 -4
- data/ext/nokogiri/xml_syntax_error.h +0 -1
- data/ext/nokogiri/xml_text.c +1 -1
- data/ext/nokogiri/xml_xpath_context.c +15 -24
- data/ext/nokogiri/xslt_stylesheet.c +6 -6
- data/lib/nekohtml.jar +0 -0
- data/lib/nokogiri.rb +14 -7
- data/lib/nokogiri/css/parser.rb +8 -2
- data/lib/nokogiri/css/parser.y +7 -2
- data/lib/nokogiri/html/document.rb +4 -2
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version.rb +1 -1
- data/lib/nokogiri/xml/document.rb +7 -1
- data/lib/nokogiri/xml/dtd.rb +4 -4
- data/lib/nokogiri/xml/node.rb +6 -10
- data/lib/nokogiri/xml/node_set.rb +3 -3
- data/lib/nokogiri/xml/parse_options.rb +22 -0
- data/lib/serializer.jar +0 -0
- data/lib/xalan.jar +0 -0
- data/lib/xercesImpl.jar +0 -0
- data/lib/xml-apis.jar +0 -0
- data/tasks/test.rb +5 -0
- data/test/css/test_parser.rb +7 -1
- data/test/files/GH_1042.html +18 -0
- data/test/files/namespace_pressure_test.xml +1684 -0
- data/test/files/tlm.html +2 -1
- data/test/helper.rb +4 -0
- data/test/html/sax/test_parser.rb +2 -2
- data/test/html/test_document.rb +47 -11
- data/test/html/test_document_encoding.rb +55 -58
- data/test/html/test_document_fragment.rb +27 -23
- data/test/html/test_node.rb +16 -0
- data/test/html/test_node_encoding.rb +71 -13
- data/test/namespaces/test_namespaces_in_parsed_doc.rb +14 -0
- data/test/test_css_cache.rb +1 -1
- data/test/test_encoding_handler.rb +2 -0
- data/test/test_xslt_transforms.rb +38 -3
- data/test/xml/sax/test_parser.rb +54 -53
- data/test/xml/test_document.rb +7 -2
- data/test/xml/test_document_encoding.rb +19 -16
- data/test/xml/test_document_fragment.rb +12 -0
- data/test/xml/test_dtd_encoding.rb +0 -2
- data/test/xml/test_namespace.rb +2 -2
- data/test/xml/test_node.rb +15 -4
- data/test/xml/test_node_attributes.rb +6 -0
- data/test/xml/test_node_encoding.rb +49 -87
- data/test/xml/test_node_reparenting.rb +193 -18
- data/test/xml/test_node_set.rb +1 -1
- data/test/xml/test_reader.rb +589 -0
- data/test/xml/test_reader_encoding.rb +100 -102
- data/test/xml/test_unparented_node.rb +14 -1
- data/test/xslt/test_exception_handling.rb +1 -1
- data/test_all +47 -33
- metadata +38 -36
- data/CHANGELOG.ja.rdoc +0 -1057
- data/test/test_reader.rb +0 -558
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 963da2a97aea3e0a2ff9beb894ae4d36086470b2
|
4
|
+
data.tar.gz: 144f2819771a6f38208b71ee9734e43dcb228b0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c85206c8f180d20eb9f56f035b9e46844c54bea2b977c27b31d4abef9f156b0082f7cfd5f57e0545601e0582014a0e1333fdefd76471f7f4625f5c2d8e4cb20
|
7
|
+
data.tar.gz: eca3f6870e439cb4d66fdbd4f64d1bfb8bf02f3806134b959d133f769870a58b1be931ae0b7ae1af9b3b15e63045673b7bad3b5ea6179283ddb910f1e5fe1bdd
|
data/.cross_rubies
CHANGED
data/.travis.yml
CHANGED
@@ -4,13 +4,15 @@ sudo: false
|
|
4
4
|
|
5
5
|
rvm:
|
6
6
|
- ruby-1.9.2
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
-
|
7
|
+
- 1.9.3
|
8
|
+
- 2.0
|
9
|
+
- 2.1
|
10
|
+
- 2.2.3
|
11
|
+
- 2.3.0
|
11
12
|
- jruby-19mode
|
12
|
-
- jruby
|
13
|
-
- jruby-9.0.
|
13
|
+
- jruby
|
14
|
+
- jruby-9.0.4.0
|
15
|
+
- jruby-head
|
14
16
|
- rbx-19mode
|
15
17
|
- rbx-2
|
16
18
|
|
@@ -19,15 +21,20 @@ os:
|
|
19
21
|
- osx
|
20
22
|
|
21
23
|
matrix:
|
24
|
+
allow_failures:
|
25
|
+
# https://github.com/travis-ci/travis-ci/issues/5361
|
26
|
+
- os: osx
|
27
|
+
rvm: 2.3.0
|
28
|
+
- rvm: jruby-head
|
22
29
|
exclude:
|
23
30
|
- os: osx
|
24
31
|
rvm: ruby-1.9.2
|
25
32
|
- os: osx
|
26
33
|
rvm: jruby-19mode
|
27
34
|
- os: osx
|
28
|
-
rvm: jruby
|
35
|
+
rvm: jruby
|
29
36
|
- os: osx
|
30
|
-
rvm: jruby-9.0.
|
37
|
+
rvm: jruby-9.0.4.0
|
31
38
|
- os: osx
|
32
39
|
rvm: rbx-19mode
|
33
40
|
- os: osx
|
@@ -37,5 +44,8 @@ notifications:
|
|
37
44
|
irc:
|
38
45
|
channels:
|
39
46
|
- "chat.freenode.net#nokogiri"
|
40
|
-
|
47
|
+
on_success: always
|
48
|
+
on_failure: always
|
49
|
+
template:
|
50
|
+
- "%{repository} (%{branch}:%{commit} by %{author}): %{message} (%{build_url})"
|
41
51
|
skip_join: true
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,4 +1,74 @@
|
|
1
|
-
=== 1.6.
|
1
|
+
=== 1.6.8 / unreleased
|
2
|
+
|
3
|
+
==== Security Notes
|
4
|
+
|
5
|
+
[MRI] Bundled libxml2 is upgraded to 2.9.4, which fixes many security issues. Many of these had previously been patched in the vendored libxml 2.9.2 in the 1.6.7.x branch, but some are newer.
|
6
|
+
|
7
|
+
See these libxml2 email posts for more:
|
8
|
+
|
9
|
+
* https://mail.gnome.org/archives/xml/2015-November/msg00012.html
|
10
|
+
* https://mail.gnome.org/archives/xml/2016-May/msg00023.html
|
11
|
+
|
12
|
+
For a more detailed analysis, you may care to read Canonical's take on these security issues:
|
13
|
+
|
14
|
+
* http://www.ubuntu.com/usn/usn-2994-1
|
15
|
+
|
16
|
+
|
17
|
+
[MRI] Bundled libxslt is upgraded to 1.1.29, which fixes a security issue as well as many long-known outstanding bugs, some features, some portability improvements, and general cleanup.
|
18
|
+
|
19
|
+
See this libxslt email post for more:
|
20
|
+
|
21
|
+
* https://mail.gnome.org/archives/xslt/2016-May/msg00004.html
|
22
|
+
|
23
|
+
|
24
|
+
==== Features
|
25
|
+
|
26
|
+
Several changes were made to improve performance:
|
27
|
+
|
28
|
+
* [MRI] Simplify NodeSet#to_a with a minor speed-up. (#1397)
|
29
|
+
* XML::Node#ancestors optimization. (#1297) (Thanks, Bruno Sutic!)
|
30
|
+
* Use Symbol#to_proc where we weren't previously. (#1296) (Thanks, Bruno Sutic!)
|
31
|
+
* XML::DTD#each uses implicit block calls. (Thanks, @glaucocustodio!)
|
32
|
+
* Fall back to the `pkg-config` gem if we're having trouble finding the system libxml2. This should help many FreeBSD users. (#1417)
|
33
|
+
* Set document encoding appropriately even on blank document. (#1043) (Thanks, @batter!)
|
34
|
+
|
35
|
+
|
36
|
+
==== Bug Fixes
|
37
|
+
|
38
|
+
* [JRuby] fix slow add_child (#692)
|
39
|
+
* [JRuby] fix load errors when deploying to JRuby/Torquebox (#1114) (Thanks, @atambo and @jvshahid!)
|
40
|
+
* [JRuby] fix NPE when inspecting nodes returned by NodeSet#drop (#1042) (Thanks, @mkristian!)
|
41
|
+
* [JRuby] fix nil attriubte node's namespace in reader (#1327) (Thanks, @codekitchen!)
|
42
|
+
* [JRuby] fix Nokogiri munging unicode characters that require more than 2 bytes (#1113) (Thanks, @mkristian!)
|
43
|
+
* [JRuby] allow unlinking an unparented node (#1112, #1152) (Thanks, @esse!)
|
44
|
+
* [JRuby] allow Fragment parsing on a frozen string (#444, #1077)
|
45
|
+
* [JRuby] HTML `style` tags are no longer encoded (#1316) (Thanks, @tbeauvais!)
|
46
|
+
* [MRI] fix assertion failure while accessing attribute node's namespace in reader (#843) (Thanks, @2potatocakes!)
|
47
|
+
* [MRI] fix issue with GCing namespace nodes returned in an xpath query. (#1155)
|
48
|
+
* [MRI] Ensure C strings are null-terminated. (#1381)
|
49
|
+
* [MRI] Ensure Rubygems is loaded before using mini_portile2 at installation. (#1393, #1411) (Thanks, @JonRowe!)
|
50
|
+
* [MRI] Handling another edge case where the `libxml-ruby` gem's global callbacks were smashing the heap. (#1426). (Thanks to @bbergstrom for providing an isolated test case!)
|
51
|
+
* [MRI] Ensure encodings are passed to Sax::Parser xmldecl callback. (#844)
|
52
|
+
* [MRI] Ensure default ns prefix is applied correctly when reparenting nodes to another document. (#391) (Thanks, @ylecuyer!)
|
53
|
+
* [MRI] Ensure Reader handles non-existent attributes as expected. (#1254) (Thanks, @ccutrer!)
|
54
|
+
* [MRI] Cleanup around namespace handling when reparenting nodes. (#1332, #1333, #1444) (Thanks, @cuttrer and @bradleybeddoes!)
|
55
|
+
* unescape special characters in CSS queries (#1303) (Thanks, @twalpole!)
|
56
|
+
* consistently handle empty documents (#1349)
|
57
|
+
* Update to mini_portile2 2.1.0 to address whitespace-handling during patching. (#1402)
|
58
|
+
* Fix encoding of xml node namespaces.
|
59
|
+
* Work around issue installing Nokogiri on overlayfs (commonly used in Docker containers). (#1370, #1405)
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
==== Other Notes
|
64
|
+
|
65
|
+
* Removed legacy code remaining from Ruby 1.8.x support.
|
66
|
+
* Removed legacy code remaining from REE support.
|
67
|
+
* Removing hacky workarounds for bugs in some older versions of libxml2.
|
68
|
+
* Handling C strings in a forward-compatible manner, see https://github.com/ruby/ruby/blob/v2_2_0/NEWS#L319
|
69
|
+
|
70
|
+
|
71
|
+
=== 1.6.7.2 / 2016-01-20
|
2
72
|
|
3
73
|
This version pulls in several upstream patches to the vendored libxml2 and libxslt to address:
|
4
74
|
|
@@ -22,8 +92,6 @@ This version pulls in several upstream patches to the vendored libxml2 and libxs
|
|
22
92
|
CVE-2015-8242
|
23
93
|
CVE-2015-8317
|
24
94
|
|
25
|
-
These CVEs are all low or medium priority according to Canonical, however NIST NVD gives CVE-2015-5312 a high severity score.
|
26
|
-
|
27
95
|
See also http://www.ubuntu.com/usn/usn-2834-1/
|
28
96
|
|
29
97
|
|
@@ -54,7 +122,7 @@ See #1374 and #1376 for details.
|
|
54
122
|
* [JRuby] reset the namespace cache when replacing the document's innerHtml (#1265) (Thanks, @mkristian!)
|
55
123
|
* [JRuby] Document#parse should support IO objects that respond to #read. (#1124) (Thanks, Jake Byman!)
|
56
124
|
* [MRI] Duplicate-id errors when setting the `id` attribute on HTML documents are now silenced. (#1262)
|
57
|
-
* [JRuby] SAX parser cuts texts in
|
125
|
+
* [JRuby] SAX parser cuts texts in pieces when square brackets exist. (#1261)
|
58
126
|
* [JRuby] Namespaced attributes aren't removed by remove_attribute. (#1299)
|
59
127
|
|
60
128
|
|
@@ -64,7 +132,7 @@ This version pulls in an upstream patch to the vendored libxml2 to address:
|
|
64
132
|
|
65
133
|
* unclosed comment uninitialized access issue (#1376)
|
66
134
|
|
67
|
-
This issue
|
135
|
+
This issue was assigned CVE-2015-8710 after the fact. See http://seclists.org/oss-sec/2015/q4/616 for details.
|
68
136
|
|
69
137
|
|
70
138
|
=== 1.6.6.3 / 2015-11-16
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Issue and Pull Request Guidelines
|
2
|
+
|
3
|
+
Thank you for getting involved in making Nokogiri better!
|
4
|
+
|
5
|
+
|
6
|
+
## Code of Conduct
|
7
|
+
|
8
|
+
For best results, be nice. Remember that Nokogiri maintainers are
|
9
|
+
volunteers, and treat them with respect.
|
10
|
+
|
11
|
+
Do not act entitled to service. Do not be rude. Do not use judgmental
|
12
|
+
or foul language.
|
13
|
+
|
14
|
+
The maintainers reserve the right to delete comments that are rude, or
|
15
|
+
that contain foul language. The maintainers reserve the right to
|
16
|
+
delete comments that they deem harassing or offensive.
|
17
|
+
|
18
|
+
|
19
|
+
## Issues
|
20
|
+
|
21
|
+
Please read the
|
22
|
+
["Getting Help" tutorial](http://www.nokogiri.org/tutorials/getting_help.html)
|
23
|
+
at the [nokogiri.org](http://nokogiri.org) site.
|
24
|
+
|
25
|
+
If you're reporting an issue, it must contain:
|
26
|
+
|
27
|
+
* Example code that reproduces the **observed** behavior.
|
28
|
+
* An explanation of what the **expected** behavior is.
|
29
|
+
|
30
|
+
That's it. If you don't provide that information, we'll ask you for
|
31
|
+
it, tag the story "needs more information", and then after a time will
|
32
|
+
close it if the information isn't provided.
|
33
|
+
|
34
|
+
|
35
|
+
## Pull Requests
|
36
|
+
|
37
|
+
Pull requests must always contain a test to prevent
|
38
|
+
regressions. Preferably, the test should demonstrate the __intent__ of
|
39
|
+
the code.
|
40
|
+
|
41
|
+
We may ask you for clarification if we don't understand the intent of
|
42
|
+
the change.
|
data/Gemfile
CHANGED
@@ -4,19 +4,20 @@
|
|
4
4
|
|
5
5
|
source "https://rubygems.org/"
|
6
6
|
|
7
|
-
gem "mini_portile2", "~>2.
|
7
|
+
gem "mini_portile2", "~>2.1.0"
|
8
|
+
gem "pkg-config", "~>1.1.7"
|
8
9
|
|
9
10
|
gem "rdoc", "~>4.0", :group => [:development, :test]
|
10
|
-
gem "hoe-bundler", "
|
11
|
+
gem "hoe-bundler", "~>1.2.0", :group => [:development, :test]
|
11
12
|
gem "hoe-debugging", "~>1.2.1", :group => [:development, :test]
|
12
|
-
gem "hoe-gemspec", "
|
13
|
-
gem "hoe-git", "
|
14
|
-
gem "minitest", "~>
|
15
|
-
gem "rake", "
|
13
|
+
gem "hoe-gemspec", "~>1.0.0", :group => [:development, :test]
|
14
|
+
gem "hoe-git", "~>1.6.0", :group => [:development, :test]
|
15
|
+
gem "minitest", "~>5.8.4", :group => [:development, :test]
|
16
|
+
gem "rake", "~>10.5.0", :group => [:development, :test]
|
16
17
|
gem "rake-compiler", "~>0.9.2", :group => [:development, :test]
|
17
|
-
gem "rake-compiler-dock", "~>0.
|
18
|
-
gem "racc", "
|
19
|
-
gem "rexical", "
|
18
|
+
gem "rake-compiler-dock", "~>0.5.1", :group => [:development, :test]
|
19
|
+
gem "racc", "~>1.4.14", :group => [:development, :test], :platform => :ruby
|
20
|
+
gem "rexical", "~>1.0.5", :group => [:development, :test], :platform => :ruby
|
20
21
|
gem "hoe", "~>3.14", :group => [:development, :test]
|
21
22
|
|
22
23
|
# vim: syntax=ruby
|
data/LICENSE.txt
CHANGED
data/Manifest.txt
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
.editorconfig
|
4
4
|
.gemtest
|
5
5
|
.travis.yml
|
6
|
-
CHANGELOG.ja.rdoc
|
7
6
|
CHANGELOG.rdoc
|
7
|
+
CONTRIBUTING.md
|
8
8
|
C_CODING_STYLE.rdoc
|
9
9
|
Gemfile
|
10
10
|
LICENSE.txt
|
@@ -241,7 +241,10 @@ lib/nokogiri/xml/xpath/syntax_error.rb
|
|
241
241
|
lib/nokogiri/xml/xpath_context.rb
|
242
242
|
lib/nokogiri/xslt.rb
|
243
243
|
lib/nokogiri/xslt/stylesheet.rb
|
244
|
+
lib/serializer.jar
|
245
|
+
lib/xalan.jar
|
244
246
|
lib/xercesImpl.jar
|
247
|
+
lib/xml-apis.jar
|
245
248
|
lib/xsd/xmlparser/nokogiri.rb
|
246
249
|
patches/sort-patches-by-date
|
247
250
|
suppressions/README.txt
|
@@ -256,6 +259,7 @@ test/css/test_tokenizer.rb
|
|
256
259
|
test/css/test_xpath_visitor.rb
|
257
260
|
test/decorators/test_slop.rb
|
258
261
|
test/files/2ch.html
|
262
|
+
test/files/GH_1042.html
|
259
263
|
test/files/address_book.rlx
|
260
264
|
test/files/address_book.xml
|
261
265
|
test/files/atom.xml
|
@@ -268,6 +272,7 @@ test/files/exslt.xml
|
|
268
272
|
test/files/exslt.xslt
|
269
273
|
test/files/foo/foo.xsd
|
270
274
|
test/files/metacharset.html
|
275
|
+
test/files/namespace_pressure_test.xml
|
271
276
|
test/files/noencoding.html
|
272
277
|
test/files/po.xml
|
273
278
|
test/files/po.xsd
|
@@ -314,7 +319,6 @@ test/test_css_cache.rb
|
|
314
319
|
test/test_encoding_handler.rb
|
315
320
|
test/test_memory_leak.rb
|
316
321
|
test/test_nokogiri.rb
|
317
|
-
test/test_reader.rb
|
318
322
|
test/test_soap4r_sax.rb
|
319
323
|
test/test_xslt_transforms.rb
|
320
324
|
test/xml/node/test_save_options.rb
|
@@ -346,6 +350,7 @@ test/xml/test_node_reparenting.rb
|
|
346
350
|
test/xml/test_node_set.rb
|
347
351
|
test/xml/test_parse_options.rb
|
348
352
|
test/xml/test_processing_instruction.rb
|
353
|
+
test/xml/test_reader.rb
|
349
354
|
test/xml/test_reader_encoding.rb
|
350
355
|
test/xml/test_relax_ng.rb
|
351
356
|
test/xml/test_schema.rb
|
data/README.md
CHANGED
@@ -22,9 +22,6 @@ Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. Among
|
|
22
22
|
Nokogiri's many features is the ability to search documents via XPath
|
23
23
|
or CSS3 selectors.
|
24
24
|
|
25
|
-
XML is like violence - if it doesn’t solve your problems, you are not
|
26
|
-
using enough of it.
|
27
|
-
|
28
25
|
|
29
26
|
## Features
|
30
27
|
|
@@ -86,29 +83,28 @@ There are open-source tutorials (to which we invite contributions!) here: http:/
|
|
86
83
|
Nokogiri is a large library, but here is example usage for parsing and examining a document:
|
87
84
|
|
88
85
|
```ruby
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
end
|
86
|
+
#! /usr/bin/env ruby
|
87
|
+
|
88
|
+
require 'nokogiri'
|
89
|
+
require 'open-uri'
|
90
|
+
|
91
|
+
# Fetch and parse HTML document
|
92
|
+
doc = Nokogiri::HTML(open('http://www.nokogiri.org/tutorials/installing_nokogiri.html'))
|
93
|
+
|
94
|
+
puts "### Search for nodes by css"
|
95
|
+
doc.css('nav ul.menu li a', 'article h2').each do |link|
|
96
|
+
puts link.content
|
97
|
+
end
|
98
|
+
|
99
|
+
puts "### Search for nodes by xpath"
|
100
|
+
doc.xpath('//nav//ul//li/a', '//article//h2').each do |link|
|
101
|
+
puts link.content
|
102
|
+
end
|
103
|
+
|
104
|
+
puts "### Or mix and match."
|
105
|
+
doc.search('nav ul.menu li a', '//article//h2').each do |link|
|
106
|
+
puts link.content
|
107
|
+
end
|
112
108
|
```
|
113
109
|
|
114
110
|
|
@@ -121,7 +117,7 @@ Nokogiri is a large library, but here is example usage for parsing and examining
|
|
121
117
|
gem, but if you want to use the system versions:
|
122
118
|
|
123
119
|
* at install time, set the environment variable
|
124
|
-
`
|
120
|
+
`NOKOGIRI_USE_SYSTEM_LIBRARIES` or else use the
|
125
121
|
`--use-system-libraries` argument. (See
|
126
122
|
http://nokogiri.org/tutorials/installing_nokogiri.html#using_your_system_libraries
|
127
123
|
for specifics.)
|
data/ROADMAP.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Roadmap for
|
1
|
+
# Roadmap for API Changes
|
2
2
|
|
3
3
|
## overhaul serialize/pretty printing API
|
4
4
|
|
@@ -99,3 +99,13 @@ So, instead, let's make alternative methods like
|
|
99
99
|
`Nokogiri::XML::Document#new_comment`, and recommend those as the
|
100
100
|
proper convention.
|
101
101
|
|
102
|
+
|
103
|
+
## `collect_namespaces` is just broken
|
104
|
+
|
105
|
+
`collect_namespaces` is returning a hash, which means it can't return
|
106
|
+
namespaces with the same prefix. See this issue for background:
|
107
|
+
|
108
|
+
> https://github.com/sparklemotion/nokogiri/issues/885
|
109
|
+
|
110
|
+
Do we care? This seems like a useless method, but then again I hate
|
111
|
+
XML, so what do I know?
|
data/Rakefile
CHANGED
@@ -8,7 +8,6 @@ Hoe.plugin :debugging
|
|
8
8
|
Hoe.plugin :git
|
9
9
|
Hoe.plugin :gemspec
|
10
10
|
Hoe.plugin :bundler
|
11
|
-
Hoe.add_include_dirs '.'
|
12
11
|
|
13
12
|
GENERATED_PARSER = "lib/nokogiri/css/parser.rb"
|
14
13
|
GENERATED_TOKENIZER = "lib/nokogiri/css/tokenizer.rb"
|
@@ -128,22 +127,22 @@ HOE = Hoe.spec 'nokogiri' do
|
|
128
127
|
|
129
128
|
unless java?
|
130
129
|
self.extra_deps += [
|
131
|
-
#
|
132
|
-
["
|
130
|
+
["mini_portile2", "~> 2.1.0"], # keep version in sync with extconf.rb
|
131
|
+
["pkg-config", "~> 1.1.7"], # keep version in sync with extconf.rb
|
133
132
|
]
|
134
133
|
end
|
135
134
|
|
136
135
|
self.extra_dev_deps += [
|
137
|
-
["hoe-bundler",
|
138
|
-
["hoe-debugging",
|
139
|
-
["hoe-gemspec",
|
140
|
-
["hoe-git",
|
141
|
-
["minitest",
|
142
|
-
["rake",
|
143
|
-
["rake-compiler",
|
144
|
-
["rake-compiler-dock", "~> 0.
|
145
|
-
["racc",
|
146
|
-
["rexical",
|
136
|
+
["hoe-bundler", "~> 1.2.0"],
|
137
|
+
["hoe-debugging", "~> 1.2.1"],
|
138
|
+
["hoe-gemspec", "~> 1.0.0"],
|
139
|
+
["hoe-git", "~> 1.6.0"],
|
140
|
+
["minitest", "~> 5.8.4"],
|
141
|
+
["rake", "~> 10.5.0"],
|
142
|
+
["rake-compiler", "~> 0.9.2"],
|
143
|
+
["rake-compiler-dock", "~> 0.5.1"],
|
144
|
+
["racc", "~> 1.4.14"],
|
145
|
+
["rexical", "~> 1.0.5"]
|
147
146
|
]
|
148
147
|
|
149
148
|
if java?
|
@@ -184,6 +183,7 @@ if java?
|
|
184
183
|
ext.target_version = '1.6'
|
185
184
|
jars = ["#{jruby_home}/lib/jruby.jar"] + FileList['lib/*.jar']
|
186
185
|
ext.classpath = jars.map { |x| File.expand_path x }.join ':'
|
186
|
+
ext.debug = true if ENV['JAVA_DEBUG']
|
187
187
|
end
|
188
188
|
|
189
189
|
task gem_build_path => [:compile] do
|
@@ -206,7 +206,7 @@ else
|
|
206
206
|
|
207
207
|
task gem_build_path do
|
208
208
|
%w[libxml2 libxslt].each do |lib|
|
209
|
-
version = dependencies[lib]
|
209
|
+
version = dependencies[lib]["version"]
|
210
210
|
archive = File.join("ports", "archives", "#{lib}-#{version}.tar.gz")
|
211
211
|
add_file_to_gem archive
|
212
212
|
patchesdir = File.join("patches", lib)
|
@@ -231,7 +231,7 @@ else
|
|
231
231
|
ext.cross_platform = CROSS_RUBIES.map(&:platform).uniq
|
232
232
|
ext.cross_config_options << "--enable-cross-build"
|
233
233
|
ext.cross_compiling do |spec|
|
234
|
-
libs = dependencies.map { |name,
|
234
|
+
libs = dependencies.map { |name, dep| "#{name}-#{dep["version"]}" }.join(', ')
|
235
235
|
|
236
236
|
spec.required_ruby_version = [
|
237
237
|
'>= 1.9.2',
|
@@ -292,10 +292,11 @@ task :debug do
|
|
292
292
|
ENV['CFLAGS'] += " -DDEBUG"
|
293
293
|
end
|
294
294
|
|
295
|
-
require 'tasks/test'
|
295
|
+
require File.join File.dirname(__FILE__), 'tasks/test'
|
296
296
|
|
297
297
|
task :java_debug do
|
298
|
-
ENV['
|
298
|
+
ENV['JRUBY_OPTS'] = "#{ENV['JRUBY_OPTS']} --debug --dev"
|
299
|
+
ENV['JAVA_OPTS'] = '-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y' if ENV['JAVA_DEBUG']
|
299
300
|
end
|
300
301
|
|
301
302
|
if java?
|
@@ -316,6 +317,24 @@ if Hoe.plugins.include?(:debugging)
|
|
316
317
|
end
|
317
318
|
end
|
318
319
|
|
320
|
+
task "test:libxml-ruby" do
|
321
|
+
ENV['TEST_NOKOGIRI_WITH_LIBXML_RUBY'] = "1"
|
322
|
+
warn "#{__FILE__}:#{__LINE__}: --- running tests with libxml-ruby loaded ---"
|
323
|
+
Rake::Task[:test].execute
|
324
|
+
ENV['TEST_NOKOGIRI_WITH_LIBXML_RUBY'] = nil
|
325
|
+
end
|
326
|
+
|
327
|
+
Rake::Task["test:libxml-ruby"].prerequisites << :compile
|
328
|
+
|
329
|
+
task "test:valgrind:libxml-ruby" do
|
330
|
+
ENV['TEST_NOKOGIRI_WITH_LIBXML_RUBY'] = "1"
|
331
|
+
warn "#{__FILE__}:#{__LINE__}: --- running tests with libxml-ruby loaded ---"
|
332
|
+
Rake::Task["test:valgrind"].execute
|
333
|
+
ENV['TEST_NOKOGIRI_WITH_LIBXML_RUBY'] = nil
|
334
|
+
end
|
335
|
+
|
336
|
+
Rake::Task["test:valgrind:libxml-ruby"].prerequisites << :compile
|
337
|
+
|
319
338
|
# ----------------------------------------
|
320
339
|
|
321
340
|
def verify_dll(dll, cross_ruby)
|