nokogiri 1.10.10-java → 1.11.0.rc1-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/README.md +19 -17
- data/ext/java/nokogiri/HtmlDocument.java +34 -46
- data/ext/java/nokogiri/HtmlSaxParserContext.java +87 -57
- data/ext/java/nokogiri/NokogiriService.java +1 -1
- data/ext/java/nokogiri/XmlAttr.java +13 -20
- data/ext/java/nokogiri/XmlAttributeDecl.java +11 -12
- data/ext/java/nokogiri/XmlCdata.java +3 -4
- data/ext/java/nokogiri/XmlComment.java +1 -1
- data/ext/java/nokogiri/XmlDocument.java +148 -175
- data/ext/java/nokogiri/XmlDocumentFragment.java +13 -31
- data/ext/java/nokogiri/XmlDtd.java +5 -8
- data/ext/java/nokogiri/XmlElement.java +1 -20
- data/ext/java/nokogiri/XmlElementDecl.java +23 -28
- data/ext/java/nokogiri/XmlEntityDecl.java +23 -27
- data/ext/java/nokogiri/XmlEntityReference.java +2 -2
- data/ext/java/nokogiri/XmlNamespace.java +72 -89
- data/ext/java/nokogiri/XmlNode.java +300 -401
- data/ext/java/nokogiri/XmlNodeSet.java +70 -76
- data/ext/java/nokogiri/XmlReader.java +10 -11
- data/ext/java/nokogiri/XmlSaxParserContext.java +7 -7
- data/ext/java/nokogiri/XmlSchema.java +3 -3
- data/ext/java/nokogiri/XmlText.java +12 -9
- data/ext/java/nokogiri/XmlXpathContext.java +7 -7
- data/ext/java/nokogiri/XsltStylesheet.java +7 -15
- data/ext/java/nokogiri/internals/HtmlDomParserContext.java +4 -10
- data/ext/java/nokogiri/internals/NokogiriHelpers.java +71 -135
- data/ext/java/nokogiri/internals/NokogiriNamespaceCache.java +90 -58
- data/ext/java/nokogiri/internals/NokogiriXPathFunction.java +5 -4
- data/ext/java/nokogiri/internals/ParserContext.java +27 -73
- data/ext/java/nokogiri/internals/ReaderNode.java +2 -4
- data/ext/java/nokogiri/internals/XmlDomParserContext.java +17 -32
- data/ext/nokogiri/extconf.rb +44 -35
- data/ext/nokogiri/nokogiri.c +12 -6
- data/ext/nokogiri/nokogiri.h +1 -0
- data/ext/nokogiri/xml_document.c +10 -1
- data/ext/nokogiri/xml_node.c +20 -0
- data/ext/nokogiri/xml_schema.c +0 -29
- data/ext/nokogiri/xslt_stylesheet.c +0 -4
- data/lib/nokogiri.rb +2 -19
- data/lib/nokogiri/css.rb +1 -0
- data/lib/nokogiri/css/node.rb +1 -0
- data/lib/nokogiri/css/parser.rb +1 -0
- data/lib/nokogiri/css/parser_extras.rb +1 -0
- data/lib/nokogiri/css/syntax_error.rb +1 -0
- data/lib/nokogiri/css/tokenizer.rb +1 -0
- data/lib/nokogiri/css/xpath_visitor.rb +3 -1
- data/lib/nokogiri/decorators/slop.rb +1 -0
- data/lib/nokogiri/html.rb +1 -0
- data/lib/nokogiri/html/builder.rb +1 -0
- data/lib/nokogiri/html/document.rb +1 -0
- data/lib/nokogiri/html/document_fragment.rb +1 -0
- data/lib/nokogiri/html/element_description.rb +1 -0
- data/lib/nokogiri/html/element_description_defaults.rb +1 -0
- data/lib/nokogiri/html/entity_lookup.rb +1 -0
- data/lib/nokogiri/html/sax/parser.rb +1 -0
- data/lib/nokogiri/html/sax/parser_context.rb +1 -0
- data/lib/nokogiri/html/sax/push_parser.rb +1 -0
- data/lib/nokogiri/jruby/dependencies.rb +20 -0
- data/lib/nokogiri/nokogiri.jar +0 -0
- data/lib/nokogiri/syntax_error.rb +1 -0
- data/lib/nokogiri/version.rb +85 -45
- data/lib/nokogiri/xml.rb +1 -0
- data/lib/nokogiri/xml/attr.rb +1 -0
- data/lib/nokogiri/xml/attribute_decl.rb +1 -0
- data/lib/nokogiri/xml/builder.rb +1 -0
- data/lib/nokogiri/xml/cdata.rb +1 -0
- data/lib/nokogiri/xml/character_data.rb +1 -0
- data/lib/nokogiri/xml/document.rb +3 -8
- data/lib/nokogiri/xml/document_fragment.rb +1 -0
- data/lib/nokogiri/xml/dtd.rb +1 -0
- data/lib/nokogiri/xml/element_content.rb +1 -0
- data/lib/nokogiri/xml/element_decl.rb +1 -0
- data/lib/nokogiri/xml/entity_decl.rb +1 -0
- data/lib/nokogiri/xml/entity_reference.rb +1 -0
- data/lib/nokogiri/xml/namespace.rb +1 -0
- data/lib/nokogiri/xml/node.rb +26 -12
- data/lib/nokogiri/xml/node/save_options.rb +1 -0
- data/lib/nokogiri/xml/node_set.rb +1 -0
- data/lib/nokogiri/xml/notation.rb +1 -0
- data/lib/nokogiri/xml/parse_options.rb +4 -3
- data/lib/nokogiri/xml/pp.rb +1 -0
- data/lib/nokogiri/xml/pp/character_data.rb +1 -0
- data/lib/nokogiri/xml/pp/node.rb +1 -0
- data/lib/nokogiri/xml/processing_instruction.rb +1 -0
- data/lib/nokogiri/xml/reader.rb +7 -3
- data/lib/nokogiri/xml/relax_ng.rb +1 -0
- data/lib/nokogiri/xml/sax.rb +1 -0
- data/lib/nokogiri/xml/sax/document.rb +1 -0
- data/lib/nokogiri/xml/sax/parser.rb +1 -0
- data/lib/nokogiri/xml/sax/parser_context.rb +1 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +1 -0
- data/lib/nokogiri/xml/schema.rb +1 -0
- data/lib/nokogiri/xml/searchable.rb +1 -0
- data/lib/nokogiri/xml/syntax_error.rb +1 -0
- data/lib/nokogiri/xml/text.rb +1 -0
- data/lib/nokogiri/xml/xpath.rb +1 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +1 -0
- data/lib/nokogiri/xml/xpath_context.rb +1 -0
- data/lib/nokogiri/xslt.rb +1 -0
- data/lib/nokogiri/xslt/stylesheet.rb +1 -0
- data/lib/xsd/xmlparser/nokogiri.rb +1 -0
- metadata +26 -27
- data/ext/java/nokogiri/internals/NokogiriEncodingReaderWrapper.java +0 -107
- data/ext/java/nokogiri/internals/UncloseableInputStream.java +0 -102
data/ext/nokogiri/extconf.rb
CHANGED
@@ -486,50 +486,60 @@ else
|
|
486
486
|
url: "http://zlib.net/fossils/#{recipe.name}-#{recipe.version}.tar.gz",
|
487
487
|
sha256: dependencies["zlib"]["sha256"]
|
488
488
|
}]
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
489
|
+
if windows?
|
490
|
+
class << recipe
|
491
|
+
attr_accessor :cross_build_p
|
492
|
+
|
493
|
+
def configure
|
494
|
+
Dir.chdir work_path do
|
495
|
+
mk = File.read 'win32/Makefile.gcc'
|
496
|
+
File.open 'win32/Makefile.gcc', 'wb' do |f|
|
497
|
+
f.puts "BINARY_PATH = #{path}/bin"
|
498
|
+
f.puts "LIBRARY_PATH = #{path}/lib"
|
499
|
+
f.puts "INCLUDE_PATH = #{path}/include"
|
500
|
+
mk.sub!(/^PREFIX\s*=\s*$/, "PREFIX = #{host}-") if cross_build_p
|
501
|
+
f.puts mk
|
502
|
+
end
|
501
503
|
end
|
502
504
|
end
|
503
|
-
end
|
504
505
|
|
505
|
-
|
506
|
-
|
507
|
-
|
506
|
+
def configured?
|
507
|
+
Dir.chdir work_path do
|
508
|
+
!! (File.read('win32/Makefile.gcc') =~ /^BINARY_PATH/)
|
509
|
+
end
|
508
510
|
end
|
509
|
-
end
|
510
511
|
|
511
|
-
|
512
|
-
|
513
|
-
|
512
|
+
def compile
|
513
|
+
execute "compile", "make -f win32/Makefile.gcc"
|
514
|
+
end
|
514
515
|
|
515
|
-
|
516
|
-
|
516
|
+
def install
|
517
|
+
execute "install", "make -f win32/Makefile.gcc install"
|
518
|
+
end
|
519
|
+
end
|
520
|
+
recipe.cross_build_p = cross_build_p
|
521
|
+
else
|
522
|
+
class << recipe
|
523
|
+
def configure
|
524
|
+
execute "configure", ["env", "CHOST=#{host}", "CFLAGS=-fPIC #{ENV['CFLAGS']}", "./configure", "--static", configure_prefix]
|
525
|
+
end
|
517
526
|
end
|
518
527
|
end
|
519
|
-
recipe.cross_build_p = cross_build_p
|
520
528
|
end
|
521
529
|
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
530
|
+
unless nix?
|
531
|
+
libiconv_recipe = process_recipe("libiconv", dependencies["libiconv"]["version"], static_p, cross_build_p) do |recipe|
|
532
|
+
recipe.files = [{
|
533
|
+
url: "http://ftp.gnu.org/pub/gnu/libiconv/#{recipe.name}-#{recipe.version}.tar.gz",
|
534
|
+
sha256: dependencies["libiconv"]["sha256"]
|
535
|
+
}]
|
536
|
+
recipe.configure_options += [
|
537
|
+
"CPPFLAGS=-Wall",
|
538
|
+
"CFLAGS=-O2 -g",
|
539
|
+
"CXXFLAGS=-O2 -g",
|
540
|
+
"LDFLAGS="
|
541
|
+
]
|
542
|
+
end
|
533
543
|
end
|
534
544
|
else
|
535
545
|
if darwin? && !have_header('iconv.h')
|
@@ -617,7 +627,6 @@ EOM
|
|
617
627
|
end
|
618
628
|
|
619
629
|
# Defining a macro that expands to a C string; double quotes are significant.
|
620
|
-
$CPPFLAGS << ' ' << "-DNOKOGIRI_#{recipe.name.upcase}_PATH=\"#{recipe.path}\"".inspect
|
621
630
|
$CPPFLAGS << ' ' << "-DNOKOGIRI_#{recipe.name.upcase}_PATCHES=\"#{recipe.patch_files.map { |path| File.basename(path) }.join(' ')}\"".inspect
|
622
631
|
|
623
632
|
case libname
|
data/ext/nokogiri/nokogiri.c
CHANGED
@@ -76,24 +76,30 @@ void Init_nokogiri()
|
|
76
76
|
mNokogiriHtmlSax = rb_define_module_under(mNokogiriHtml, "SAX");
|
77
77
|
|
78
78
|
rb_const_set( mNokogiri,
|
79
|
-
rb_intern("
|
79
|
+
rb_intern("LIBXML_COMPILED_VERSION"),
|
80
80
|
NOKOGIRI_STR_NEW2(LIBXML_DOTTED_VERSION)
|
81
81
|
);
|
82
82
|
rb_const_set( mNokogiri,
|
83
|
-
rb_intern("
|
83
|
+
rb_intern("LIBXML_LOADED_VERSION"),
|
84
84
|
NOKOGIRI_STR_NEW2(xmlParserVersion)
|
85
85
|
);
|
86
86
|
|
87
|
+
|
88
|
+
rb_const_set( mNokogiri,
|
89
|
+
rb_intern("LIBXSLT_COMPILED_VERSION"),
|
90
|
+
NOKOGIRI_STR_NEW2(LIBXSLT_DOTTED_VERSION)
|
91
|
+
);
|
92
|
+
rb_const_set( mNokogiri,
|
93
|
+
rb_intern("LIBXSLT_LOADED_VERSION"),
|
94
|
+
NOKOGIRI_STR_NEW2(xsltEngineVersion)
|
95
|
+
);
|
96
|
+
|
87
97
|
#ifdef NOKOGIRI_USE_PACKAGED_LIBRARIES
|
88
98
|
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_USE_PACKAGED_LIBRARIES"), Qtrue);
|
89
|
-
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXML2_PATH"), NOKOGIRI_STR_NEW2(NOKOGIRI_LIBXML2_PATH));
|
90
|
-
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXSLT_PATH"), NOKOGIRI_STR_NEW2(NOKOGIRI_LIBXSLT_PATH));
|
91
99
|
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXML2_PATCHES"), rb_str_split(NOKOGIRI_STR_NEW2(NOKOGIRI_LIBXML2_PATCHES), " "));
|
92
100
|
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXSLT_PATCHES"), rb_str_split(NOKOGIRI_STR_NEW2(NOKOGIRI_LIBXSLT_PATCHES), " "));
|
93
101
|
#else
|
94
102
|
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_USE_PACKAGED_LIBRARIES"), Qfalse);
|
95
|
-
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXML2_PATH"), Qnil);
|
96
|
-
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXSLT_PATH"), Qnil);
|
97
103
|
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXML2_PATCHES"), Qnil);
|
98
104
|
rb_const_set(mNokogiri, rb_intern("NOKOGIRI_LIBXSLT_PATCHES"), Qnil);
|
99
105
|
#endif
|
data/ext/nokogiri/nokogiri.h
CHANGED
@@ -29,6 +29,7 @@ int vasprintf (char **strp, const char *fmt, va_list ap);
|
|
29
29
|
#include <libxml/relaxng.h>
|
30
30
|
#include <libxml/xinclude.h>
|
31
31
|
#include <libxslt/extensions.h>
|
32
|
+
#include <libxslt/xsltconfig.h>
|
32
33
|
#include <libxml/c14n.h>
|
33
34
|
#include <ruby.h>
|
34
35
|
#include <ruby/st.h>
|
data/ext/nokogiri/xml_document.c
CHANGED
@@ -38,6 +38,15 @@ static void remove_private(xmlNodePtr node)
|
|
38
38
|
node->_private = NULL;
|
39
39
|
}
|
40
40
|
|
41
|
+
static void mark(xmlDocPtr doc)
|
42
|
+
{
|
43
|
+
nokogiriTuplePtr tuple = (nokogiriTuplePtr)doc->_private;
|
44
|
+
if(tuple) {
|
45
|
+
rb_gc_mark(tuple->doc);
|
46
|
+
rb_gc_mark(tuple->node_cache);
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
41
50
|
static void dealloc(xmlDocPtr doc)
|
42
51
|
{
|
43
52
|
st_table *node_hash;
|
@@ -588,7 +597,7 @@ VALUE Nokogiri_wrap_xml_document(VALUE klass, xmlDocPtr doc)
|
|
588
597
|
|
589
598
|
VALUE rb_doc = Data_Wrap_Struct(
|
590
599
|
klass ? klass : cNokogiriXmlDocument,
|
591
|
-
|
600
|
+
mark,
|
592
601
|
dealloc,
|
593
602
|
doc
|
594
603
|
);
|
data/ext/nokogiri/xml_node.c
CHANGED
@@ -1332,6 +1332,25 @@ static VALUE line(VALUE self)
|
|
1332
1332
|
return INT2NUM(xmlGetLineNo(node));
|
1333
1333
|
}
|
1334
1334
|
|
1335
|
+
/*
|
1336
|
+
* call-seq:
|
1337
|
+
* line=(num)
|
1338
|
+
*
|
1339
|
+
* Sets the line for this Node. num must be less than 65535.
|
1340
|
+
*/
|
1341
|
+
static VALUE set_line(VALUE self, VALUE num)
|
1342
|
+
{
|
1343
|
+
xmlNodePtr node;
|
1344
|
+
Data_Get_Struct(self, xmlNode, node);
|
1345
|
+
|
1346
|
+
int value = NUM2INT(num);
|
1347
|
+
if (value < 65535) {
|
1348
|
+
node->line = value;
|
1349
|
+
}
|
1350
|
+
|
1351
|
+
return num;
|
1352
|
+
}
|
1353
|
+
|
1335
1354
|
/*
|
1336
1355
|
* call-seq:
|
1337
1356
|
* add_namespace_definition(prefix, href)
|
@@ -1728,6 +1747,7 @@ void init_xml_node()
|
|
1728
1747
|
rb_define_method(klass, "create_external_subset", create_external_subset, 3);
|
1729
1748
|
rb_define_method(klass, "pointer_id", pointer_id, 0);
|
1730
1749
|
rb_define_method(klass, "line", line, 0);
|
1750
|
+
rb_define_method(klass, "line=", set_line, 1);
|
1731
1751
|
rb_define_method(klass, "content", get_native_content, 0);
|
1732
1752
|
rb_define_method(klass, "native_content=", set_native_content, 1);
|
1733
1753
|
rb_define_method(klass, "lang", get_lang, 0);
|
data/ext/nokogiri/xml_schema.c
CHANGED
@@ -133,31 +133,6 @@ static VALUE read_memory(VALUE klass, VALUE content)
|
|
133
133
|
return rb_schema;
|
134
134
|
}
|
135
135
|
|
136
|
-
/* Schema creation will remove and deallocate "blank" nodes.
|
137
|
-
* If those blank nodes have been exposed to Ruby, they could get freed
|
138
|
-
* out from under the VALUE pointer. This function checks to see if any of
|
139
|
-
* those nodes have been exposed to Ruby, and if so we should raise an exception.
|
140
|
-
*/
|
141
|
-
static int has_blank_nodes_p(VALUE cache)
|
142
|
-
{
|
143
|
-
long i;
|
144
|
-
|
145
|
-
if (NIL_P(cache)) {
|
146
|
-
return 0;
|
147
|
-
}
|
148
|
-
|
149
|
-
for (i = 0; i < RARRAY_LEN(cache); i++) {
|
150
|
-
xmlNodePtr node;
|
151
|
-
VALUE element = rb_ary_entry(cache, i);
|
152
|
-
Data_Get_Struct(element, xmlNode, node);
|
153
|
-
if (xmlIsBlankNode(node)) {
|
154
|
-
return 1;
|
155
|
-
}
|
156
|
-
}
|
157
|
-
|
158
|
-
return 0;
|
159
|
-
}
|
160
|
-
|
161
136
|
/*
|
162
137
|
* call-seq:
|
163
138
|
* from_document(doc)
|
@@ -177,10 +152,6 @@ static VALUE from_document(VALUE klass, VALUE document)
|
|
177
152
|
/* In case someone passes us a node. ugh. */
|
178
153
|
doc = doc->doc;
|
179
154
|
|
180
|
-
if (has_blank_nodes_p(DOC_NODE_CACHE(doc))) {
|
181
|
-
rb_raise(rb_eArgError, "Creating a schema from a document that has blank nodes exposed to Ruby is dangerous");
|
182
|
-
}
|
183
|
-
|
184
155
|
ctx = xmlSchemaNewDocParserCtxt(doc);
|
185
156
|
|
186
157
|
errors = rb_ary_new();
|
data/lib/nokogiri.rb
CHANGED
@@ -1,28 +1,11 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
|
+
# frozen_string_literal: true
|
2
3
|
# Modify the PATH on windows so that the external DLLs will get loaded.
|
3
4
|
|
4
5
|
require 'rbconfig'
|
5
6
|
|
6
7
|
if defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
|
7
|
-
|
8
|
-
# unless defined?(JRuby::Rack::VERSION) || defined?(AppEngine::ApiProxy)
|
9
|
-
#
|
10
|
-
# However, simply cutting defined?(JRuby::Rack::VERSION) off resulted in
|
11
|
-
# an unable-to-load-nokogiri problem. Thus, now, Nokogiri checks the presense
|
12
|
-
# of appengine-rack.jar in $LOAD_PATH. If Nokogiri is on GAE, Nokogiri
|
13
|
-
# should skip loading xml jars. This is because those are in WEB-INF/lib and
|
14
|
-
# already set in the classpath.
|
15
|
-
unless $LOAD_PATH.to_s.include?("appengine-rack")
|
16
|
-
require 'stringio'
|
17
|
-
require 'isorelax.jar'
|
18
|
-
require 'jing.jar'
|
19
|
-
require 'nekohtml.jar'
|
20
|
-
require 'nekodtd.jar'
|
21
|
-
require 'xercesImpl.jar'
|
22
|
-
require 'serializer.jar'
|
23
|
-
require 'xalan.jar'
|
24
|
-
require 'xml-apis.jar'
|
25
|
-
end
|
8
|
+
require 'nokogiri/jruby/dependencies'
|
26
9
|
end
|
27
10
|
|
28
11
|
begin
|
data/lib/nokogiri/css.rb
CHANGED
data/lib/nokogiri/css/node.rb
CHANGED
data/lib/nokogiri/css/parser.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Nokogiri
|
2
3
|
module CSS
|
3
4
|
class XPathVisitor # :nodoc:
|
@@ -51,7 +52,8 @@ module Nokogiri
|
|
51
52
|
when /^comment\(/
|
52
53
|
"comment()"
|
53
54
|
when /^has\(/
|
54
|
-
|
55
|
+
is_direct = node.value[1].value[0].nil? # e.g. "has(> a)", "has(~ a)", "has(+ a)"
|
56
|
+
".#{"//" if !is_direct}#{node.value[1].accept(self)}"
|
55
57
|
else
|
56
58
|
args = ['.'] + node.value[1..-1]
|
57
59
|
"#{node.value.first}#{args.join(', ')})"
|
data/lib/nokogiri/html.rb
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# The line below caused a problem on non-GAE rack environment.
|
3
|
+
# unless defined?(JRuby::Rack::VERSION) || defined?(AppEngine::ApiProxy)
|
4
|
+
#
|
5
|
+
# However, simply cutting defined?(JRuby::Rack::VERSION) off resulted in
|
6
|
+
# an unable-to-load-nokogiri problem. Thus, now, Nokogiri checks the presense
|
7
|
+
# of appengine-rack.jar in $LOAD_PATH. If Nokogiri is on GAE, Nokogiri
|
8
|
+
# should skip loading xml jars. This is because those are in WEB-INF/lib and
|
9
|
+
# already set in the classpath.
|
10
|
+
unless $LOAD_PATH.to_s.include?("appengine-rack")
|
11
|
+
require 'stringio'
|
12
|
+
require 'isorelax.jar'
|
13
|
+
require 'jing.jar'
|
14
|
+
require 'nekohtml.jar'
|
15
|
+
require 'nekodtd.jar'
|
16
|
+
require 'xercesImpl.jar'
|
17
|
+
require 'serializer.jar'
|
18
|
+
require 'xalan.jar'
|
19
|
+
require 'xml-apis.jar'
|
20
|
+
end
|
data/lib/nokogiri/nokogiri.jar
CHANGED
Binary file
|
data/lib/nokogiri/version.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Nokogiri
|
2
3
|
# The version of Nokogiri you are using
|
3
|
-
VERSION = "1.
|
4
|
+
VERSION = "1.11.0.rc1"
|
4
5
|
|
5
6
|
class VersionInfo # :nodoc:
|
6
7
|
def jruby?
|
@@ -11,19 +12,30 @@ module Nokogiri
|
|
11
12
|
defined?(RUBY_ENGINE) ? RUBY_ENGINE : "mri"
|
12
13
|
end
|
13
14
|
|
14
|
-
def
|
15
|
-
|
15
|
+
def loaded_libxml_version
|
16
|
+
Gem::Version.new(LIBXML_LOADED_VERSION.
|
16
17
|
scan(/^(\d+)(\d\d)(\d\d)(?!\d)/).first.
|
17
18
|
collect(&:to_i).
|
18
|
-
join(".")
|
19
|
+
join("."))
|
19
20
|
end
|
20
21
|
|
21
|
-
def
|
22
|
-
|
22
|
+
def compiled_libxml_version
|
23
|
+
Gem::Version.new LIBXML_COMPILED_VERSION
|
24
|
+
end
|
25
|
+
|
26
|
+
def loaded_libxslt_version
|
27
|
+
Gem::Version.new(LIBXSLT_LOADED_VERSION.
|
28
|
+
scan(/^(\d+)(\d\d)(\d\d)(?!\d)/).first.
|
29
|
+
collect(&:to_i).
|
30
|
+
join("."))
|
31
|
+
end
|
32
|
+
|
33
|
+
def compiled_libxslt_version
|
34
|
+
Gem::Version.new LIBXSLT_COMPILED_VERSION
|
23
35
|
end
|
24
36
|
|
25
37
|
def libxml2?
|
26
|
-
defined?(
|
38
|
+
defined?(LIBXML_COMPILED_VERSION)
|
27
39
|
end
|
28
40
|
|
29
41
|
def libxml2_using_system?
|
@@ -35,47 +47,62 @@ module Nokogiri
|
|
35
47
|
end
|
36
48
|
|
37
49
|
def warnings
|
38
|
-
|
50
|
+
warnings = []
|
39
51
|
|
40
|
-
if
|
41
|
-
|
42
|
-
|
43
|
-
|
52
|
+
if libxml2?
|
53
|
+
if compiled_libxml_version != loaded_libxml_version
|
54
|
+
warnings << "Nokogiri was built against libxml version #{compiled_libxml_version}, but has dynamically loaded #{loaded_libxml_version}"
|
55
|
+
end
|
56
|
+
|
57
|
+
if compiled_libxslt_version != loaded_libxslt_version
|
58
|
+
warnings << "Nokogiri was built against libxslt version #{compiled_libxslt_version}, but has dynamically loaded #{loaded_libxslt_version}"
|
59
|
+
end
|
44
60
|
end
|
61
|
+
|
62
|
+
warnings
|
45
63
|
end
|
46
64
|
|
47
65
|
def to_hash
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
66
|
+
{}.tap do |vi|
|
67
|
+
vi["warnings"] = []
|
68
|
+
vi["nokogiri"] = Nokogiri::VERSION
|
69
|
+
vi["ruby"] = {}.tap do |ruby|
|
70
|
+
ruby["version"] = ::RUBY_VERSION
|
71
|
+
ruby["platform"] = ::RUBY_PLATFORM
|
72
|
+
ruby["description"] = ::RUBY_DESCRIPTION
|
73
|
+
ruby["engine"] = engine
|
74
|
+
ruby["jruby"] = jruby? if jruby?
|
75
|
+
end
|
57
76
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
77
|
+
if libxml2?
|
78
|
+
vi["libxml"] = {}.tap do |libxml|
|
79
|
+
if libxml2_using_packaged?
|
80
|
+
libxml["source"] = "packaged"
|
81
|
+
libxml["patches"] = NOKOGIRI_LIBXML2_PATCHES
|
82
|
+
else
|
83
|
+
libxml["source"] = "system"
|
84
|
+
end
|
85
|
+
libxml["compiled"] = compiled_libxml_version.to_s
|
86
|
+
libxml["loaded"] = loaded_libxml_version.to_s
|
87
|
+
end
|
88
|
+
|
89
|
+
vi["libxslt"] = {}.tap do |libxslt|
|
90
|
+
if libxml2_using_packaged?
|
91
|
+
libxslt["source"] = "packaged"
|
92
|
+
libxslt["patches"] = NOKOGIRI_LIBXSLT_PATCHES
|
93
|
+
else
|
94
|
+
libxslt["source"] = "system"
|
95
|
+
end
|
96
|
+
libxslt["compiled"] = compiled_libxslt_version.to_s
|
97
|
+
libxslt["loaded"] = loaded_libxslt_version.to_s
|
98
|
+
end
|
99
|
+
|
100
|
+
vi["warnings"] = warnings
|
101
|
+
elsif jruby?
|
102
|
+
vi["xerces"] = Nokogiri::XERCES_VERSION
|
103
|
+
vi["nekohtml"] = Nokogiri::NEKO_VERSION
|
69
104
|
end
|
70
|
-
hash_info["libxml"]["compiled"] = compiled_parser_version
|
71
|
-
hash_info["libxml"]["loaded"] = loaded_parser_version
|
72
|
-
hash_info["warnings"] = warnings
|
73
|
-
elsif jruby?
|
74
|
-
hash_info["xerces"] = Nokogiri::XERCES_VERSION
|
75
|
-
hash_info["nekohtml"] = Nokogiri::NEKO_VERSION
|
76
105
|
end
|
77
|
-
|
78
|
-
hash_info
|
79
106
|
end
|
80
107
|
|
81
108
|
def to_markdown
|
@@ -96,14 +123,27 @@ module Nokogiri
|
|
96
123
|
def self.instance; @@instance; end
|
97
124
|
end
|
98
125
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
VersionInfo.instance.libxml2?
|
126
|
+
def self.uses_libxml?(requirement = nil) # :nodoc:
|
127
|
+
return false unless VersionInfo.instance.libxml2?
|
128
|
+
return true unless requirement
|
129
|
+
return Gem::Requirement.new(requirement).satisfied_by?(VersionInfo.instance.loaded_libxml_version)
|
104
130
|
end
|
105
131
|
|
106
132
|
def self.jruby? # :nodoc:
|
107
133
|
VersionInfo.instance.jruby?
|
108
134
|
end
|
135
|
+
|
136
|
+
# Ensure constants used in this file are loaded
|
137
|
+
if Nokogiri.jruby?
|
138
|
+
require "nokogiri/jruby/dependencies"
|
139
|
+
end
|
140
|
+
begin
|
141
|
+
RUBY_VERSION =~ /(\d+\.\d+)/
|
142
|
+
require "nokogiri/#{$1}/nokogiri"
|
143
|
+
rescue LoadError
|
144
|
+
require "nokogiri/nokogiri"
|
145
|
+
end
|
146
|
+
|
147
|
+
# More complete version information about libxml
|
148
|
+
VERSION_INFO = VersionInfo.instance.to_hash
|
109
149
|
end
|