nokogiri 1.10.0 → 1.11.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of nokogiri might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/LICENSE-DEPENDENCIES.md +1015 -947
- data/README.md +178 -90
- data/dependencies.yml +28 -26
- data/ext/nokogiri/depend +476 -357
- data/ext/nokogiri/extconf.rb +508 -354
- data/ext/nokogiri/html_document.c +79 -78
- data/ext/nokogiri/html_sax_parser_context.c +4 -2
- data/ext/nokogiri/html_sax_push_parser.c +14 -8
- data/ext/nokogiri/nokogiri.c +37 -40
- data/ext/nokogiri/nokogiri.h +26 -17
- data/ext/nokogiri/test_global_handlers.c +41 -0
- data/ext/nokogiri/xml_document.c +18 -4
- data/ext/nokogiri/xml_io.c +8 -6
- data/ext/nokogiri/xml_node.c +23 -6
- data/ext/nokogiri/xml_node_set.c +1 -1
- data/ext/nokogiri/xml_reader.c +6 -17
- data/ext/nokogiri/xml_relax_ng.c +29 -11
- data/ext/nokogiri/xml_sax_parser.c +2 -7
- data/ext/nokogiri/xml_sax_parser_context.c +4 -2
- data/ext/nokogiri/xml_sax_push_parser.c +2 -0
- data/ext/nokogiri/xml_schema.c +84 -13
- data/ext/nokogiri/xml_syntax_error.c +23 -0
- data/ext/nokogiri/xml_syntax_error.h +15 -3
- data/ext/nokogiri/xml_xpath_context.c +80 -4
- data/ext/nokogiri/xslt_stylesheet.c +2 -9
- data/lib/nokogiri.rb +22 -22
- data/lib/nokogiri/css.rb +1 -0
- data/lib/nokogiri/css/node.rb +1 -0
- data/lib/nokogiri/css/parser.rb +63 -62
- data/lib/nokogiri/css/parser.y +2 -2
- data/lib/nokogiri/css/parser_extras.rb +39 -36
- data/lib/nokogiri/css/syntax_error.rb +1 -0
- data/lib/nokogiri/css/tokenizer.rb +105 -103
- data/lib/nokogiri/css/xpath_visitor.rb +73 -43
- 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 +13 -26
- 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/syntax_error.rb +1 -0
- data/lib/nokogiri/version.rb +3 -109
- data/lib/nokogiri/version/constant.rb +5 -0
- data/lib/nokogiri/version/info.rb +182 -0
- 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 +36 -32
- data/lib/nokogiri/xml/cdata.rb +1 -0
- data/lib/nokogiri/xml/character_data.rb +1 -0
- data/lib/nokogiri/xml/document.rb +21 -16
- data/lib/nokogiri/xml/document_fragment.rb +5 -6
- 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 +588 -250
- data/lib/nokogiri/xml/node/save_options.rb +1 -0
- data/lib/nokogiri/xml/node_set.rb +43 -8
- data/lib/nokogiri/xml/notation.rb +1 -0
- data/lib/nokogiri/xml/parse_options.rb +10 -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 +7 -2
- 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 +13 -4
- data/lib/nokogiri/xml/searchable.rb +25 -16
- 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
- data/patches/libxml2/0002-Remove-script-macro-support.patch +40 -0
- data/patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch +44 -0
- data/patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch +25 -0
- data/patches/libxml2/0005-Fix-infinite-loop-in-xmlStringLenDecodeEntities.patch +32 -0
- data/patches/libxml2/0006-htmlParseComment-treat-as-if-it-closed-the-comment.patch +73 -0
- data/patches/libxml2/0007-use-new-htmlParseLookupCommentEnd-to-find-comment-en.patch +103 -0
- data/patches/libxml2/0008-use-glibc-strlen.patch +53 -0
- data/patches/libxml2/0009-avoid-isnan-isinf.patch +81 -0
- data/ports/archives/libxml2-2.9.10.tar.gz +0 -0
- data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
- metadata +106 -99
- data/ports/archives/libxml2-2.9.9.tar.gz +0 -0
- data/ports/archives/libxslt-1.1.33.tar.gz +0 -0
data/lib/nokogiri/html.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'pathname'
|
4
|
+
|
1
5
|
module Nokogiri
|
2
6
|
module HTML
|
3
7
|
class Document < Nokogiri::XML::Document
|
@@ -160,11 +164,12 @@ module Nokogiri
|
|
160
164
|
# Nokogiri::XML::ParseOptions::RECOVER. See the constants in
|
161
165
|
# Nokogiri::XML::ParseOptions.
|
162
166
|
def parse string_or_io, url = nil, encoding = nil, options = XML::ParseOptions::DEFAULT_HTML
|
163
|
-
|
164
167
|
options = Nokogiri::XML::ParseOptions.new(options) if Integer === options
|
165
|
-
|
168
|
+
|
166
169
|
yield options if block_given?
|
167
170
|
|
171
|
+
url ||= string_or_io.respond_to?(:path) ? string_or_io.path : nil
|
172
|
+
|
168
173
|
if string_or_io.respond_to?(:encoding)
|
169
174
|
unless string_or_io.encoding.name == "ASCII-8BIT"
|
170
175
|
encoding ||= string_or_io.encoding.name
|
@@ -172,7 +177,12 @@ module Nokogiri
|
|
172
177
|
end
|
173
178
|
|
174
179
|
if string_or_io.respond_to?(:read)
|
175
|
-
|
180
|
+
if string_or_io.is_a?(Pathname)
|
181
|
+
# resolve the Pathname to the file and open it as an IO object, see #2110
|
182
|
+
string_or_io = string_or_io.expand_path.open
|
183
|
+
url ||= string_or_io.path
|
184
|
+
end
|
185
|
+
|
176
186
|
unless encoding
|
177
187
|
# Libxml2's parser has poor support for encoding
|
178
188
|
# detection. First, it does not recognize the HTML5
|
@@ -251,9 +261,6 @@ module Nokogiri
|
|
251
261
|
end
|
252
262
|
|
253
263
|
def self.detect_encoding(chunk)
|
254
|
-
if Nokogiri.jruby? && EncodingReader.is_jruby_without_fix?
|
255
|
-
return EncodingReader.detect_encoding_for_jruby_without_fix(chunk)
|
256
|
-
end
|
257
264
|
m = chunk.match(/\A(<\?xml[ \t\r\n]+[^>]*>)/) and
|
258
265
|
return Nokogiri.XML(m[1]).encoding
|
259
266
|
|
@@ -272,26 +279,6 @@ module Nokogiri
|
|
272
279
|
end
|
273
280
|
end
|
274
281
|
|
275
|
-
def self.is_jruby_without_fix?
|
276
|
-
JRUBY_VERSION.split('.').join.to_i < 165
|
277
|
-
end
|
278
|
-
|
279
|
-
def self.detect_encoding_for_jruby_without_fix(chunk)
|
280
|
-
m = chunk.match(/\A(<\?xml[ \t\r\n]+[^>]*>)/) and
|
281
|
-
return Nokogiri.XML(m[1]).encoding
|
282
|
-
|
283
|
-
m = chunk.match(/(<meta\s)(.*)(charset\s*=\s*([\w-]+))(.*)/i) and
|
284
|
-
return m[4]
|
285
|
-
|
286
|
-
catch(:encoding_found) {
|
287
|
-
Nokogiri::HTML::SAX::Parser.new(JumpSAXHandler.new(:encoding_found.to_s)).parse(chunk)
|
288
|
-
nil
|
289
|
-
}
|
290
|
-
rescue Nokogiri::SyntaxError, RuntimeError
|
291
|
-
# Ignore parser errors that nokogiri may raise
|
292
|
-
nil
|
293
|
-
end
|
294
|
-
|
295
282
|
def initialize(io)
|
296
283
|
@io = io
|
297
284
|
@firstchunk = nil
|
@@ -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/version.rb
CHANGED
@@ -1,109 +1,3 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
class VersionInfo # :nodoc:
|
6
|
-
def jruby?
|
7
|
-
::JRUBY_VERSION if RUBY_PLATFORM == "java"
|
8
|
-
end
|
9
|
-
|
10
|
-
def engine
|
11
|
-
defined?(RUBY_ENGINE) ? RUBY_ENGINE : 'mri'
|
12
|
-
end
|
13
|
-
|
14
|
-
def loaded_parser_version
|
15
|
-
LIBXML_PARSER_VERSION.
|
16
|
-
scan(/^(\d+)(\d\d)(\d\d)(?!\d)/).first.
|
17
|
-
collect(&:to_i).
|
18
|
-
join(".")
|
19
|
-
end
|
20
|
-
|
21
|
-
def compiled_parser_version
|
22
|
-
LIBXML_VERSION
|
23
|
-
end
|
24
|
-
|
25
|
-
def libxml2?
|
26
|
-
defined?(LIBXML_VERSION)
|
27
|
-
end
|
28
|
-
|
29
|
-
def libxml2_using_system?
|
30
|
-
! libxml2_using_packaged?
|
31
|
-
end
|
32
|
-
|
33
|
-
def libxml2_using_packaged?
|
34
|
-
NOKOGIRI_USE_PACKAGED_LIBRARIES
|
35
|
-
end
|
36
|
-
|
37
|
-
def warnings
|
38
|
-
return [] unless libxml2?
|
39
|
-
|
40
|
-
if compiled_parser_version != loaded_parser_version
|
41
|
-
["Nokogiri was built against LibXML version #{compiled_parser_version}, but has dynamically loaded #{loaded_parser_version}"]
|
42
|
-
else
|
43
|
-
[]
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def to_hash
|
48
|
-
hash_info = {}
|
49
|
-
hash_info['warnings'] = []
|
50
|
-
hash_info['nokogiri'] = Nokogiri::VERSION
|
51
|
-
hash_info['ruby'] = {}
|
52
|
-
hash_info['ruby']['version'] = ::RUBY_VERSION
|
53
|
-
hash_info['ruby']['platform'] = ::RUBY_PLATFORM
|
54
|
-
hash_info['ruby']['description'] = ::RUBY_DESCRIPTION
|
55
|
-
hash_info['ruby']['engine'] = engine
|
56
|
-
hash_info['ruby']['jruby'] = jruby? if jruby?
|
57
|
-
|
58
|
-
if libxml2?
|
59
|
-
hash_info['libxml'] = {}
|
60
|
-
hash_info['libxml']['binding'] = 'extension'
|
61
|
-
if libxml2_using_packaged?
|
62
|
-
hash_info['libxml']['source'] = "packaged"
|
63
|
-
hash_info['libxml']['libxml2_path'] = NOKOGIRI_LIBXML2_PATH
|
64
|
-
hash_info['libxml']['libxslt_path'] = NOKOGIRI_LIBXSLT_PATH
|
65
|
-
hash_info['libxml']['libxml2_patches'] = NOKOGIRI_LIBXML2_PATCHES
|
66
|
-
hash_info['libxml']['libxslt_patches'] = NOKOGIRI_LIBXSLT_PATCHES
|
67
|
-
else
|
68
|
-
hash_info['libxml']['source'] = "system"
|
69
|
-
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
|
-
end
|
77
|
-
|
78
|
-
hash_info
|
79
|
-
end
|
80
|
-
|
81
|
-
def to_markdown
|
82
|
-
begin
|
83
|
-
require 'psych'
|
84
|
-
rescue LoadError
|
85
|
-
end
|
86
|
-
require 'yaml'
|
87
|
-
"# Nokogiri (#{Nokogiri::VERSION})\n" +
|
88
|
-
YAML.dump(to_hash).each_line.map { |line| " #{line}" }.join
|
89
|
-
end
|
90
|
-
|
91
|
-
# FIXME: maybe switch to singleton?
|
92
|
-
@@instance = new
|
93
|
-
@@instance.warnings.each do |warning|
|
94
|
-
warn "WARNING: #{warning}"
|
95
|
-
end
|
96
|
-
def self.instance; @@instance; end
|
97
|
-
end
|
98
|
-
|
99
|
-
# More complete version information about libxml
|
100
|
-
VERSION_INFO = VersionInfo.instance.to_hash
|
101
|
-
|
102
|
-
def self.uses_libxml? # :nodoc:
|
103
|
-
VersionInfo.instance.libxml2?
|
104
|
-
end
|
105
|
-
|
106
|
-
def self.jruby? # :nodoc:
|
107
|
-
VersionInfo.instance.jruby?
|
108
|
-
end
|
109
|
-
end
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require_relative "version/constant"
|
3
|
+
require_relative "version/info"
|
@@ -0,0 +1,182 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require "singleton"
|
3
|
+
require "shellwords"
|
4
|
+
|
5
|
+
module Nokogiri
|
6
|
+
class VersionInfo # :nodoc:
|
7
|
+
include Singleton
|
8
|
+
|
9
|
+
def jruby?
|
10
|
+
::JRUBY_VERSION if ::RUBY_PLATFORM == "java"
|
11
|
+
end
|
12
|
+
|
13
|
+
def engine
|
14
|
+
defined?(::RUBY_ENGINE) ? ::RUBY_ENGINE : "mri"
|
15
|
+
end
|
16
|
+
|
17
|
+
def loaded_libxml_version
|
18
|
+
Gem::Version.new(Nokogiri::LIBXML_LOADED_VERSION
|
19
|
+
.scan(/^(\d+)(\d\d)(\d\d)(?!\d)/).first
|
20
|
+
.collect(&:to_i)
|
21
|
+
.join("."))
|
22
|
+
end
|
23
|
+
|
24
|
+
def compiled_libxml_version
|
25
|
+
Gem::Version.new(Nokogiri::LIBXML_COMPILED_VERSION)
|
26
|
+
end
|
27
|
+
|
28
|
+
def loaded_libxslt_version
|
29
|
+
Gem::Version.new(Nokogiri::LIBXSLT_LOADED_VERSION
|
30
|
+
.scan(/^(\d+)(\d\d)(\d\d)(?!\d)/).first
|
31
|
+
.collect(&:to_i)
|
32
|
+
.join("."))
|
33
|
+
end
|
34
|
+
|
35
|
+
def compiled_libxslt_version
|
36
|
+
Gem::Version.new(Nokogiri::LIBXSLT_COMPILED_VERSION)
|
37
|
+
end
|
38
|
+
|
39
|
+
def libxml2?
|
40
|
+
defined?(Nokogiri::LIBXML_COMPILED_VERSION)
|
41
|
+
end
|
42
|
+
|
43
|
+
def libxml2_has_iconv?
|
44
|
+
defined?(Nokogiri::LIBXML_ICONV_ENABLED) && Nokogiri::LIBXML_ICONV_ENABLED
|
45
|
+
end
|
46
|
+
|
47
|
+
def libxml2_using_packaged?
|
48
|
+
libxml2? && Nokogiri::PACKAGED_LIBRARIES
|
49
|
+
end
|
50
|
+
|
51
|
+
def libxml2_using_system?
|
52
|
+
libxml2? && !libxml2_using_packaged?
|
53
|
+
end
|
54
|
+
|
55
|
+
def libxml2_precompiled?
|
56
|
+
libxml2_using_packaged? && Nokogiri::PRECOMPILED_LIBRARIES
|
57
|
+
end
|
58
|
+
|
59
|
+
def warnings
|
60
|
+
warnings = []
|
61
|
+
|
62
|
+
if libxml2?
|
63
|
+
if compiled_libxml_version != loaded_libxml_version
|
64
|
+
warnings << "Nokogiri was built against libxml version #{compiled_libxml_version}, but has dynamically loaded #{loaded_libxml_version}"
|
65
|
+
end
|
66
|
+
|
67
|
+
if compiled_libxslt_version != loaded_libxslt_version
|
68
|
+
warnings << "Nokogiri was built against libxslt version #{compiled_libxslt_version}, but has dynamically loaded #{loaded_libxslt_version}"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
warnings
|
73
|
+
end
|
74
|
+
|
75
|
+
def to_hash
|
76
|
+
header_directory = File.expand_path(File.join(File.dirname(__FILE__), "../../../ext/nokogiri"))
|
77
|
+
{}.tap do |vi|
|
78
|
+
vi["warnings"] = []
|
79
|
+
vi["nokogiri"] = {}.tap do |nokogiri|
|
80
|
+
nokogiri["version"] = Nokogiri::VERSION
|
81
|
+
|
82
|
+
unless jruby?
|
83
|
+
cppflags = ["-I#{header_directory.shellescape}"]
|
84
|
+
if libxml2_using_packaged?
|
85
|
+
cppflags << "-I#{File.join(header_directory, "include").shellescape}"
|
86
|
+
cppflags << "-I#{File.join(header_directory, "include/libxml2").shellescape}"
|
87
|
+
end
|
88
|
+
nokogiri["cppflags"] = cppflags
|
89
|
+
end
|
90
|
+
end
|
91
|
+
vi["ruby"] = {}.tap do |ruby|
|
92
|
+
ruby["version"] = ::RUBY_VERSION
|
93
|
+
ruby["platform"] = ::RUBY_PLATFORM
|
94
|
+
ruby["gem_platform"] = ::Gem::Platform.local.to_s
|
95
|
+
ruby["description"] = ::RUBY_DESCRIPTION
|
96
|
+
ruby["engine"] = engine
|
97
|
+
ruby["jruby"] = jruby? if jruby?
|
98
|
+
end
|
99
|
+
|
100
|
+
if libxml2?
|
101
|
+
vi["libxml"] = {}.tap do |libxml|
|
102
|
+
if libxml2_using_packaged?
|
103
|
+
libxml["source"] = "packaged"
|
104
|
+
libxml["precompiled"] = libxml2_precompiled?
|
105
|
+
libxml["patches"] = Nokogiri::LIBXML2_PATCHES
|
106
|
+
|
107
|
+
# this is for nokogumbo and shouldn't be forever
|
108
|
+
libxml["libxml2_path"] = header_directory
|
109
|
+
else
|
110
|
+
libxml["source"] = "system"
|
111
|
+
end
|
112
|
+
libxml["iconv_enabled"] = libxml2_has_iconv?
|
113
|
+
libxml["compiled"] = compiled_libxml_version.to_s
|
114
|
+
libxml["loaded"] = loaded_libxml_version.to_s
|
115
|
+
end
|
116
|
+
|
117
|
+
vi["libxslt"] = {}.tap do |libxslt|
|
118
|
+
if libxml2_using_packaged?
|
119
|
+
libxslt["source"] = "packaged"
|
120
|
+
libxslt["precompiled"] = libxml2_precompiled?
|
121
|
+
libxslt["patches"] = Nokogiri::LIBXSLT_PATCHES
|
122
|
+
else
|
123
|
+
libxslt["source"] = "system"
|
124
|
+
end
|
125
|
+
libxslt["compiled"] = compiled_libxslt_version.to_s
|
126
|
+
libxslt["loaded"] = loaded_libxslt_version.to_s
|
127
|
+
end
|
128
|
+
|
129
|
+
vi["warnings"] = warnings
|
130
|
+
end
|
131
|
+
|
132
|
+
if defined?(Nokogiri::OTHER_LIBRARY_VERSIONS)
|
133
|
+
# see extconf for how this string is assembled: "lib1name:lib1version,lib2name:lib2version"
|
134
|
+
vi["other_libraries"] = Hash[*Nokogiri::OTHER_LIBRARY_VERSIONS.split(/[,:]/)]
|
135
|
+
elsif jruby?
|
136
|
+
vi["other_libraries"] = {}.tap do |ol|
|
137
|
+
ol["xerces"] = Nokogiri::XERCES_VERSION
|
138
|
+
ol["nekohtml"] = Nokogiri::NEKO_VERSION
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
def to_markdown
|
145
|
+
begin
|
146
|
+
require "psych"
|
147
|
+
rescue LoadError
|
148
|
+
end
|
149
|
+
require "yaml"
|
150
|
+
"# Nokogiri (#{Nokogiri::VERSION})\n" +
|
151
|
+
YAML.dump(to_hash).each_line.map { |line| " #{line}" }.join
|
152
|
+
end
|
153
|
+
|
154
|
+
instance.warnings.each do |warning|
|
155
|
+
warn "WARNING: #{warning}"
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
def self.uses_libxml?(requirement = nil) # :nodoc:
|
160
|
+
return false unless VersionInfo.instance.libxml2?
|
161
|
+
return true unless requirement
|
162
|
+
Gem::Requirement.new(requirement).satisfied_by?(VersionInfo.instance.loaded_libxml_version)
|
163
|
+
end
|
164
|
+
|
165
|
+
def self.jruby? # :nodoc:
|
166
|
+
VersionInfo.instance.jruby?
|
167
|
+
end
|
168
|
+
|
169
|
+
# Ensure constants used in this file are loaded - see #1896
|
170
|
+
if Nokogiri.jruby?
|
171
|
+
require "nokogiri/jruby/dependencies"
|
172
|
+
end
|
173
|
+
begin
|
174
|
+
::RUBY_VERSION =~ /(\d+\.\d+)/
|
175
|
+
require "nokogiri/#{Regexp.last_match(1)}/nokogiri"
|
176
|
+
rescue LoadError
|
177
|
+
require "nokogiri/nokogiri"
|
178
|
+
end
|
179
|
+
|
180
|
+
# More complete version information about libxml
|
181
|
+
VERSION_INFO = VersionInfo.instance.to_hash
|
182
|
+
end
|