nokogiri 1.5.2-x86-mswin32-60 → 1.5.3.rc2-x86-mswin32-60
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.
- data/CHANGELOG.ja.rdoc +15 -0
- data/CHANGELOG.rdoc +11 -0
- data/Manifest.txt +11 -2
- data/ROADMAP.md +65 -0
- data/{nokogiri_help_responses.md → STANDARD_RESPONSES.md} +9 -2
- data/Y_U_NO_GEMSPEC.md +155 -0
- data/build_all +58 -0
- data/ext/nokogiri/xml_node_set.c +1 -1
- data/lib/nokogiri/1.8/nokogiri.so +0 -0
- data/lib/nokogiri/1.9/nokogiri.so +0 -0
- data/lib/nokogiri/css/parser.rb +164 -143
- data/lib/nokogiri/css/parser.y +13 -1
- data/lib/nokogiri/version.rb +1 -1
- data/test/css/test_parser.rb +11 -0
- data/test/files/to_be_xincluded.xml +2 -0
- data/test/files/xinclude.xml +4 -0
- data/test/xml/test_document.rb +6 -2
- data/test/xml/test_unparented_node.rb +2 -2
- data/test/xml/test_xpath.rb +11 -0
- data/test_all +84 -0
- metadata +24 -14
data/CHANGELOG.ja.rdoc
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
== 1.5.3 / unreleased
|
2
|
+
|
3
|
+
* Bugfixes
|
4
|
+
|
5
|
+
* Custom xpath functions with empty nodeset arguments cause a segfault. #634.
|
6
|
+
* Nokogiri::XML::Node#css now works for XML documents with default
|
7
|
+
namespaces when the rule contains attribute selector without
|
8
|
+
namespace.
|
9
|
+
|
10
|
+
|
11
|
+
== 1.5.2 / 2012-03-09
|
12
|
+
|
13
|
+
Repackaging of 1.5.1 with a gemspec that is compatible with older Rubies. #631, #632.
|
14
|
+
|
15
|
+
|
1
16
|
== 1.5.1 / 2012年3月9日
|
2
17
|
|
3
18
|
* 新機能
|
data/CHANGELOG.rdoc
CHANGED
@@ -1,7 +1,18 @@
|
|
1
|
+
== 1.5.3 / unreleased
|
2
|
+
|
3
|
+
* Bugfixes
|
4
|
+
|
5
|
+
* Custom xpath functions with empty nodeset arguments cause a segfault. #634.
|
6
|
+
* Nokogiri::XML::Node#css now works for XML documents with default
|
7
|
+
namespaces when the rule contains attribute selector without
|
8
|
+
namespace.
|
9
|
+
|
10
|
+
|
1
11
|
== 1.5.2 / 2012-03-09
|
2
12
|
|
3
13
|
Repackaging of 1.5.1 with a gemspec that is compatible with older Rubies. #631, #632.
|
4
14
|
|
15
|
+
|
5
16
|
== 1.5.1 / 2012-03-09
|
6
17
|
|
7
18
|
* Features
|
data/Manifest.txt
CHANGED
@@ -2,11 +2,16 @@
|
|
2
2
|
.gemtest
|
3
3
|
CHANGELOG.ja.rdoc
|
4
4
|
CHANGELOG.rdoc
|
5
|
+
C_CODING_STYLE.rdoc
|
5
6
|
Manifest.txt
|
6
7
|
README.ja.rdoc
|
7
8
|
README.rdoc
|
9
|
+
ROADMAP.md
|
8
10
|
Rakefile
|
11
|
+
STANDARD_RESPONSES.md
|
12
|
+
Y_U_NO_GEMSPEC.md
|
9
13
|
bin/nokogiri
|
14
|
+
build_all
|
10
15
|
ext/java/nokogiri/EncodingHandler.java
|
11
16
|
ext/java/nokogiri/HtmlDocument.java
|
12
17
|
ext/java/nokogiri/HtmlElementDescription.java
|
@@ -198,7 +203,6 @@ lib/nokogiri/xslt.rb
|
|
198
203
|
lib/nokogiri/xslt/stylesheet.rb
|
199
204
|
lib/xercesImpl.jar
|
200
205
|
lib/xsd/xmlparser/nokogiri.rb
|
201
|
-
nokogiri_help_responses.md
|
202
206
|
tasks/cross_compile.rb
|
203
207
|
tasks/nokogiri.org.rb
|
204
208
|
tasks/test.rb
|
@@ -228,7 +232,9 @@ test/files/staff.dtd
|
|
228
232
|
test/files/staff.xml
|
229
233
|
test/files/staff.xslt
|
230
234
|
test/files/tlm.html
|
235
|
+
test/files/to_be_xincluded.xml
|
231
236
|
test/files/valid_bar.xml
|
237
|
+
test/files/xinclude.xml
|
232
238
|
test/helper.rb
|
233
239
|
test/html/sax/test_parser.rb
|
234
240
|
test/html/sax/test_parser_context.rb
|
@@ -256,6 +262,7 @@ test/xml/sax/test_push_parser.rb
|
|
256
262
|
test/xml/test_attr.rb
|
257
263
|
test/xml/test_attribute_decl.rb
|
258
264
|
test/xml/test_builder.rb
|
265
|
+
test/xml/test_c14n.rb
|
259
266
|
test/xml/test_cdata.rb
|
260
267
|
test/xml/test_comment.rb
|
261
268
|
test/xml/test_document.rb
|
@@ -271,9 +278,9 @@ test/xml/test_namespace.rb
|
|
271
278
|
test/xml/test_node.rb
|
272
279
|
test/xml/test_node_attributes.rb
|
273
280
|
test/xml/test_node_encoding.rb
|
281
|
+
test/xml/test_node_inheritance.rb
|
274
282
|
test/xml/test_node_reparenting.rb
|
275
283
|
test/xml/test_node_set.rb
|
276
|
-
test/xml/test_node_inheritance.rb
|
277
284
|
test/xml/test_parse_options.rb
|
278
285
|
test/xml/test_processing_instruction.rb
|
279
286
|
test/xml/test_reader_encoding.rb
|
@@ -282,6 +289,8 @@ test/xml/test_schema.rb
|
|
282
289
|
test/xml/test_syntax_error.rb
|
283
290
|
test/xml/test_text.rb
|
284
291
|
test/xml/test_unparented_node.rb
|
292
|
+
test/xml/test_xinclude.rb
|
285
293
|
test/xml/test_xpath.rb
|
286
294
|
test/xslt/test_custom_functions.rb
|
287
295
|
test/xslt/test_exception_handling.rb
|
296
|
+
test_all
|
data/ROADMAP.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
# Roadmap for 2.0
|
2
|
+
|
3
|
+
## overhaul serialize/pretty printing API
|
4
|
+
|
5
|
+
* https://github.com/tenderlove/nokogiri/issues/530
|
6
|
+
XHTML formatting can't be turned off
|
7
|
+
|
8
|
+
* https://github.com/tenderlove/nokogiri/issues/415
|
9
|
+
XML formatting should be no formatting
|
10
|
+
|
11
|
+
|
12
|
+
## overhaul and optimize the SAX parsing
|
13
|
+
|
14
|
+
* see fairy wing throwdown - SAX parsing is wicked slow.
|
15
|
+
|
16
|
+
|
17
|
+
## improve CSS query parsing
|
18
|
+
|
19
|
+
* https://github.com/tenderlove/nokogiri/issues/528
|
20
|
+
support `:not()` with a nontrivial argument, like `:not(div p.c)`
|
21
|
+
|
22
|
+
* https://github.com/tenderlove/nokogiri/issues/451
|
23
|
+
chained :not pseudoselectors
|
24
|
+
|
25
|
+
* better jQuery selector support:
|
26
|
+
* https://github.com/tenderlove/nokogiri/issues/621
|
27
|
+
* https://github.com/tenderlove/nokogiri/issues/342
|
28
|
+
* https://github.com/tenderlove/nokogiri/issues/628
|
29
|
+
|
30
|
+
* https://github.com/tenderlove/nokogiri/issues/394
|
31
|
+
nth-of-type is wrong, and possibly other selectors as well
|
32
|
+
|
33
|
+
* https://github.com/tenderlove/nokogiri/issues/309
|
34
|
+
incorrect query being executed
|
35
|
+
|
36
|
+
* https://github.com/tenderlove/nokogiri/issues/350
|
37
|
+
:has is wrong?
|
38
|
+
|
39
|
+
|
40
|
+
## DocumentFragment
|
41
|
+
|
42
|
+
* there are a few tickets about searches not working properly if you
|
43
|
+
use or do not use the context node as part of the search.
|
44
|
+
- https://github.com/tenderlove/nokogiri/issues/213
|
45
|
+
- https://github.com/tenderlove/nokogiri/issues/370
|
46
|
+
- https://github.com/tenderlove/nokogiri/issues/454
|
47
|
+
- https://github.com/tenderlove/nokogiri/issues/572
|
48
|
+
|
49
|
+
|
50
|
+
## Better Syntax for custom XPath function handler
|
51
|
+
|
52
|
+
* https://github.com/tenderlove/nokogiri/pull/464
|
53
|
+
|
54
|
+
|
55
|
+
## Encoding
|
56
|
+
|
57
|
+
We have a lot of issues open around encoding. Is this really an issue?
|
58
|
+
Somebody who knows something about encoding, and cares, should point
|
59
|
+
this one.
|
60
|
+
|
61
|
+
|
62
|
+
## Reader
|
63
|
+
|
64
|
+
It's fundamentally broken, in that we can't stop people from crashing
|
65
|
+
their application if they want to use object reference unsafely.
|
@@ -1,4 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# Standard Responses to Requests
|
2
|
+
|
3
|
+
These responses are needed often enough that I figured, let's just
|
4
|
+
check them in for future reference and use.
|
5
|
+
|
6
|
+
|
7
|
+
# Not enough information to help
|
2
8
|
|
3
9
|
Hello!
|
4
10
|
|
@@ -22,7 +28,8 @@ take a look at http://bit.ly/nokohelp
|
|
22
28
|
|
23
29
|
Thank you so much!
|
24
30
|
|
25
|
-
|
31
|
+
|
32
|
+
# Not a bug
|
26
33
|
|
27
34
|
Hello!
|
28
35
|
|
data/Y_U_NO_GEMSPEC.md
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
(note: this was originally a blog post published at http://blog.flavorjon.es/2012/03/y-u-no-gemspec.html)
|
2
|
+
|
3
|
+
## tl;dr
|
4
|
+
|
5
|
+
1. Team Nokogiri are not 10-foot-tall code-crunching robots, so `master` is usually unstable.
|
6
|
+
2. Unstable code can corrupt your data and crash your application, which would make everybody look bad.
|
7
|
+
3. Therefore, the _risk_ associated with using unstable code is severe; for you _and_ for Team Nokogiri.
|
8
|
+
4. The absence of a gemspec is a risk mitigation tactic.
|
9
|
+
5. You can always ask for an RC release.
|
10
|
+
|
11
|
+
|
12
|
+
## Why Isn't There a Gemspec!?
|
13
|
+
|
14
|
+
OHAI! Thank you for asking this question!
|
15
|
+
|
16
|
+
Team Nokogiri gets asked this pretty frequently. Just a sample from
|
17
|
+
the historical record:
|
18
|
+
|
19
|
+
* [Issue #274](https://github.com/tenderlove/nokogiri/issues/274)
|
20
|
+
* [Issue #371](https://github.com/tenderlove/nokogiri/issues/371)
|
21
|
+
* [A commit removing nokogiri.gemspec](https://github.com/tenderlove/nokogiri/commit/7f17a643a05ca381d65131515b54d4a3a61ca2e1#commitcomment-667477)
|
22
|
+
* [A nokogiri-talk thread](http://groups.google.com/group/nokogiri-talk/browse_thread/thread/4706b002e492d23f)
|
23
|
+
* [Another nokogiri-talk thread](http://groups.google.com/group/nokogiri-talk/browse_thread/thread/0b201bb80ea3eea0)
|
24
|
+
|
25
|
+
Sometimes people imply that we've forgotten, or that we don't how to
|
26
|
+
properly manage our codebase. Those people are super fun to respond
|
27
|
+
to!
|
28
|
+
|
29
|
+
We've gone back and forth a couple of times over the past few years,
|
30
|
+
but the current policy of Team Nokogiri is to **not** provide a
|
31
|
+
gemspec in the Github repo. This is a conscious choice, not an
|
32
|
+
oversight.
|
33
|
+
|
34
|
+
|
35
|
+
## But You Didn't Answer the Question!
|
36
|
+
|
37
|
+
Ah, I was hoping you wouldn't notice. Well, OK, let's do this, if
|
38
|
+
you're serious about it.
|
39
|
+
|
40
|
+
I'd like to start by talking about _risk_. Specifically, the risk
|
41
|
+
associated with using a known-unstable version of Nokogiri.
|
42
|
+
|
43
|
+
|
44
|
+
### Risk
|
45
|
+
|
46
|
+
One common way to evaluate the _risk_ of an incident is:
|
47
|
+
|
48
|
+
risk = probability x impact
|
49
|
+
|
50
|
+
You can read more about this on [the internets](http://en.wikipedia.org/wiki/Risk_Matrix).
|
51
|
+
|
52
|
+
The _risk_ associated with a Nokogiri bug could be loosely defined by
|
53
|
+
answering the questions:
|
54
|
+
|
55
|
+
* "How likely is it that a bug exists?" (probability)
|
56
|
+
* "How severe will the consequences of a bug be?" (impact)
|
57
|
+
|
58
|
+
|
59
|
+
### Probability
|
60
|
+
|
61
|
+
The `master` branch should be considered unstable. Team Nokogiri are
|
62
|
+
not 10-foot-tall code-crunching robots; we are humans. We make
|
63
|
+
mistakes, and as a result, any arbitrary commit on `master` is likely
|
64
|
+
to contain bugs.
|
65
|
+
|
66
|
+
Just as an example, Nokogiri `master` was unstable for about five
|
67
|
+
months between November 2011 and March 2012. It was unstable not
|
68
|
+
because we were sloppy, or didn't care, but because the fixes were
|
69
|
+
hard and unobvious.
|
70
|
+
|
71
|
+
When we release Nokogiri, we test for memory leaks and invalid memory
|
72
|
+
access on all kinds of platforms with many flavors of Ruby and lots of
|
73
|
+
versions of libxml2. Because these tests are time-consuming, we don't
|
74
|
+
run them on every commit. We run them often when preparing a release.
|
75
|
+
|
76
|
+
If we're releasing Nokogiri, it means we think it's rock solid.
|
77
|
+
|
78
|
+
And if we're not releasing it, it means there are probably bugs.
|
79
|
+
|
80
|
+
|
81
|
+
### Impact
|
82
|
+
|
83
|
+
Nokogiri is a gem with native extensions. This means it's not pure
|
84
|
+
Ruby -- there's C or Java code being compiled and run, which means
|
85
|
+
that there's always a chance that the gem will crash your application,
|
86
|
+
or worse. Possible outcomes include:
|
87
|
+
|
88
|
+
* leaking memory
|
89
|
+
* corrupting data
|
90
|
+
* making benign code crash (due to memory corruption)
|
91
|
+
|
92
|
+
So, then, a bug in a native extension can have much worse downside
|
93
|
+
than you might think. It's not just going to do something unexpected;
|
94
|
+
it's possibly going to do terrible, awful things to your application
|
95
|
+
and data.
|
96
|
+
|
97
|
+
**Nobody** wants that to happen. Especially Team Nokogiri.
|
98
|
+
|
99
|
+
|
100
|
+
### Risk, Redux
|
101
|
+
|
102
|
+
So, if you accept the equation
|
103
|
+
|
104
|
+
risk = probability x impact
|
105
|
+
|
106
|
+
and you believe me when I say that:
|
107
|
+
|
108
|
+
* the probablility of a bug in unreleased code is high, and
|
109
|
+
* the impact of a bug is likely to be severe,
|
110
|
+
|
111
|
+
then you should easily see that the _risk_ associated with a bug in
|
112
|
+
Nokogiri is quite high.
|
113
|
+
|
114
|
+
Part of Team Nokogiri's job is to try to mitigate this risk. We have a
|
115
|
+
number of tactics that we use to accomplish this:
|
116
|
+
|
117
|
+
* we respond quickly to bug reports, particularly when they are possible memory issues
|
118
|
+
* we review each others' commits
|
119
|
+
* we have a thorough test suite, and we test-drive new features
|
120
|
+
* we discuss code design and issues on a core developer mailing list
|
121
|
+
* we use valgrind to test for memory issues (leaks and invalid
|
122
|
+
access) on multiple combinations of OS, libxml2 and Ruby
|
123
|
+
* we package release candidates, and encourage devs to use them
|
124
|
+
* **we do NOT commit a gemspec in our git repository**
|
125
|
+
|
126
|
+
Yes, that's right, the absence of a gemspec is a risk mitigation
|
127
|
+
tactic. Not only does Team Nokogiri not want to imply support for
|
128
|
+
`master`, we want to **actively discourage** people from using
|
129
|
+
it. Because it's not stable.
|
130
|
+
|
131
|
+
|
132
|
+
## But I Want to Do It Anyway
|
133
|
+
|
134
|
+
Another option, is to email the [nokogiri-talk
|
135
|
+
list](http://groups.google.com/group/nokogiri-talk) and ask for a
|
136
|
+
release candidate to be built. We're pretty accommodating if there's a
|
137
|
+
bugfix that's a blocker for you. And if we can't release an RC, we'll
|
138
|
+
tell you why.
|
139
|
+
|
140
|
+
And in the end, nothing is stopping you from cloning the repo and
|
141
|
+
generating a private gemspec. This is an extra step or two, but it has
|
142
|
+
the benefit of making sure developers have thought through the costs
|
143
|
+
and risks involved; and it tends to select for developers who know
|
144
|
+
what they're doing.
|
145
|
+
|
146
|
+
|
147
|
+
## In Conclusion
|
148
|
+
|
149
|
+
Team Nokogiri takes stability very seriously. We want everybody who
|
150
|
+
uses Nokogiri to have a pleasant experience. And so we want to make
|
151
|
+
sure that you're using the best software we can make.
|
152
|
+
|
153
|
+
Please keep in mind that we're trying very hard to do the right thing
|
154
|
+
for all Nokogiri users out there in Rubyland. Nokogiri loves you very
|
155
|
+
much, and we hope you love it back.
|
data/build_all
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
#! /usr/bin/env bash
|
2
|
+
#
|
3
|
+
# script to build gems for all relevant platforms:
|
4
|
+
# - MRI et al (standard gem)
|
5
|
+
# - windows (x86-mingw32 and x86-msin32-60)
|
6
|
+
# - jruby
|
7
|
+
#
|
8
|
+
# prerequisite is the mingw32 packages.
|
9
|
+
# on ubuntu, `sudo apt-get install mingw32`
|
10
|
+
# for others, read up at https://github.com/luislavena/rake-compiler
|
11
|
+
#
|
12
|
+
|
13
|
+
# Load RVM into a shell session *as a function*
|
14
|
+
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
|
15
|
+
source "$HOME/.rvm/scripts/rvm"
|
16
|
+
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
|
17
|
+
source "/usr/local/rvm/scripts/rvm"
|
18
|
+
else
|
19
|
+
echo "ERROR: An RVM installation was not found.\n"
|
20
|
+
fi
|
21
|
+
|
22
|
+
function rvm_use {
|
23
|
+
current_ruby=$1
|
24
|
+
rvm use "${1}@nokogiri" --create
|
25
|
+
}
|
26
|
+
|
27
|
+
set -o errexit
|
28
|
+
|
29
|
+
# initialize
|
30
|
+
rvm_use 1.8.7
|
31
|
+
rm -rf tmp pkg
|
32
|
+
bundle exec rake clean clobber
|
33
|
+
|
34
|
+
# holding pen
|
35
|
+
rm -rf gems
|
36
|
+
mkdir -p gems
|
37
|
+
|
38
|
+
# MRI
|
39
|
+
rvm_use 1.8.7
|
40
|
+
bundle exec rake gem
|
41
|
+
cp -v pkg/nokogiri*.gem gems # should only be one at this point in the script
|
42
|
+
|
43
|
+
# windows
|
44
|
+
rvm_use 1.8.7
|
45
|
+
bundle exec rake-compiler cross-ruby VERSION=1.8.7-p330
|
46
|
+
bundle exec rake-compiler cross-ruby VERSION=1.9.2-p136
|
47
|
+
bundle exec rake cross
|
48
|
+
rake gem:windows # don't use bundler here. it blows up. *shrug*
|
49
|
+
cp -v pkg/nokogiri*x86-{mingw32,mswin32}*.gem gems
|
50
|
+
|
51
|
+
# jruby
|
52
|
+
rvm_use jruby-1.6.5
|
53
|
+
bundle exec rake clean clobber
|
54
|
+
rvm_use 1.8.7
|
55
|
+
bundle exec rake generate
|
56
|
+
rvm_use jruby-1.6.5
|
57
|
+
bundle exec rake gem
|
58
|
+
cp -v pkg/nokogiri*java.gem gems
|
data/ext/nokogiri/xml_node_set.c
CHANGED
@@ -427,7 +427,7 @@ VALUE Nokogiri_wrap_xml_node_set(xmlNodeSetPtr node_set, VALUE document)
|
|
427
427
|
rb_funcall(document, decorate, 1, new_set);
|
428
428
|
}
|
429
429
|
|
430
|
-
if (node_set->nodeTab) {
|
430
|
+
if (node_set && node_set->nodeTab) {
|
431
431
|
for (i = 0; i < node_set->nodeNr; i++) {
|
432
432
|
cur = node_set->nodeTab[i];
|
433
433
|
if (cur && cur->type == XML_NAMESPACE_DECL) {
|
Binary file
|
Binary file
|
data/lib/nokogiri/css/parser.rb
CHANGED
@@ -14,92 +14,94 @@ module Nokogiri
|
|
14
14
|
##### State transition tables begin ###
|
15
15
|
|
16
16
|
racc_action_table = [
|
17
|
-
5,
|
18
|
-
6,
|
19
|
-
|
20
|
-
6, 5, 9,
|
21
|
-
1, 6,
|
22
|
-
20, 5,
|
23
|
-
|
24
|
-
20, 1,
|
25
|
-
28,
|
26
|
-
17, 6, 17,
|
27
|
-
6, 17, 17,
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
nil, nil,
|
17
|
+
5, 59, 28, 23, 12, 25, 63, 60, 5, 1,
|
18
|
+
6, 62, 12, 60, 69, 24, 17, 1, 86, 20,
|
19
|
+
98, 97, 6, 12, 9, 10, 14, 20, 17, 70,
|
20
|
+
6, 5, 9, 10, 14, 12, 17, -24, 44, 5,
|
21
|
+
1, 6, 44, 12, 10, 64, 65, 17, 1, 68,
|
22
|
+
20, 5, 67, 6, 62, 9, 10, 14, 20, 17,
|
23
|
+
29, 6, 31, 9, 10, 14, 12, 17, 12, 65,
|
24
|
+
20, 1, 87, 12, 88, 9, 66, 12, 12, 61,
|
25
|
+
28, 56, 12, 57, 6, 91, 6, 10, 14, 10,
|
26
|
+
17, 6, 17, 92, 10, 6, 6, 17, 10, 10,
|
27
|
+
6, 17, 17, 10, 5, 44, 17, 72, 75, 28,
|
28
|
+
56, 46, 57, 52, 28, 56, 95, 57, 73, 76,
|
29
|
+
77, 96, 78, 20, 72, 75, 71, 22, 9, 99,
|
30
|
+
-24, 101, 36, 38, 40, 73, 76, 77, 102, 78,
|
31
|
+
nil, nil, 35, 71, 37, 39, 28, 56, nil, 57 ]
|
32
32
|
|
33
33
|
racc_action_check = [
|
34
|
-
0, 21, 5, 5, 0, 5, 23,
|
35
|
-
15, 23, 9, 21,
|
36
|
-
|
37
|
-
9,
|
38
|
-
|
39
|
-
|
40
|
-
6,
|
41
|
-
6,
|
42
|
-
|
43
|
-
|
44
|
-
16,
|
45
|
-
20,
|
46
|
-
|
47
|
-
|
48
|
-
nil, nil, 7,
|
34
|
+
0, 21, 5, 5, 0, 5, 23, 45, 9, 0,
|
35
|
+
15, 23, 9, 21, 30, 5, 15, 9, 45, 0,
|
36
|
+
79, 79, 0, 8, 0, 0, 0, 9, 0, 31,
|
37
|
+
9, 34, 9, 9, 9, 34, 9, 29, 8, 60,
|
38
|
+
34, 8, 42, 60, 8, 25, 25, 8, 60, 28,
|
39
|
+
34, 6, 27, 34, 56, 34, 34, 34, 60, 34,
|
40
|
+
6, 60, 6, 60, 60, 60, 44, 60, 83, 57,
|
41
|
+
6, 44, 58, 19, 59, 6, 26, 18, 13, 22,
|
42
|
+
62, 62, 16, 62, 44, 63, 83, 44, 44, 83,
|
43
|
+
44, 19, 83, 64, 19, 18, 13, 19, 18, 13,
|
44
|
+
16, 18, 13, 16, 17, 11, 16, 32, 32, 20,
|
45
|
+
20, 10, 20, 17, 65, 65, 69, 65, 32, 32,
|
46
|
+
32, 74, 32, 17, 33, 33, 32, 4, 17, 80,
|
47
|
+
1, 85, 7, 7, 7, 33, 33, 33, 92, 33,
|
48
|
+
nil, nil, 7, 33, 7, 7, 68, 68, nil, 68 ]
|
49
49
|
|
50
50
|
racc_action_pointer = [
|
51
|
-
-2,
|
52
|
-
|
53
|
-
99, 1,
|
54
|
-
|
55
|
-
|
56
|
-
nil, nil, nil, nil,
|
57
|
-
|
58
|
-
nil, nil, nil, nil,
|
59
|
-
|
60
|
-
nil, nil, nil, nil, nil, nil, nil, nil, nil
|
51
|
+
-2, 101, nil, nil, 98, -8, 49, 125, 17, 6,
|
52
|
+
100, 84, nil, 72, nil, -14, 76, 102, 71, 67,
|
53
|
+
99, 1, 68, -1, nil, 34, 53, 29, 37, 8,
|
54
|
+
-15, 4, 104, 121, 29, nil, nil, nil, nil, nil,
|
55
|
+
nil, nil, 21, nil, 60, -5, nil, nil, nil, nil,
|
56
|
+
nil, nil, nil, nil, nil, nil, 42, 57, 49, 74,
|
57
|
+
37, nil, 70, 72, 86, 104, nil, nil, 136, 105,
|
58
|
+
nil, nil, nil, nil, 96, nil, nil, nil, nil, 10,
|
59
|
+
104, nil, nil, 62, nil, 108, nil, nil, nil, nil,
|
60
|
+
nil, nil, 125, nil, nil, nil, nil, nil, nil, nil,
|
61
|
+
nil, nil, nil ]
|
61
62
|
|
62
63
|
racc_action_default = [
|
63
|
-
-25, -23, -20, -2, -
|
64
|
-
-
|
65
|
-
-
|
66
|
-
-
|
67
|
-
-
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
-
|
64
|
+
-25, -23, -20, -2, -72, -72, -25, -18, -48, -25,
|
65
|
+
-72, -16, -57, -53, -21, -12, -56, -72, -55, -54,
|
66
|
+
-72, -72, -72, -41, -31, -39, -72, -72, -40, -30,
|
67
|
+
-72, -72, -60, -60, -25, -5, -3, -8, -4, -7,
|
68
|
+
-6, -9, -47, -11, -25, -72, -19, -15, -49, -13,
|
69
|
+
-14, -52, -46, -45, -51, -50, -41, -39, -72, -72,
|
70
|
+
-25, -22, -72, -72, -44, -72, -32, -33, -72, -72,
|
71
|
+
-28, -61, -66, -62, -72, -67, -63, -64, -65, -72,
|
72
|
+
-72, -17, -10, -69, -71, -72, -35, -34, 103, -1,
|
73
|
+
-38, -43, -72, -36, -37, -29, -26, -58, -59, -27,
|
74
|
+
-70, -68, -42 ]
|
73
75
|
|
74
76
|
racc_goto_table = [
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
77
|
+
42, 26, 81, 43, 33, 48, 47, 49, 51, 21,
|
78
|
+
54, 55, 74, 80, 41, 53, 58, 50, 45, 30,
|
79
|
+
32, 83, 34, 27, 85, nil, nil, nil, 89, nil,
|
80
|
+
nil, nil, nil, nil, nil, nil, 84, 82, nil, nil,
|
79
81
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
80
|
-
nil, nil, nil, nil, nil, nil,
|
81
|
-
nil,
|
82
|
-
nil, nil,
|
82
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 90, nil,
|
83
|
+
nil, 93, nil, nil, 94, nil, nil, nil, nil, nil,
|
84
|
+
nil, nil, nil, nil, nil, 100 ]
|
83
85
|
|
84
86
|
racc_goto_check = [
|
85
|
-
7,
|
86
|
-
7, 7,
|
87
|
-
5, 3,
|
88
|
-
|
87
|
+
7, 17, 2, 8, 9, 7, 8, 10, 7, 1,
|
88
|
+
7, 7, 16, 16, 6, 9, 17, 11, 1, 14,
|
89
|
+
15, 5, 3, 18, 21, nil, nil, nil, 2, nil,
|
90
|
+
nil, nil, nil, nil, nil, nil, 7, 8, nil, nil,
|
89
91
|
nil, nil, nil, nil, nil, nil, nil, nil, nil, nil,
|
90
|
-
nil, nil, nil, nil, nil, nil,
|
91
|
-
nil,
|
92
|
-
nil, nil, 7 ]
|
92
|
+
nil, nil, nil, nil, nil, nil, nil, nil, 17, nil,
|
93
|
+
nil, 17, nil, nil, 17, nil, nil, nil, nil, nil,
|
94
|
+
nil, nil, nil, nil, nil, 7 ]
|
93
95
|
|
94
96
|
racc_goto_pointer = [
|
95
|
-
nil,
|
96
|
-
-
|
97
|
-
-
|
97
|
+
nil, 9, -32, 15, nil, -23, 6, -8, -5, -2,
|
98
|
+
-8, 2, nil, nil, 13, 14, -20, -4, 18, nil,
|
99
|
+
nil, -20 ]
|
98
100
|
|
99
101
|
racc_goto_default = [
|
100
|
-
nil, nil, 3, nil, 7, 8, nil,
|
101
|
-
16, 18, 19, 2, 4, nil, nil, nil,
|
102
|
-
nil ]
|
102
|
+
nil, nil, 3, nil, 7, 8, nil, 11, nil, 15,
|
103
|
+
16, 18, 19, 2, 4, nil, nil, nil, nil, 13,
|
104
|
+
79, nil ]
|
103
105
|
|
104
106
|
racc_reduce_table = [
|
105
107
|
0, 0, :racc_error,
|
@@ -131,51 +133,53 @@ racc_reduce_table = [
|
|
131
133
|
4, 42, :_reduce_26,
|
132
134
|
4, 42, :_reduce_27,
|
133
135
|
3, 42, :_reduce_28,
|
134
|
-
|
135
|
-
|
136
|
-
|
136
|
+
3, 46, :_reduce_29,
|
137
|
+
1, 46, :_reduce_30,
|
138
|
+
2, 40, :_reduce_31,
|
137
139
|
3, 40, :_reduce_32,
|
138
140
|
3, 40, :_reduce_33,
|
139
|
-
3,
|
140
|
-
3,
|
141
|
-
3,
|
142
|
-
|
143
|
-
|
144
|
-
1,
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
2,
|
141
|
+
3, 40, :_reduce_34,
|
142
|
+
3, 40, :_reduce_35,
|
143
|
+
3, 48, :_reduce_36,
|
144
|
+
3, 48, :_reduce_37,
|
145
|
+
3, 48, :_reduce_38,
|
146
|
+
1, 48, :_reduce_none,
|
147
|
+
1, 48, :_reduce_none,
|
148
|
+
1, 48, :_reduce_41,
|
149
|
+
4, 49, :_reduce_42,
|
150
|
+
3, 49, :_reduce_43,
|
151
|
+
2, 49, :_reduce_44,
|
152
|
+
2, 41, :_reduce_45,
|
153
|
+
2, 41, :_reduce_46,
|
150
154
|
1, 37, :_reduce_none,
|
151
155
|
0, 37, :_reduce_none,
|
152
|
-
2, 38, :_reduce_47,
|
153
|
-
2, 38, :_reduce_48,
|
154
156
|
2, 38, :_reduce_49,
|
155
157
|
2, 38, :_reduce_50,
|
158
|
+
2, 38, :_reduce_51,
|
159
|
+
2, 38, :_reduce_52,
|
156
160
|
1, 38, :_reduce_none,
|
157
161
|
1, 38, :_reduce_none,
|
158
162
|
1, 38, :_reduce_none,
|
159
163
|
1, 38, :_reduce_none,
|
160
|
-
1,
|
161
|
-
2,
|
162
|
-
2,
|
163
|
-
0,
|
164
|
-
1,
|
165
|
-
1,
|
166
|
-
1,
|
167
|
-
1,
|
168
|
-
1,
|
169
|
-
1,
|
170
|
-
1,
|
171
|
-
3, 39, :
|
172
|
-
1,
|
173
|
-
2,
|
174
|
-
1,
|
175
|
-
|
176
|
-
racc_reduce_n =
|
177
|
-
|
178
|
-
racc_shift_n =
|
164
|
+
1, 50, :_reduce_57,
|
165
|
+
2, 47, :_reduce_58,
|
166
|
+
2, 47, :_reduce_59,
|
167
|
+
0, 47, :_reduce_none,
|
168
|
+
1, 51, :_reduce_61,
|
169
|
+
1, 51, :_reduce_62,
|
170
|
+
1, 51, :_reduce_63,
|
171
|
+
1, 51, :_reduce_64,
|
172
|
+
1, 51, :_reduce_65,
|
173
|
+
1, 51, :_reduce_66,
|
174
|
+
1, 51, :_reduce_67,
|
175
|
+
3, 39, :_reduce_68,
|
176
|
+
1, 52, :_reduce_none,
|
177
|
+
2, 52, :_reduce_none,
|
178
|
+
1, 52, :_reduce_none ]
|
179
|
+
|
180
|
+
racc_reduce_n = 72
|
181
|
+
|
182
|
+
racc_shift_n = 103
|
179
183
|
|
180
184
|
racc_token_table = {
|
181
185
|
false => 0,
|
@@ -277,6 +281,7 @@ Racc_token_to_s_table = [
|
|
277
281
|
"class",
|
278
282
|
"namespaced_ident",
|
279
283
|
"namespace",
|
284
|
+
"attrib_name",
|
280
285
|
"attrib_val_0or1",
|
281
286
|
"expr",
|
282
287
|
"an_plus_b",
|
@@ -459,19 +464,23 @@ def _reduce_28(val, _values, result)
|
|
459
464
|
end
|
460
465
|
|
461
466
|
def _reduce_29(val, _values, result)
|
462
|
-
result = Node.new(:
|
467
|
+
result = Node.new(:ELEMENT_NAME,
|
468
|
+
[[val.first, val.last].compact.join(':')]
|
469
|
+
)
|
463
470
|
|
464
471
|
result
|
465
472
|
end
|
466
473
|
|
467
474
|
def _reduce_30(val, _values, result)
|
468
|
-
|
475
|
+
# Default namespace is not applied to attributes.
|
476
|
+
# So we don't add prefix "xmlns:" as in namespaced_ident.
|
477
|
+
result = Node.new(:ELEMENT_NAME, [val.first])
|
469
478
|
|
470
479
|
result
|
471
480
|
end
|
472
481
|
|
473
482
|
def _reduce_31(val, _values, result)
|
474
|
-
result = Node.new(:FUNCTION, [val.first.strip
|
483
|
+
result = Node.new(:FUNCTION, [val.first.strip])
|
475
484
|
|
476
485
|
result
|
477
486
|
end
|
@@ -489,12 +498,14 @@ def _reduce_33(val, _values, result)
|
|
489
498
|
end
|
490
499
|
|
491
500
|
def _reduce_34(val, _values, result)
|
492
|
-
|
501
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
502
|
+
|
493
503
|
result
|
494
504
|
end
|
495
505
|
|
496
506
|
def _reduce_35(val, _values, result)
|
497
|
-
|
507
|
+
result = Node.new(:FUNCTION, [val.first.strip, val[1]].flatten)
|
508
|
+
|
498
509
|
result
|
499
510
|
end
|
500
511
|
|
@@ -503,11 +514,21 @@ def _reduce_36(val, _values, result)
|
|
503
514
|
result
|
504
515
|
end
|
505
516
|
|
506
|
-
|
517
|
+
def _reduce_37(val, _values, result)
|
518
|
+
result = [val.first, val.last]
|
519
|
+
result
|
520
|
+
end
|
521
|
+
|
522
|
+
def _reduce_38(val, _values, result)
|
523
|
+
result = [val.first, val.last]
|
524
|
+
result
|
525
|
+
end
|
526
|
+
|
527
|
+
# reduce 39 omitted
|
507
528
|
|
508
|
-
# reduce
|
529
|
+
# reduce 40 omitted
|
509
530
|
|
510
|
-
def
|
531
|
+
def _reduce_41(val, _values, result)
|
511
532
|
if val[0] == 'even'
|
512
533
|
val = ["2","n","+","0"]
|
513
534
|
result = Node.new(:AN_PLUS_B, val)
|
@@ -525,7 +546,7 @@ def _reduce_39(val, _values, result)
|
|
525
546
|
result
|
526
547
|
end
|
527
548
|
|
528
|
-
def
|
549
|
+
def _reduce_42(val, _values, result)
|
529
550
|
if val[1] == 'n'
|
530
551
|
result = Node.new(:AN_PLUS_B, val)
|
531
552
|
else
|
@@ -535,7 +556,7 @@ def _reduce_40(val, _values, result)
|
|
535
556
|
result
|
536
557
|
end
|
537
558
|
|
538
|
-
def
|
559
|
+
def _reduce_43(val, _values, result)
|
539
560
|
# n+3, -n+3
|
540
561
|
if val[0] == 'n'
|
541
562
|
val.unshift("1")
|
@@ -551,7 +572,7 @@ def _reduce_41(val, _values, result)
|
|
551
572
|
result
|
552
573
|
end
|
553
574
|
|
554
|
-
def
|
575
|
+
def _reduce_44(val, _values, result)
|
555
576
|
if val[1] == 'n'
|
556
577
|
val << "+"
|
557
578
|
val << "0"
|
@@ -563,116 +584,116 @@ def _reduce_42(val, _values, result)
|
|
563
584
|
result
|
564
585
|
end
|
565
586
|
|
566
|
-
def
|
587
|
+
def _reduce_45(val, _values, result)
|
567
588
|
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
568
589
|
|
569
590
|
result
|
570
591
|
end
|
571
592
|
|
572
|
-
def
|
593
|
+
def _reduce_46(val, _values, result)
|
573
594
|
result = Node.new(:PSEUDO_CLASS, [val[1]])
|
574
595
|
result
|
575
596
|
end
|
576
597
|
|
577
|
-
# reduce
|
598
|
+
# reduce 47 omitted
|
578
599
|
|
579
|
-
# reduce
|
600
|
+
# reduce 48 omitted
|
580
601
|
|
581
|
-
def
|
602
|
+
def _reduce_49(val, _values, result)
|
582
603
|
result = Node.new(:COMBINATOR, val)
|
583
604
|
|
584
605
|
result
|
585
606
|
end
|
586
607
|
|
587
|
-
def
|
608
|
+
def _reduce_50(val, _values, result)
|
588
609
|
result = Node.new(:COMBINATOR, val)
|
589
610
|
|
590
611
|
result
|
591
612
|
end
|
592
613
|
|
593
|
-
def
|
614
|
+
def _reduce_51(val, _values, result)
|
594
615
|
result = Node.new(:COMBINATOR, val)
|
595
616
|
|
596
617
|
result
|
597
618
|
end
|
598
619
|
|
599
|
-
def
|
620
|
+
def _reduce_52(val, _values, result)
|
600
621
|
result = Node.new(:COMBINATOR, val)
|
601
622
|
|
602
623
|
result
|
603
624
|
end
|
604
625
|
|
605
|
-
# reduce 51 omitted
|
606
|
-
|
607
|
-
# reduce 52 omitted
|
608
|
-
|
609
626
|
# reduce 53 omitted
|
610
627
|
|
611
628
|
# reduce 54 omitted
|
612
629
|
|
613
|
-
|
630
|
+
# reduce 55 omitted
|
631
|
+
|
632
|
+
# reduce 56 omitted
|
633
|
+
|
634
|
+
def _reduce_57(val, _values, result)
|
614
635
|
result = Node.new(:ID, val)
|
615
636
|
result
|
616
637
|
end
|
617
638
|
|
618
|
-
def
|
639
|
+
def _reduce_58(val, _values, result)
|
619
640
|
result = [val.first, val[1]]
|
620
641
|
result
|
621
642
|
end
|
622
643
|
|
623
|
-
def
|
644
|
+
def _reduce_59(val, _values, result)
|
624
645
|
result = [val.first, val[1]]
|
625
646
|
result
|
626
647
|
end
|
627
648
|
|
628
|
-
# reduce
|
649
|
+
# reduce 60 omitted
|
629
650
|
|
630
|
-
def
|
651
|
+
def _reduce_61(val, _values, result)
|
631
652
|
result = :equal
|
632
653
|
result
|
633
654
|
end
|
634
655
|
|
635
|
-
def
|
656
|
+
def _reduce_62(val, _values, result)
|
636
657
|
result = :prefix_match
|
637
658
|
result
|
638
659
|
end
|
639
660
|
|
640
|
-
def
|
661
|
+
def _reduce_63(val, _values, result)
|
641
662
|
result = :suffix_match
|
642
663
|
result
|
643
664
|
end
|
644
665
|
|
645
|
-
def
|
666
|
+
def _reduce_64(val, _values, result)
|
646
667
|
result = :substring_match
|
647
668
|
result
|
648
669
|
end
|
649
670
|
|
650
|
-
def
|
671
|
+
def _reduce_65(val, _values, result)
|
651
672
|
result = :not_equal
|
652
673
|
result
|
653
674
|
end
|
654
675
|
|
655
|
-
def
|
676
|
+
def _reduce_66(val, _values, result)
|
656
677
|
result = :includes
|
657
678
|
result
|
658
679
|
end
|
659
680
|
|
660
|
-
def
|
681
|
+
def _reduce_67(val, _values, result)
|
661
682
|
result = :dash_match
|
662
683
|
result
|
663
684
|
end
|
664
685
|
|
665
|
-
def
|
686
|
+
def _reduce_68(val, _values, result)
|
666
687
|
result = Node.new(:NOT, [val[1]])
|
667
688
|
|
668
689
|
result
|
669
690
|
end
|
670
691
|
|
671
|
-
# reduce
|
692
|
+
# reduce 69 omitted
|
672
693
|
|
673
|
-
# reduce
|
694
|
+
# reduce 70 omitted
|
674
695
|
|
675
|
-
# reduce
|
696
|
+
# reduce 71 omitted
|
676
697
|
|
677
698
|
def _reduce_none(val, _values, result)
|
678
699
|
val[0]
|
data/lib/nokogiri/css/parser.y
CHANGED
@@ -88,7 +88,7 @@ rule
|
|
88
88
|
|
|
89
89
|
;
|
90
90
|
attrib
|
91
|
-
: LSQUARE
|
91
|
+
: LSQUARE attrib_name attrib_val_0or1 RSQUARE {
|
92
92
|
result = Node.new(:ATTRIBUTE_CONDITION,
|
93
93
|
[val[1]] + (val[2] || [])
|
94
94
|
)
|
@@ -105,6 +105,18 @@ rule
|
|
105
105
|
)
|
106
106
|
}
|
107
107
|
;
|
108
|
+
attrib_name
|
109
|
+
: namespace '|' IDENT {
|
110
|
+
result = Node.new(:ELEMENT_NAME,
|
111
|
+
[[val.first, val.last].compact.join(':')]
|
112
|
+
)
|
113
|
+
}
|
114
|
+
| IDENT {
|
115
|
+
# Default namespace is not applied to attributes.
|
116
|
+
# So we don't add prefix "xmlns:" as in namespaced_ident.
|
117
|
+
result = Node.new(:ELEMENT_NAME, [val.first])
|
118
|
+
}
|
119
|
+
;
|
108
120
|
function
|
109
121
|
: FUNCTION RPAREN {
|
110
122
|
result = Node.new(:FUNCTION, [val.first.strip])
|
data/lib/nokogiri/version.rb
CHANGED
data/test/css/test_parser.rb
CHANGED
@@ -6,6 +6,10 @@ module Nokogiri
|
|
6
6
|
def setup
|
7
7
|
super
|
8
8
|
@parser = Nokogiri::CSS::Parser.new
|
9
|
+
@parser_with_ns = Nokogiri::CSS::Parser.new({
|
10
|
+
"xmlns" => "http://default.example.com/",
|
11
|
+
"hoge" => "http://hoge.example.com/",
|
12
|
+
})
|
9
13
|
end
|
10
14
|
|
11
15
|
def test_extra_single_quote
|
@@ -292,6 +296,13 @@ module Nokogiri
|
|
292
296
|
# assert_xpath ['//x/y', '//y/z'], @parser.parse('x > y | y > z')
|
293
297
|
end
|
294
298
|
|
299
|
+
def test_attributes_with_namespace
|
300
|
+
## Default namespace is not applied to attributes.
|
301
|
+
## So this must be @class, not @xmlns:class.
|
302
|
+
assert_xpath "//xmlns:a[@class = 'bar']", @parser_with_ns.parse("a[class='bar']")
|
303
|
+
assert_xpath "//xmlns:a[@hoge:class = 'bar']", @parser_with_ns.parse("a[hoge|class='bar']")
|
304
|
+
end
|
305
|
+
|
295
306
|
def assert_xpath expecteds, asts
|
296
307
|
expecteds = [expecteds].flatten
|
297
308
|
expecteds.zip(asts).each do |expected, actual|
|
data/test/xml/test_document.rb
CHANGED
@@ -358,13 +358,17 @@ module Nokogiri
|
|
358
358
|
def test_subclass_parse
|
359
359
|
klass = Class.new(Nokogiri::XML::Document)
|
360
360
|
doc = klass.parse(File.read(XML_FILE))
|
361
|
-
|
361
|
+
# lame hack uses root to avoid comparing DOCTYPE tags which can appear out of order.
|
362
|
+
# I should really finish lorax and use that here.
|
363
|
+
assert_equal @xml.root.to_s, doc.root.to_s
|
362
364
|
assert_instance_of klass, doc
|
363
365
|
end
|
364
366
|
|
365
367
|
def test_document_parse_method
|
366
368
|
xml = Nokogiri::XML::Document.parse(File.read(XML_FILE))
|
367
|
-
|
369
|
+
# lame hack uses root to avoid comparing DOCTYPE tags which can appear out of order.
|
370
|
+
# I should really finish lorax and use that here.
|
371
|
+
assert_equal @xml.root.to_s, xml.root.to_s
|
368
372
|
end
|
369
373
|
|
370
374
|
def test_encoding=
|
@@ -252,8 +252,8 @@ module Nokogiri
|
|
252
252
|
doc = Nokogiri::XML "<root>foo</root>"
|
253
253
|
pi = Nokogiri::XML::ProcessingInstruction.new(doc, "xml-stylesheet", %q{type="text/xsl" href="foo.xsl"})
|
254
254
|
doc.root.add_previous_sibling pi
|
255
|
-
expected_doc = %Q{<?xml version="1.0"?>\n<?xml-stylesheet type="text/xsl" href="foo.xsl"?>\n<root>foo</root
|
256
|
-
|
255
|
+
expected_doc = %Q{<?xml version="1.0"?>\n<?xml-stylesheet type="text/xsl" href="foo.xsl"?>\n<root>foo</root>}
|
256
|
+
assert_includes doc.to_xml, expected_doc
|
257
257
|
end
|
258
258
|
|
259
259
|
def test_find_by_css_with_tilde_eql
|
data/test/xml/test_xpath.rb
CHANGED
@@ -254,6 +254,17 @@ module Nokogiri
|
|
254
254
|
end
|
255
255
|
assert_equal 123.456, value
|
256
256
|
end
|
257
|
+
|
258
|
+
def test_custom_xpath_with_bullshit_arguments
|
259
|
+
xml = %q{<foo> </foo>}
|
260
|
+
doc = Nokogiri::XML.parse(xml)
|
261
|
+
foo = doc.xpath('//foo[bool_function(bar/baz)]', Class.new {
|
262
|
+
def bool_function(value)
|
263
|
+
true
|
264
|
+
end
|
265
|
+
}.new)
|
266
|
+
assert_equal foo, doc.xpath("//foo")
|
267
|
+
end
|
257
268
|
end
|
258
269
|
end
|
259
270
|
end
|
data/test_all
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
#! /usr/bin/env bash
|
2
|
+
#
|
3
|
+
# script to run tests on all relevant rubies, and valgrind on supported rubies.
|
4
|
+
# outputs tests to `test.log` and valgrind output to `valgrind.log`.
|
5
|
+
#
|
6
|
+
# requires `rvm` to be installed. sorry about that, multiruby dudes.
|
7
|
+
#
|
8
|
+
|
9
|
+
RUBIES="ruby-1.9.3 jruby-1.6.5 ree-1.8.7 ruby-1.9.2 ruby-1.8.7"
|
10
|
+
TEST_LOG=test.log
|
11
|
+
VALGRIND_LOG=valgrind.log
|
12
|
+
|
13
|
+
# Load RVM into a shell session *as a function*
|
14
|
+
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
|
15
|
+
source "$HOME/.rvm/scripts/rvm"
|
16
|
+
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
|
17
|
+
source "/usr/local/rvm/scripts/rvm"
|
18
|
+
else
|
19
|
+
echo "ERROR: An RVM installation was not found.\n"
|
20
|
+
fi
|
21
|
+
|
22
|
+
> $TEST_LOG
|
23
|
+
> $VALGRIND_LOG
|
24
|
+
set -o errexit
|
25
|
+
|
26
|
+
function rvm_use {
|
27
|
+
current_ruby=$1
|
28
|
+
rvm use "${1}@nokogiri" --create
|
29
|
+
}
|
30
|
+
|
31
|
+
function generate_parser_and_tokenizer {
|
32
|
+
old_ruby=$current_ruby
|
33
|
+
rvm_use ruby-1.8.7
|
34
|
+
bundle exec rake generate 2>&1 > /dev/null
|
35
|
+
rvm_use $old_ruby
|
36
|
+
}
|
37
|
+
|
38
|
+
function clean {
|
39
|
+
bundle exec rake clean clobber 2>&1 > /dev/null
|
40
|
+
}
|
41
|
+
|
42
|
+
function compile {
|
43
|
+
echo "** compiling ..."
|
44
|
+
generate_parser_and_tokenizer
|
45
|
+
bundle exec rake compile 2>&1 > /dev/null
|
46
|
+
}
|
47
|
+
|
48
|
+
for ruby in $RUBIES ; do
|
49
|
+
rvm_use ${ruby}
|
50
|
+
if gem list bundler | fgrep -v 1.1.rc 2>&1 > /dev/null ; then
|
51
|
+
gem install bundler --pre
|
52
|
+
fi
|
53
|
+
bundle install --quiet --local || bundle install
|
54
|
+
clean
|
55
|
+
done
|
56
|
+
|
57
|
+
for ruby in $RUBIES ; do
|
58
|
+
rvm_use ${ruby}
|
59
|
+
echo -e "**\n** testing nokogiri on ${ruby}\n**" | tee -a $TEST_LOG
|
60
|
+
clean
|
61
|
+
compile
|
62
|
+
echo "** running tests ..."
|
63
|
+
if [[ $ruby =~ "jruby" ]] ; then
|
64
|
+
# I get:
|
65
|
+
# /usr/lib/jvm/java-7-oracle/bin/java: symbol lookup error: /home/mike/.rvm/gems/jruby-1.6.5@nokogiri/gems/racc-1.4.7/lib/racc/cparse.so: undefined symbol: rb_catch
|
66
|
+
# if I use 'bundle exec' with jruby. Anybody?
|
67
|
+
rake test 2>&1 | tee -a $TEST_LOG
|
68
|
+
else
|
69
|
+
bundle exec rake test 2>&1 | tee -a $TEST_LOG
|
70
|
+
fi
|
71
|
+
clean
|
72
|
+
done
|
73
|
+
|
74
|
+
for ruby in $RUBIES ; do
|
75
|
+
if [[ ! $ruby =~ "jruby" ]] ; then
|
76
|
+
rvm_use ${ruby}
|
77
|
+
echo -e "**\n** nokogiri prerelease: ${ruby}\n**" | tee -a $VALGRIND_LOG
|
78
|
+
clean
|
79
|
+
compile
|
80
|
+
echo "** running valgrind on tests ..."
|
81
|
+
bundle exec rake test:valgrind 2>&1 | tee -a $VALGRIND_LOG
|
82
|
+
clean
|
83
|
+
fi
|
84
|
+
done
|
metadata
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nokogiri
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: -3391518352
|
5
|
+
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 5
|
9
|
+
- 3
|
10
|
+
- rc
|
9
11
|
- 2
|
10
|
-
version: 1.5.
|
12
|
+
version: 1.5.3.rc2
|
11
13
|
platform: x86-mswin32-60
|
12
14
|
authors:
|
13
15
|
- Aaron Patterson
|
@@ -17,7 +19,7 @@ autorequire:
|
|
17
19
|
bindir: bin
|
18
20
|
cert_chain: []
|
19
21
|
|
20
|
-
date: 2012-03-
|
22
|
+
date: 2012-03-22 00:00:00 Z
|
21
23
|
dependencies:
|
22
24
|
- !ruby/object:Gem::Dependency
|
23
25
|
name: hoe-bundler
|
@@ -248,11 +250,16 @@ files:
|
|
248
250
|
- .gemtest
|
249
251
|
- CHANGELOG.ja.rdoc
|
250
252
|
- CHANGELOG.rdoc
|
253
|
+
- C_CODING_STYLE.rdoc
|
251
254
|
- Manifest.txt
|
252
255
|
- README.ja.rdoc
|
253
256
|
- README.rdoc
|
257
|
+
- ROADMAP.md
|
254
258
|
- Rakefile
|
259
|
+
- STANDARD_RESPONSES.md
|
260
|
+
- Y_U_NO_GEMSPEC.md
|
255
261
|
- bin/nokogiri
|
262
|
+
- build_all
|
256
263
|
- ext/nokogiri/depend
|
257
264
|
- ext/nokogiri/extconf.rb
|
258
265
|
- ext/nokogiri/html_document.c
|
@@ -384,7 +391,6 @@ files:
|
|
384
391
|
- lib/nokogiri/xslt.rb
|
385
392
|
- lib/nokogiri/xslt/stylesheet.rb
|
386
393
|
- lib/xsd/xmlparser/nokogiri.rb
|
387
|
-
- nokogiri_help_responses.md
|
388
394
|
- tasks/cross_compile.rb
|
389
395
|
- tasks/nokogiri.org.rb
|
390
396
|
- tasks/test.rb
|
@@ -414,7 +420,9 @@ files:
|
|
414
420
|
- test/files/staff.xml
|
415
421
|
- test/files/staff.xslt
|
416
422
|
- test/files/tlm.html
|
423
|
+
- test/files/to_be_xincluded.xml
|
417
424
|
- test/files/valid_bar.xml
|
425
|
+
- test/files/xinclude.xml
|
418
426
|
- test/helper.rb
|
419
427
|
- test/html/sax/test_parser.rb
|
420
428
|
- test/html/sax/test_parser_context.rb
|
@@ -442,6 +450,7 @@ files:
|
|
442
450
|
- test/xml/test_attr.rb
|
443
451
|
- test/xml/test_attribute_decl.rb
|
444
452
|
- test/xml/test_builder.rb
|
453
|
+
- test/xml/test_c14n.rb
|
445
454
|
- test/xml/test_cdata.rb
|
446
455
|
- test/xml/test_comment.rb
|
447
456
|
- test/xml/test_document.rb
|
@@ -457,9 +466,9 @@ files:
|
|
457
466
|
- test/xml/test_node.rb
|
458
467
|
- test/xml/test_node_attributes.rb
|
459
468
|
- test/xml/test_node_encoding.rb
|
469
|
+
- test/xml/test_node_inheritance.rb
|
460
470
|
- test/xml/test_node_reparenting.rb
|
461
471
|
- test/xml/test_node_set.rb
|
462
|
-
- test/xml/test_node_inheritance.rb
|
463
472
|
- test/xml/test_parse_options.rb
|
464
473
|
- test/xml/test_processing_instruction.rb
|
465
474
|
- test/xml/test_reader_encoding.rb
|
@@ -468,12 +477,11 @@ files:
|
|
468
477
|
- test/xml/test_syntax_error.rb
|
469
478
|
- test/xml/test_text.rb
|
470
479
|
- test/xml/test_unparented_node.rb
|
480
|
+
- test/xml/test_xinclude.rb
|
471
481
|
- test/xml/test_xpath.rb
|
472
482
|
- test/xslt/test_custom_functions.rb
|
473
483
|
- test/xslt/test_exception_handling.rb
|
474
|
-
-
|
475
|
-
- test/xml/test_xinclude.rb
|
476
|
-
- C_CODING_STYLE.rdoc
|
484
|
+
- test_all
|
477
485
|
- lib/nokogiri/nokogiri.rb
|
478
486
|
- lib/nokogiri/1.8/nokogiri.so
|
479
487
|
- lib/nokogiri/1.9/nokogiri.so
|
@@ -500,16 +508,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
500
508
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
501
509
|
none: false
|
502
510
|
requirements:
|
503
|
-
- - "
|
511
|
+
- - ">"
|
504
512
|
- !ruby/object:Gem::Version
|
505
|
-
hash:
|
513
|
+
hash: 25
|
506
514
|
segments:
|
507
|
-
-
|
508
|
-
|
515
|
+
- 1
|
516
|
+
- 3
|
517
|
+
- 1
|
518
|
+
version: 1.3.1
|
509
519
|
requirements: []
|
510
520
|
|
511
521
|
rubyforge_project: nokogiri
|
512
|
-
rubygems_version: 1.8.
|
522
|
+
rubygems_version: 1.8.17
|
513
523
|
signing_key:
|
514
524
|
specification_version: 3
|
515
525
|
summary: "Nokogiri (\xE9\x8B\xB8) is an HTML, XML, SAX, and Reader parser"
|