nokogiri 1.4.3.1-java → 1.5.0-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gemtest +0 -0
- data/CHANGELOG.ja.rdoc +113 -0
- data/CHANGELOG.rdoc +113 -1
- data/Manifest.txt +72 -68
- data/README.ja.rdoc +4 -4
- data/README.rdoc +31 -7
- data/Rakefile +110 -132
- data/bin/nokogiri +7 -3
- data/ext/java/nokogiri/EncodingHandler.java +124 -0
- data/ext/java/nokogiri/HtmlDocument.java +119 -0
- data/ext/java/nokogiri/HtmlElementDescription.java +145 -0
- data/ext/java/nokogiri/HtmlEntityLookup.java +79 -0
- data/ext/java/nokogiri/HtmlSaxParserContext.java +259 -0
- data/ext/java/nokogiri/NokogiriService.java +590 -0
- data/ext/java/nokogiri/XmlAttr.java +180 -0
- data/ext/java/nokogiri/XmlAttributeDecl.java +130 -0
- data/ext/java/nokogiri/XmlCdata.java +84 -0
- data/ext/java/nokogiri/XmlComment.java +86 -0
- data/ext/java/nokogiri/XmlDocument.java +519 -0
- data/ext/java/nokogiri/XmlDocumentFragment.java +223 -0
- data/ext/java/nokogiri/XmlDtd.java +469 -0
- data/ext/java/nokogiri/XmlElement.java +195 -0
- data/ext/java/nokogiri/XmlElementContent.java +382 -0
- data/ext/java/nokogiri/XmlElementDecl.java +152 -0
- data/ext/java/nokogiri/XmlEntityDecl.java +162 -0
- data/ext/java/nokogiri/XmlEntityReference.java +97 -0
- data/ext/java/nokogiri/XmlNamespace.java +183 -0
- data/ext/java/nokogiri/XmlNode.java +1378 -0
- data/ext/java/nokogiri/XmlNodeSet.java +267 -0
- data/ext/java/nokogiri/XmlProcessingInstruction.java +99 -0
- data/ext/java/nokogiri/XmlReader.java +408 -0
- data/ext/java/nokogiri/XmlRelaxng.java +144 -0
- data/ext/java/nokogiri/XmlSaxParserContext.java +367 -0
- data/ext/java/nokogiri/XmlSaxPushParser.java +184 -0
- data/ext/java/nokogiri/XmlSchema.java +324 -0
- data/ext/java/nokogiri/XmlSyntaxError.java +119 -0
- data/ext/java/nokogiri/XmlText.java +119 -0
- data/ext/java/nokogiri/XmlXpathContext.java +199 -0
- data/ext/java/nokogiri/XsltStylesheet.java +197 -0
- data/ext/java/nokogiri/internals/HtmlDomParserContext.java +204 -0
- data/ext/java/nokogiri/internals/NokogiriDocumentCache.java +73 -0
- data/ext/java/nokogiri/internals/NokogiriErrorHandler.java +86 -0
- data/ext/java/nokogiri/internals/NokogiriHandler.java +327 -0
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +639 -0
- data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +167 -0
- data/ext/java/nokogiri/internals/NokogiriNamespaceContext.java +130 -0
- data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler.java +74 -0
- data/ext/java/nokogiri/internals/NokogiriNonStrictErrorHandler4NekoHtml.java +121 -0
- data/ext/java/nokogiri/internals/NokogiriStrictErrorHandler.java +79 -0
- data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +141 -0
- data/ext/java/nokogiri/internals/NokogiriXPathFunctionResolver.java +73 -0
- data/ext/java/nokogiri/internals/NokogiriXPathVariableResolver.java +67 -0
- data/ext/java/nokogiri/internals/NokogiriXsltErrorListener.java +86 -0
- data/ext/java/nokogiri/internals/ParserContext.java +276 -0
- data/ext/java/nokogiri/internals/PushInputStream.java +411 -0
- data/ext/java/nokogiri/internals/ReaderNode.java +531 -0
- data/ext/java/nokogiri/internals/SaveContextVisitor.java +567 -0
- data/ext/java/nokogiri/internals/SchemaErrorHandler.java +76 -0
- data/ext/java/nokogiri/internals/XmlDeclHandler.java +42 -0
- data/ext/java/nokogiri/internals/XmlDomParser.java +76 -0
- data/ext/java/nokogiri/internals/XmlDomParserContext.java +244 -0
- data/ext/java/nokogiri/internals/XmlSaxParser.java +65 -0
- data/ext/java/nokogiri/internals/XsltExtensionFunction.java +72 -0
- data/ext/nokogiri/depend +358 -32
- data/ext/nokogiri/extconf.rb +10 -6
- data/ext/nokogiri/nokogiri.c +23 -3
- data/ext/nokogiri/nokogiri.h +7 -2
- data/ext/nokogiri/xml_document.c +9 -0
- data/ext/nokogiri/xml_dtd.c +2 -2
- data/ext/nokogiri/xml_io.c +32 -7
- data/ext/nokogiri/xml_node.c +45 -25
- data/ext/nokogiri/xml_node_set.c +1 -1
- data/ext/nokogiri/xml_relax_ng.c +0 -7
- data/ext/nokogiri/xml_sax_parser.c +14 -7
- data/ext/nokogiri/xml_sax_parser_context.c +40 -0
- data/ext/nokogiri/xml_xpath_context.c +33 -2
- data/ext/nokogiri/xslt_stylesheet.c +128 -6
- data/lib/isorelax.jar +0 -0
- data/lib/jing.jar +0 -0
- data/lib/nekodtd.jar +0 -0
- data/lib/nekohtml.jar +0 -0
- data/lib/nokogiri/css/parser.rb +665 -70
- data/lib/nokogiri/css/parser.y +3 -1
- data/lib/nokogiri/css/parser_extras.rb +91 -0
- data/lib/nokogiri/css/tokenizer.rb +148 -3
- data/lib/nokogiri/css/tokenizer.rex +1 -1
- data/lib/nokogiri/css/xpath_visitor.rb +15 -7
- data/lib/nokogiri/css.rb +5 -3
- data/lib/nokogiri/decorators/slop.rb +5 -3
- data/lib/nokogiri/html/document.rb +142 -19
- data/lib/nokogiri/html/document_fragment.rb +19 -17
- data/lib/nokogiri/html/element_description_defaults.rb +671 -0
- data/lib/nokogiri/html/sax/parser.rb +6 -2
- data/lib/nokogiri/html.rb +1 -0
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/version.rb +76 -26
- data/lib/nokogiri/xml/attribute_decl.rb +1 -1
- data/lib/nokogiri/xml/builder.rb +7 -0
- data/lib/nokogiri/xml/document.rb +43 -2
- data/lib/nokogiri/xml/document_fragment.rb +16 -2
- data/lib/nokogiri/xml/dtd.rb +12 -1
- data/lib/nokogiri/xml/element_decl.rb +1 -1
- data/lib/nokogiri/xml/entity_decl.rb +1 -1
- data/lib/nokogiri/xml/node/save_options.rb +20 -1
- data/lib/nokogiri/xml/node.rb +198 -78
- data/lib/nokogiri/xml/node_set.rb +10 -3
- data/lib/nokogiri/xml/parse_options.rb +8 -0
- data/lib/nokogiri/xml/reader.rb +42 -6
- data/lib/nokogiri/xml/sax/document.rb +4 -2
- data/lib/nokogiri/xml/schema.rb +7 -1
- data/lib/nokogiri/xslt/stylesheet.rb +1 -1
- data/lib/nokogiri/xslt.rb +9 -5
- data/lib/nokogiri.rb +19 -25
- data/lib/xercesImpl.jar +0 -0
- data/nokogiri_help_responses.md +40 -0
- data/tasks/cross_compile.rb +130 -136
- data/tasks/nokogiri.org.rb +18 -0
- data/tasks/test.rb +2 -2
- data/test/css/test_parser.rb +29 -18
- data/test/css/test_tokenizer.rb +8 -0
- data/test/decorators/test_slop.rb +16 -0
- data/test/files/encoding.html +82 -0
- data/test/files/encoding.xhtml +84 -0
- data/test/files/metacharset.html +10 -0
- data/test/files/noencoding.html +47 -0
- data/test/helper.rb +5 -1
- data/test/html/sax/test_parser.rb +65 -3
- data/test/html/test_document.rb +75 -1
- data/test/html/test_document_encoding.rb +61 -0
- data/test/html/test_document_fragment.rb +50 -5
- data/test/html/test_element_description.rb +4 -2
- data/test/html/test_node.rb +9 -0
- data/test/test_memory_leak.rb +20 -35
- data/test/test_nokogiri.rb +14 -20
- data/test/test_reader.rb +23 -6
- data/test/test_xslt_transforms.rb +6 -2
- data/test/xml/node/test_save_options.rb +10 -2
- data/test/xml/sax/test_parser.rb +39 -8
- data/test/xml/sax/test_parser_context.rb +50 -0
- data/test/xml/sax/test_push_parser.rb +18 -1
- data/test/xml/test_attribute_decl.rb +7 -3
- data/test/xml/test_builder.rb +17 -0
- data/test/xml/test_document.rb +34 -5
- data/test/xml/test_document_fragment.rb +14 -2
- data/test/xml/test_dtd.rb +28 -3
- data/test/xml/test_element_content.rb +1 -1
- data/test/xml/test_element_decl.rb +1 -1
- data/test/xml/test_entity_decl.rb +12 -10
- data/test/xml/test_namespace.rb +7 -5
- data/test/xml/test_node.rb +65 -13
- data/test/xml/test_node_reparenting.rb +72 -31
- data/test/xml/test_node_set.rb +57 -0
- data/test/xml/test_schema.rb +5 -0
- data/test/xml/test_xpath.rb +32 -0
- data/test/xslt/test_custom_functions.rb +94 -0
- data/test/xslt/test_exception_handling.rb +37 -0
- metadata +512 -517
- data/deps.rip +0 -5
- data/ext/nokogiri/libcharset-1.dll +0 -0
- data/ext/nokogiri/libexslt.dll +0 -0
- data/ext/nokogiri/libiconv-2.dll +0 -0
- data/ext/nokogiri/libxml2.dll +0 -0
- data/ext/nokogiri/libxslt.dll +0 -0
- data/ext/nokogiri/zlib1.dll +0 -0
- data/lib/nokogiri/css/generated_parser.rb +0 -676
- data/lib/nokogiri/css/generated_tokenizer.rb +0 -146
- data/lib/nokogiri/ffi/encoding_handler.rb +0 -42
- data/lib/nokogiri/ffi/html/document.rb +0 -28
- data/lib/nokogiri/ffi/html/element_description.rb +0 -81
- data/lib/nokogiri/ffi/html/entity_lookup.rb +0 -16
- data/lib/nokogiri/ffi/html/sax/parser_context.rb +0 -38
- data/lib/nokogiri/ffi/io_callbacks.rb +0 -42
- data/lib/nokogiri/ffi/libxml.rb +0 -411
- data/lib/nokogiri/ffi/structs/common_node.rb +0 -38
- data/lib/nokogiri/ffi/structs/html_elem_desc.rb +0 -24
- data/lib/nokogiri/ffi/structs/html_entity_desc.rb +0 -13
- data/lib/nokogiri/ffi/structs/xml_alloc.rb +0 -16
- data/lib/nokogiri/ffi/structs/xml_attr.rb +0 -19
- data/lib/nokogiri/ffi/structs/xml_attribute.rb +0 -27
- data/lib/nokogiri/ffi/structs/xml_buffer.rb +0 -16
- data/lib/nokogiri/ffi/structs/xml_char_encoding_handler.rb +0 -11
- data/lib/nokogiri/ffi/structs/xml_document.rb +0 -117
- data/lib/nokogiri/ffi/structs/xml_dtd.rb +0 -28
- data/lib/nokogiri/ffi/structs/xml_element.rb +0 -26
- data/lib/nokogiri/ffi/structs/xml_element_content.rb +0 -17
- data/lib/nokogiri/ffi/structs/xml_entity.rb +0 -32
- data/lib/nokogiri/ffi/structs/xml_enumeration.rb +0 -12
- data/lib/nokogiri/ffi/structs/xml_node.rb +0 -28
- data/lib/nokogiri/ffi/structs/xml_node_set.rb +0 -53
- data/lib/nokogiri/ffi/structs/xml_notation.rb +0 -11
- data/lib/nokogiri/ffi/structs/xml_ns.rb +0 -15
- data/lib/nokogiri/ffi/structs/xml_parser_context.rb +0 -19
- data/lib/nokogiri/ffi/structs/xml_relax_ng.rb +0 -14
- data/lib/nokogiri/ffi/structs/xml_sax_handler.rb +0 -51
- data/lib/nokogiri/ffi/structs/xml_sax_push_parser_context.rb +0 -124
- data/lib/nokogiri/ffi/structs/xml_schema.rb +0 -13
- data/lib/nokogiri/ffi/structs/xml_syntax_error.rb +0 -31
- data/lib/nokogiri/ffi/structs/xml_text_reader.rb +0 -12
- data/lib/nokogiri/ffi/structs/xml_xpath_context.rb +0 -38
- data/lib/nokogiri/ffi/structs/xml_xpath_object.rb +0 -35
- data/lib/nokogiri/ffi/structs/xml_xpath_parser_context.rb +0 -20
- data/lib/nokogiri/ffi/structs/xslt_stylesheet.rb +0 -13
- data/lib/nokogiri/ffi/weak_bucket.rb +0 -40
- data/lib/nokogiri/ffi/xml/attr.rb +0 -41
- data/lib/nokogiri/ffi/xml/attribute_decl.rb +0 -27
- data/lib/nokogiri/ffi/xml/cdata.rb +0 -19
- data/lib/nokogiri/ffi/xml/comment.rb +0 -18
- data/lib/nokogiri/ffi/xml/document.rb +0 -166
- data/lib/nokogiri/ffi/xml/document_fragment.rb +0 -21
- data/lib/nokogiri/ffi/xml/dtd.rb +0 -67
- data/lib/nokogiri/ffi/xml/element_content.rb +0 -43
- data/lib/nokogiri/ffi/xml/element_decl.rb +0 -19
- data/lib/nokogiri/ffi/xml/entity_decl.rb +0 -36
- data/lib/nokogiri/ffi/xml/entity_reference.rb +0 -19
- data/lib/nokogiri/ffi/xml/namespace.rb +0 -44
- data/lib/nokogiri/ffi/xml/node.rb +0 -554
- data/lib/nokogiri/ffi/xml/node_set.rb +0 -149
- data/lib/nokogiri/ffi/xml/processing_instruction.rb +0 -20
- data/lib/nokogiri/ffi/xml/reader.rb +0 -236
- data/lib/nokogiri/ffi/xml/relax_ng.rb +0 -85
- data/lib/nokogiri/ffi/xml/sax/parser.rb +0 -135
- data/lib/nokogiri/ffi/xml/sax/parser_context.rb +0 -67
- data/lib/nokogiri/ffi/xml/sax/push_parser.rb +0 -51
- data/lib/nokogiri/ffi/xml/schema.rb +0 -109
- data/lib/nokogiri/ffi/xml/syntax_error.rb +0 -98
- data/lib/nokogiri/ffi/xml/text.rb +0 -18
- data/lib/nokogiri/ffi/xml/xpath.rb +0 -9
- data/lib/nokogiri/ffi/xml/xpath_context.rb +0 -148
- data/lib/nokogiri/ffi/xslt/stylesheet.rb +0 -53
- data/lib/nokogiri/version_warning.rb +0 -14
- data/test/ffi/test_document.rb +0 -35
|
@@ -6,7 +6,7 @@ module Nokogiri
|
|
|
6
6
|
# an XML::Document with a Stylesheet:
|
|
7
7
|
#
|
|
8
8
|
# doc = Nokogiri::XML(File.read('some_file.xml'))
|
|
9
|
-
# xslt =
|
|
9
|
+
# xslt = Nokogiri::XSLT(File.read('some_transformer.xslt'))
|
|
10
10
|
#
|
|
11
11
|
# puts xslt.transform(doc)
|
|
12
12
|
#
|
data/lib/nokogiri/xslt.rb
CHANGED
|
@@ -9,8 +9,8 @@ module Nokogiri
|
|
|
9
9
|
#
|
|
10
10
|
# xslt = Nokogiri::XSLT(File.read(ARGV[0]))
|
|
11
11
|
#
|
|
12
|
-
def XSLT stylesheet
|
|
13
|
-
XSLT.parse(stylesheet)
|
|
12
|
+
def XSLT stylesheet, modules = {}
|
|
13
|
+
XSLT.parse(stylesheet, modules)
|
|
14
14
|
end
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -20,11 +20,15 @@ module Nokogiri
|
|
|
20
20
|
module XSLT
|
|
21
21
|
class << self
|
|
22
22
|
###
|
|
23
|
-
# Parse the stylesheet in +string+
|
|
24
|
-
def parse string
|
|
23
|
+
# Parse the stylesheet in +string+, register any +modules+
|
|
24
|
+
def parse string, modules = {}
|
|
25
|
+
modules.each do |url, klass|
|
|
26
|
+
XSLT.register url, klass
|
|
27
|
+
end
|
|
28
|
+
|
|
25
29
|
Stylesheet.parse_stylesheet_doc(XML.parse(string))
|
|
26
30
|
end
|
|
27
|
-
|
|
31
|
+
|
|
28
32
|
###
|
|
29
33
|
# Quote parameters in +params+ for stylesheet safety
|
|
30
34
|
def quote_params params
|
data/lib/nokogiri.rb
CHANGED
|
@@ -6,32 +6,26 @@ ENV['PATH'] = [File.expand_path(
|
|
|
6
6
|
File.join(File.dirname(__FILE__), "..", "ext", "nokogiri")
|
|
7
7
|
), ENV['PATH']].compact.join(';') if RbConfig::CONFIG['host_os'] =~ /(mswin|mingw)/i
|
|
8
8
|
|
|
9
|
-
if
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
|
|
10
|
+
# The line below caused a problem on non-GAE rack environment.
|
|
11
|
+
# unless defined?(JRuby::Rack::VERSION) || defined?(AppEngine::ApiProxy)
|
|
12
|
+
#
|
|
13
|
+
# However, simply cutting defined?(JRuby::Rack::VERSION) off resulted in
|
|
14
|
+
# an unable-to-load-nokogiri problem. Thus, now, Nokogiri checks the presense
|
|
15
|
+
# of appengine-rack.jar in $LOAD_PATH. If Nokogiri is on GAE, Nokogiri
|
|
16
|
+
# should skip loading xml jars. This is because those are in WEB-INF/lib and
|
|
17
|
+
# already set in the classpath.
|
|
18
|
+
unless $LOAD_PATH.to_s.include?("appengine-rack")
|
|
19
|
+
require 'isorelax.jar'
|
|
20
|
+
require 'jing.jar'
|
|
21
|
+
require 'nekohtml.jar'
|
|
22
|
+
require 'nekodtd.jar'
|
|
23
|
+
require 'xercesImpl.jar'
|
|
24
|
+
end
|
|
14
25
|
end
|
|
15
26
|
|
|
16
|
-
|
|
17
|
-
!!! DEPRECATION WARNING !!!
|
|
18
|
-
Hey Champ! I see you're using Ruby 1.8.6! While I applaud you for sticking to
|
|
19
|
-
your guns and using The One True Ruby, I have to let you know that we're going
|
|
20
|
-
to stop supporting 1.8.6. I know, it's sad. But, we just don't have time to
|
|
21
|
-
support every version of Ruby out there. Whether we like it or not, time moves
|
|
22
|
-
forward and so does our software.
|
|
23
|
-
|
|
24
|
-
On August 1, 2010, we will no longer support Ruby 1.8.6. If nokogiri happens to
|
|
25
|
-
work on 1.8.6 after that date, then great! We will hownever, no longer test,
|
|
26
|
-
use, or endorse 1.8.6 as a supported platform.
|
|
27
|
-
|
|
28
|
-
Thanks,
|
|
29
|
-
|
|
30
|
-
Team Nokogiri
|
|
31
|
-
eowarn
|
|
32
|
-
|
|
27
|
+
require 'nokogiri/nokogiri'
|
|
33
28
|
require 'nokogiri/version'
|
|
34
|
-
require 'nokogiri/version_warning'
|
|
35
29
|
require 'nokogiri/syntax_error'
|
|
36
30
|
require 'nokogiri/xml'
|
|
37
31
|
require 'nokogiri/xslt'
|
|
@@ -73,13 +67,13 @@ module Nokogiri
|
|
|
73
67
|
doc =
|
|
74
68
|
if string.respond_to?(:read) ||
|
|
75
69
|
string =~ /^\s*<[^Hh>]*html/i # Probably html
|
|
76
|
-
Nokogiri
|
|
70
|
+
Nokogiri.HTML(
|
|
77
71
|
string,
|
|
78
72
|
url,
|
|
79
73
|
encoding, options || XML::ParseOptions::DEFAULT_HTML
|
|
80
74
|
)
|
|
81
75
|
else
|
|
82
|
-
Nokogiri
|
|
76
|
+
Nokogiri.XML(string, url, encoding,
|
|
83
77
|
options || XML::ParseOptions::DEFAULT_XML)
|
|
84
78
|
end
|
|
85
79
|
yield doc if block_given?
|
data/lib/xercesImpl.jar
ADDED
|
Binary file
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# not-enough-information
|
|
2
|
+
|
|
3
|
+
Hello!
|
|
4
|
+
|
|
5
|
+
Thanks for asking this question! However, without more information,
|
|
6
|
+
Team Nokogiri cannot reproduce your issue, and so we cannot offer much
|
|
7
|
+
help.
|
|
8
|
+
|
|
9
|
+
Please provide us with:
|
|
10
|
+
|
|
11
|
+
* A self-contained script (one that we can run without modification,
|
|
12
|
+
and preferably without making external network connections).
|
|
13
|
+
|
|
14
|
+
* Please note that you need to include the XML/HTML that you are
|
|
15
|
+
operating on.
|
|
16
|
+
|
|
17
|
+
* The output of `nokogiri -v`, which will provide details about your
|
|
18
|
+
platform and versions of ruby, libxml2 and nokogiri.
|
|
19
|
+
|
|
20
|
+
For more information about requesting help or reporting bugs, please
|
|
21
|
+
take a look at http://bit.ly/nokohelp
|
|
22
|
+
|
|
23
|
+
Thank you so much!
|
|
24
|
+
|
|
25
|
+
# not-a-bug
|
|
26
|
+
|
|
27
|
+
Hello!
|
|
28
|
+
|
|
29
|
+
Thanks for asking this question! Your request for help will not go
|
|
30
|
+
unanswered!
|
|
31
|
+
|
|
32
|
+
However, Nokogiri's Github Issues is reserved for reporting bugs or
|
|
33
|
+
submitting patches. If you ask your question on the mailing list, Team
|
|
34
|
+
Nokogiri promises someone will provide you with an answer in a timely
|
|
35
|
+
manner.
|
|
36
|
+
|
|
37
|
+
If you'd like to read up on Team Nokogiri's rationale for this policy,
|
|
38
|
+
please go to http://bit.ly/nokohelp.
|
|
39
|
+
|
|
40
|
+
Thank you so much for understanding! And thank you for using Nokogiri.
|
data/tasks/cross_compile.rb
CHANGED
|
@@ -1,158 +1,152 @@
|
|
|
1
1
|
require 'rake/extensioncompiler'
|
|
2
2
|
HOST = Rake::ExtensionCompiler.mingw_host
|
|
3
|
-
TARGET = 'i386-pc-mingw32'
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
Dir.chdir('tmp/cross/download') do
|
|
18
|
-
sh "wget #{url} || curl -O #{url}"
|
|
19
|
-
sh "tar zxvf #{file}.tar.gz"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
Dir.chdir t.name do
|
|
23
|
-
mk = File.read('win32/Makefile.gcc')
|
|
24
|
-
File.open('win32/Makefile.gcc', 'wb') do |f|
|
|
25
|
-
f.puts "BINARY_PATH = #{CROSS_DIR}/bin"
|
|
26
|
-
f.puts "LIBRARY_PATH = #{CROSS_DIR}/lib"
|
|
27
|
-
f.puts "INCLUDE_PATH = #{CROSS_DIR}/include"
|
|
28
|
-
|
|
29
|
-
# FIXME: need to make the cross compiler dynamic
|
|
30
|
-
f.puts mk.sub(/^PREFIX\s*=\s*$/, "PREFIX = #{HOST}-") #.
|
|
31
|
-
#sub(/^SHARED_MODE=0$/, 'SHARED_MODE=1').
|
|
32
|
-
#sub(/^IMPLIB\s*=.*$/, 'IMPLIB=libz.dll.a')
|
|
33
|
-
end
|
|
4
|
+
require 'mini_portile'
|
|
5
|
+
$recipes = {}
|
|
6
|
+
$recipes[:zlib] = MiniPortile.new "zlib", "1.2.5"
|
|
7
|
+
$recipes[:libiconv] = MiniPortile.new "libiconv", "1.13.1"
|
|
8
|
+
$recipes[:libxml2] = MiniPortile.new "libxml2", "2.7.7"
|
|
9
|
+
$recipes[:libxslt] = MiniPortile.new "libxslt", "1.1.26"
|
|
10
|
+
$recipes.each { |_, recipe| recipe.host = HOST }
|
|
11
|
+
|
|
12
|
+
file "lib/nokogiri/nokogiri.rb" do
|
|
13
|
+
File.open("lib/nokogiri/nokogiri.rb", 'wb') do |f|
|
|
14
|
+
f.write %Q{require "nokogiri/\#{RUBY_VERSION.sub(/\\.\\d+$/, '')}/nokogiri"\n}
|
|
34
15
|
end
|
|
35
16
|
end
|
|
36
17
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
end
|
|
69
|
-
### End build iconv ###
|
|
70
|
-
|
|
71
|
-
### Build libxml2 ###
|
|
72
|
-
file "tmp/cross/download/#{LIBXML}" do |t|
|
|
73
|
-
FileUtils.mkdir_p('tmp/cross/download')
|
|
74
|
-
|
|
75
|
-
file = LIBXML
|
|
76
|
-
url = "ftp://ftp.xmlsoft.org/libxml2/#{file}.tar.gz"
|
|
77
|
-
|
|
78
|
-
Dir.chdir('tmp/cross/download') do
|
|
79
|
-
sh "wget #{url} || curl -O #{url}"
|
|
80
|
-
sh "tar zxvf #{file}.tar.gz"
|
|
81
|
-
end
|
|
82
|
-
|
|
83
|
-
Dir.chdir t.name do
|
|
84
|
-
# FIXME: need to make the host dynamic
|
|
85
|
-
sh "CFLAGS='-DIN_LIBXML' ./configure --host=#{HOST} --target=#{TARGET} --enable-static --disable-shared --prefix=#{CROSS_DIR} --with-zlib=#{CROSS_DIR} --with-iconv=#{CROSS_DIR} --without-python --without-readline"
|
|
86
|
-
end
|
|
87
|
-
end
|
|
18
|
+
namespace :cross do
|
|
19
|
+
task :zlib do
|
|
20
|
+
recipe = $recipes[:zlib]
|
|
21
|
+
recipe.files = ["http://zlib.net/#{recipe.name}-#{recipe.version}.tar.gz"]
|
|
22
|
+
class << recipe
|
|
23
|
+
def configure
|
|
24
|
+
Dir.chdir work_path do
|
|
25
|
+
mk = File.read 'win32/Makefile.gcc'
|
|
26
|
+
File.open 'win32/Makefile.gcc', 'wb' do |f|
|
|
27
|
+
f.puts "BINARY_PATH = #{CROSS_DIR}/bin"
|
|
28
|
+
f.puts "LIBRARY_PATH = #{CROSS_DIR}/lib"
|
|
29
|
+
f.puts "INCLUDE_PATH = #{CROSS_DIR}/include"
|
|
30
|
+
f.puts mk.sub(/^PREFIX\s*=\s*$/, "PREFIX = #{HOST}-")
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def configured?
|
|
36
|
+
Dir.chdir work_path do
|
|
37
|
+
!! (File.read('win32/Makefile.gcc') =~ /^BINARY_PATH/)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def compile
|
|
42
|
+
execute "compile", "make -f win32/Makefile.gcc"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def install
|
|
46
|
+
execute "install", "make -f win32/Makefile.gcc install"
|
|
47
|
+
end
|
|
48
|
+
end
|
|
88
49
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
50
|
+
checkpoint = "#{CROSS_DIR}/#{recipe.name}-#{recipe.version}.installed"
|
|
51
|
+
unless File.exist?(checkpoint)
|
|
52
|
+
recipe.cook
|
|
53
|
+
touch checkpoint
|
|
54
|
+
end
|
|
55
|
+
recipe.activate
|
|
93
56
|
end
|
|
94
|
-
end
|
|
95
|
-
### End build libxml2 ###
|
|
96
|
-
|
|
97
|
-
### Build libxslt ###
|
|
98
|
-
file "tmp/cross/download/#{LIBXSLT}" do |t|
|
|
99
|
-
FileUtils.mkdir_p('tmp/cross/download')
|
|
100
57
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
58
|
+
task :libiconv do
|
|
59
|
+
recipe = $recipes[:libiconv]
|
|
60
|
+
recipe.files = ["http://ftp.gnu.org/pub/gnu/libiconv/#{recipe.name}-#{recipe.version}.tar.gz"]
|
|
61
|
+
recipe.configure_options = [
|
|
62
|
+
"--host=#{HOST}",
|
|
63
|
+
"--enable-static",
|
|
64
|
+
"--disable-shared",
|
|
65
|
+
"CPPFLAGS='-mno-cygwin -Wall'",
|
|
66
|
+
"CFLAGS='-mno-cygwin -O2 -g'",
|
|
67
|
+
"CXXFLAGS='-mno-cygwin -O2 -g'",
|
|
68
|
+
"LDFLAGS=-mno-cygwin"
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
checkpoint = "#{CROSS_DIR}/#{recipe.name}-#{recipe.version}.installed"
|
|
72
|
+
unless File.exist?(checkpoint)
|
|
73
|
+
recipe.cook
|
|
74
|
+
touch checkpoint
|
|
75
|
+
end
|
|
76
|
+
recipe.activate
|
|
107
77
|
end
|
|
108
78
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
79
|
+
task :libxml2 => ["cross:zlib", "cross:libiconv"] do
|
|
80
|
+
recipe = $recipes[:libxml2]
|
|
81
|
+
recipe.files = ["ftp://ftp.xmlsoft.org/libxml2/#{recipe.name}-#{recipe.version}.tar.gz"]
|
|
82
|
+
recipe.configure_options = [
|
|
83
|
+
"--host=#{HOST}",
|
|
84
|
+
"--enable-static",
|
|
85
|
+
"--disable-shared",
|
|
86
|
+
"--with-zlib=#{CROSS_DIR}",
|
|
87
|
+
"--with-iconv=#{$recipes[:libiconv].path}",
|
|
88
|
+
"--without-python",
|
|
89
|
+
"--without-readline",
|
|
90
|
+
"CFLAGS='-DIN_LIBXML'"
|
|
91
|
+
]
|
|
92
|
+
class << recipe
|
|
93
|
+
def download
|
|
94
|
+
Dir.chdir archives_path do
|
|
95
|
+
@files.each do |url|
|
|
96
|
+
sh "wget #{url} || curl -O #{url}"
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
end
|
|
114
101
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
102
|
+
checkpoint = "#{CROSS_DIR}/#{recipe.name}-#{recipe.version}.installed"
|
|
103
|
+
unless File.exist?(checkpoint)
|
|
104
|
+
recipe.cook
|
|
105
|
+
touch checkpoint
|
|
106
|
+
end
|
|
107
|
+
recipe.activate
|
|
119
108
|
end
|
|
120
|
-
end
|
|
121
|
-
### End build libxslt ###
|
|
122
109
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
110
|
+
task :libxslt => ['cross:libxml2'] do
|
|
111
|
+
recipe = $recipes[:libxslt]
|
|
112
|
+
recipe.files = ["ftp://ftp.xmlsoft.org/libxml2/#{recipe.name}-#{recipe.version}.tar.gz"]
|
|
113
|
+
recipe.configure_options = [
|
|
114
|
+
"--host=#{HOST}",
|
|
115
|
+
"--enable-static",
|
|
116
|
+
"--disable-shared",
|
|
117
|
+
"--with-libxml-prefix=#{$recipes[:libxml2].path}",
|
|
118
|
+
"--without-python",
|
|
119
|
+
"--without-crypto",
|
|
120
|
+
"CFLAGS='-DIN_LIBXML'"
|
|
121
|
+
]
|
|
122
|
+
class << recipe
|
|
123
|
+
def download
|
|
124
|
+
Dir.chdir archives_path do
|
|
125
|
+
@files.each do |url|
|
|
126
|
+
sh "wget #{url} || curl -O #{url}"
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
end
|
|
130
131
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
task :libxslt => ['cross:libxml2', 'tmp/cross/bin/xslt-config']
|
|
136
|
-
|
|
137
|
-
task :copy_dlls do
|
|
138
|
-
Dir['tmp/cross/bin/*.dll'].each do |file|
|
|
139
|
-
cp file, "ext/nokogiri"
|
|
132
|
+
checkpoint = "#{CROSS_DIR}/#{recipe.name}-#{recipe.version}.installed"
|
|
133
|
+
unless File.exist?(checkpoint)
|
|
134
|
+
recipe.cook
|
|
135
|
+
touch checkpoint
|
|
140
136
|
end
|
|
137
|
+
recipe.activate
|
|
141
138
|
end
|
|
142
139
|
|
|
143
|
-
task :file_list
|
|
144
|
-
HOE.spec.
|
|
145
|
-
HOE.spec.files += Dir["lib
|
|
146
|
-
HOE.spec.files += Dir["lib/#{HOE.name}/1.{8,9}/#{HOE.name}.so"]
|
|
147
|
-
HOE.spec.files += Dir["ext/nokogiri/*.dll"]
|
|
140
|
+
task :file_list do
|
|
141
|
+
HOE.spec.files += Dir["lib/nokogiri/nokogiri.rb"]
|
|
142
|
+
HOE.spec.files += Dir["lib/nokogiri/1.{8,9}/nokogiri.so"]
|
|
148
143
|
end
|
|
149
144
|
end
|
|
150
145
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
146
|
+
HOE.clean_globs += [
|
|
147
|
+
"#{CROSS_DIR}/*.installed",
|
|
148
|
+
"#{CROSS_DIR}/#{HOST}",
|
|
149
|
+
"tmp/#{HOST}",
|
|
150
|
+
]
|
|
154
151
|
|
|
155
|
-
|
|
156
|
-
Rake::Task[:cross].prerequisites << "lib/nokogiri/nokogiri.rb"
|
|
157
|
-
Rake::Task[:cross].prerequisites << "cross:file_list"
|
|
158
|
-
end
|
|
152
|
+
task :cross => ["cross:libxslt", "lib/nokogiri/nokogiri.rb", "cross:file_list"]
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
namespace :docs do
|
|
2
|
+
desc "generate HTML docs for nokogiri.org"
|
|
3
|
+
task :website do
|
|
4
|
+
title = "#{HOE.name}-#{HOE.version} Documentation"
|
|
5
|
+
|
|
6
|
+
options = []
|
|
7
|
+
options << "--main=#{HOE.readme_file}"
|
|
8
|
+
options << '--format=activerecord'
|
|
9
|
+
options << '--threads=1'
|
|
10
|
+
options << "--title=#{title.inspect}"
|
|
11
|
+
|
|
12
|
+
options += HOE.spec.require_paths
|
|
13
|
+
options += HOE.spec.extra_rdoc_files
|
|
14
|
+
require 'rdoc/rdoc'
|
|
15
|
+
ENV['RAILS_ROOT'] ||= File.expand_path(File.join('..', 'nokogiri_ws'))
|
|
16
|
+
RDoc::RDoc.new.document options
|
|
17
|
+
end
|
|
18
|
+
end
|
data/tasks/test.rb
CHANGED
|
@@ -64,7 +64,7 @@ namespace :test do
|
|
|
64
64
|
end
|
|
65
65
|
|
|
66
66
|
Dir.chdir File.join(MULTI_XML, 'build', filename) do
|
|
67
|
-
system "./configure --prefix=#{install_dir}"
|
|
67
|
+
system "./configure --without-http --prefix=#{install_dir}"
|
|
68
68
|
system "make && make install"
|
|
69
69
|
end
|
|
70
70
|
end
|
|
@@ -73,7 +73,7 @@ namespace :test do
|
|
|
73
73
|
libxslt = Dir[File.join(MULTI_XML, 'install', 'libxslt*')].first
|
|
74
74
|
|
|
75
75
|
directories = ENV['MULTIXML2_DIR'] ? [ENV['MULTIXML2_DIR']] : Dir[File.join(MULTI_XML, 'install', '*')]
|
|
76
|
-
directories.sort.
|
|
76
|
+
directories.sort.reverse_each do |xml2_version|
|
|
77
77
|
next unless xml2_version =~ /libxml2/
|
|
78
78
|
extopts = "--with-xml2-include=#{xml2_version}/include/libxml2 --with-xml2-lib=#{xml2_version}/lib --with-xslt-dir=#{libxslt} --with-iconv-dir=/usr"
|
|
79
79
|
cmd = "#{$0} clean test EXTOPTS='#{extopts}' LD_LIBRARY_PATH='#{xml2_version}/lib'"
|
data/test/css/test_parser.rb
CHANGED
|
@@ -142,30 +142,31 @@ module Nokogiri
|
|
|
142
142
|
|
|
143
143
|
def test_nonstandard_nth_selectors
|
|
144
144
|
## These are non standard CSS
|
|
145
|
-
assert_xpath '//a[position() =
|
|
146
|
-
assert_xpath '//a[position() = 1]',
|
|
147
|
-
assert_xpath '//a[position() =
|
|
148
|
-
assert_xpath '//a[position() = 99]',
|
|
149
|
-
assert_xpath '//a[position() =
|
|
150
|
-
assert_xpath '//a[position() = last()]',
|
|
151
|
-
assert_xpath '//a[node()]',
|
|
145
|
+
assert_xpath '//a[position() = 1]', @parser.parse('a:first()')
|
|
146
|
+
assert_xpath '//a[position() = 1]', @parser.parse('a:first') # no parens
|
|
147
|
+
assert_xpath '//a[position() = 99]', @parser.parse('a:eq(99)')
|
|
148
|
+
assert_xpath '//a[position() = 99]', @parser.parse('a:nth(99)')
|
|
149
|
+
assert_xpath '//a[position() = last()]', @parser.parse('a:last()')
|
|
150
|
+
assert_xpath '//a[position() = last()]', @parser.parse('a:last') # no parens
|
|
151
|
+
assert_xpath '//a[node()]', @parser.parse('a:parent')
|
|
152
152
|
end
|
|
153
153
|
|
|
154
154
|
def test_standard_nth_selectors
|
|
155
|
-
assert_xpath '//a[position() =
|
|
156
|
-
assert_xpath '//a[position() = 1]',
|
|
157
|
-
assert_xpath '//a[position() =
|
|
158
|
-
assert_xpath '//a[position() =
|
|
159
|
-
assert_xpath '//a[position() = last()]',
|
|
160
|
-
assert_xpath '//a[position() = last()
|
|
161
|
-
assert_xpath '//a[position() = last() -
|
|
155
|
+
assert_xpath '//a[position() = 1]', @parser.parse('a:first-of-type()')
|
|
156
|
+
assert_xpath '//a[position() = 1]', @parser.parse('a:first-of-type') # no parens
|
|
157
|
+
assert_xpath '//a[position() = 99]', @parser.parse('a:nth-of-type(99)')
|
|
158
|
+
assert_xpath '//a[position() = last()]', @parser.parse('a:last-of-type()')
|
|
159
|
+
assert_xpath '//a[position() = last()]', @parser.parse('a:last-of-type') # no parens
|
|
160
|
+
assert_xpath '//a[position() = last()]', @parser.parse('a:nth-last-of-type(1)')
|
|
161
|
+
assert_xpath '//a[position() = last() - 98]', @parser.parse('a:nth-last-of-type(99)')
|
|
162
162
|
end
|
|
163
163
|
|
|
164
164
|
def test_nth_child_selectors
|
|
165
|
-
assert_xpath '//*[position() = 1 and self::a]',
|
|
166
|
-
assert_xpath '//*[position() =
|
|
167
|
-
assert_xpath '//*[position() =
|
|
168
|
-
assert_xpath '//*[position() = last()
|
|
165
|
+
assert_xpath '//*[position() = 1 and self::a]', @parser.parse('a:first-child')
|
|
166
|
+
assert_xpath '//*[position() = 99 and self::a]', @parser.parse('a:nth-child(99)')
|
|
167
|
+
assert_xpath '//*[position() = last() and self::a]', @parser.parse('a:last-child')
|
|
168
|
+
assert_xpath '//*[position() = last() and self::a]', @parser.parse('a:nth-last-child(1)')
|
|
169
|
+
assert_xpath '//*[position() = last() - 98 and self::a]', @parser.parse('a:nth-last-child(99)')
|
|
169
170
|
end
|
|
170
171
|
|
|
171
172
|
def test_miscellaneous_selectors
|
|
@@ -185,6 +186,16 @@ module Nokogiri
|
|
|
185
186
|
assert_xpath '//a[(position() <= 3) and (((position()-3) mod 1) = 0)]', @parser.parse('a:nth-of-type(-n+3)')
|
|
186
187
|
assert_xpath '//a[(position() >= 3) and (((position()-3) mod 1) = 0)]', @parser.parse('a:nth-of-type(1n+3)')
|
|
187
188
|
assert_xpath '//a[(position() >= 3) and (((position()-3) mod 1) = 0)]', @parser.parse('a:nth-of-type(n+3)')
|
|
189
|
+
|
|
190
|
+
assert_xpath '//a[((last()-position()+1) mod 2) = 0]', @parser.parse('a:nth-last-of-type(2n)')
|
|
191
|
+
assert_xpath '//a[((last()-position()+1) >= 1) and ((((last()-position()+1)-1) mod 2) = 0)]', @parser.parse('a:nth-last-of-type(2n+1)')
|
|
192
|
+
assert_xpath '//a[((last()-position()+1) mod 2) = 0]', @parser.parse('a:nth-last-of-type(even)')
|
|
193
|
+
assert_xpath '//a[((last()-position()+1) >= 1) and ((((last()-position()+1)-1) mod 2) = 0)]', @parser.parse('a:nth-last-of-type(odd)')
|
|
194
|
+
assert_xpath '//a[((last()-position()+1) >= 3) and ((((last()-position()+1)-3) mod 4) = 0)]', @parser.parse('a:nth-last-of-type(4n+3)')
|
|
195
|
+
assert_xpath '//a[((last()-position()+1) <= 3) and ((((last()-position()+1)-3) mod 1) = 0)]', @parser.parse('a:nth-last-of-type(-1n+3)')
|
|
196
|
+
assert_xpath '//a[((last()-position()+1) <= 3) and ((((last()-position()+1)-3) mod 1) = 0)]', @parser.parse('a:nth-last-of-type(-n+3)')
|
|
197
|
+
assert_xpath '//a[((last()-position()+1) >= 3) and ((((last()-position()+1)-3) mod 1) = 0)]', @parser.parse('a:nth-last-of-type(1n+3)')
|
|
198
|
+
assert_xpath '//a[((last()-position()+1) >= 3) and ((((last()-position()+1)-3) mod 1) = 0)]', @parser.parse('a:nth-last-of-type(n+3)')
|
|
188
199
|
end
|
|
189
200
|
|
|
190
201
|
def test_preceding_selector
|
data/test/css/test_tokenizer.rb
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require "helper"
|
|
2
|
+
|
|
3
|
+
module Nokogiri
|
|
4
|
+
class TestSlop < Nokogiri::TestCase
|
|
5
|
+
def test_description_tag
|
|
6
|
+
doc = Nokogiri.Slop(<<-eoxml)
|
|
7
|
+
<item>
|
|
8
|
+
<title>foo</title>
|
|
9
|
+
<description>this is the foo thing</description>
|
|
10
|
+
</item>
|
|
11
|
+
eoxml
|
|
12
|
+
assert doc.item.title
|
|
13
|
+
assert doc.item._description, 'should have description'
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|