nokogiri 1.10.10 → 1.11.3
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/LICENSE.md +1 -1
- data/README.md +173 -94
- data/ext/nokogiri/depend +37 -358
- data/ext/nokogiri/extconf.rb +611 -391
- data/ext/nokogiri/html_document.c +78 -82
- data/ext/nokogiri/html_element_description.c +84 -71
- data/ext/nokogiri/html_entity_lookup.c +21 -16
- data/ext/nokogiri/html_sax_parser_context.c +69 -66
- data/ext/nokogiri/html_sax_push_parser.c +42 -34
- data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
- data/ext/nokogiri/nokogiri.c +192 -87
- data/ext/nokogiri/nokogiri.h +181 -89
- data/ext/nokogiri/test_global_handlers.c +40 -0
- data/ext/nokogiri/xml_attr.c +15 -15
- data/ext/nokogiri/xml_attribute_decl.c +18 -18
- data/ext/nokogiri/xml_cdata.c +13 -18
- data/ext/nokogiri/xml_comment.c +19 -26
- data/ext/nokogiri/xml_document.c +255 -183
- data/ext/nokogiri/xml_document_fragment.c +13 -15
- data/ext/nokogiri/xml_dtd.c +54 -48
- data/ext/nokogiri/xml_element_content.c +30 -27
- data/ext/nokogiri/xml_element_decl.c +22 -22
- data/ext/nokogiri/xml_encoding_handler.c +17 -11
- data/ext/nokogiri/xml_entity_decl.c +32 -30
- data/ext/nokogiri/xml_entity_reference.c +16 -18
- data/ext/nokogiri/xml_namespace.c +56 -49
- data/ext/nokogiri/xml_node.c +387 -316
- data/ext/nokogiri/xml_node_set.c +168 -156
- data/ext/nokogiri/xml_processing_instruction.c +17 -19
- data/ext/nokogiri/xml_reader.c +195 -172
- data/ext/nokogiri/xml_relax_ng.c +52 -28
- data/ext/nokogiri/xml_sax_parser.c +118 -118
- data/ext/nokogiri/xml_sax_parser_context.c +103 -86
- data/ext/nokogiri/xml_sax_push_parser.c +36 -27
- data/ext/nokogiri/xml_schema.c +95 -47
- data/ext/nokogiri/xml_syntax_error.c +42 -21
- data/ext/nokogiri/xml_text.c +13 -17
- data/ext/nokogiri/xml_xpath_context.c +206 -123
- data/ext/nokogiri/xslt_stylesheet.c +158 -165
- data/lib/nokogiri.rb +6 -27
- 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 +1 -0
- data/lib/nokogiri/css/xpath_visitor.rb +73 -43
- data/lib/nokogiri/decorators/slop.rb +1 -0
- data/lib/nokogiri/extension.rb +26 -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 +16 -15
- 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 +205 -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 +3 -2
- data/lib/nokogiri/xml/cdata.rb +1 -0
- data/lib/nokogiri/xml/character_data.rb +1 -0
- data/lib/nokogiri/xml/document.rb +92 -41
- 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 +625 -290
- 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 +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 +9 -12
- 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 +2 -3
- data/lib/nokogiri/xml/xpath/syntax_error.rb +2 -1
- 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/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/patches/libxml2/0010-parser.c-shrink-the-input-buffer-when-appropriate.patch +70 -0
- data/patches/libxml2/0011-update-automake-files-for-arm64.patch +2511 -0
- data/patches/libxslt/0001-update-automake-files-for-arm64.patch +2511 -0
- metadata +88 -149
- data/ext/nokogiri/html_document.h +0 -10
- data/ext/nokogiri/html_element_description.h +0 -10
- data/ext/nokogiri/html_entity_lookup.h +0 -8
- data/ext/nokogiri/html_sax_parser_context.h +0 -11
- data/ext/nokogiri/html_sax_push_parser.h +0 -9
- data/ext/nokogiri/xml_attr.h +0 -9
- data/ext/nokogiri/xml_attribute_decl.h +0 -9
- data/ext/nokogiri/xml_cdata.h +0 -9
- data/ext/nokogiri/xml_comment.h +0 -9
- data/ext/nokogiri/xml_document.h +0 -23
- data/ext/nokogiri/xml_document_fragment.h +0 -10
- data/ext/nokogiri/xml_dtd.h +0 -10
- data/ext/nokogiri/xml_element_content.h +0 -10
- data/ext/nokogiri/xml_element_decl.h +0 -9
- data/ext/nokogiri/xml_encoding_handler.h +0 -8
- data/ext/nokogiri/xml_entity_decl.h +0 -10
- data/ext/nokogiri/xml_entity_reference.h +0 -9
- data/ext/nokogiri/xml_io.c +0 -61
- data/ext/nokogiri/xml_io.h +0 -11
- data/ext/nokogiri/xml_libxml2_hacks.c +0 -112
- data/ext/nokogiri/xml_libxml2_hacks.h +0 -12
- data/ext/nokogiri/xml_namespace.h +0 -14
- data/ext/nokogiri/xml_node.h +0 -13
- data/ext/nokogiri/xml_node_set.h +0 -12
- data/ext/nokogiri/xml_processing_instruction.h +0 -9
- data/ext/nokogiri/xml_reader.h +0 -10
- data/ext/nokogiri/xml_relax_ng.h +0 -9
- data/ext/nokogiri/xml_sax_parser.h +0 -39
- data/ext/nokogiri/xml_sax_parser_context.h +0 -10
- data/ext/nokogiri/xml_sax_push_parser.h +0 -9
- data/ext/nokogiri/xml_schema.h +0 -9
- data/ext/nokogiri/xml_syntax_error.h +0 -13
- data/ext/nokogiri/xml_text.h +0 -9
- data/ext/nokogiri/xml_xpath_context.h +0 -10
- data/ext/nokogiri/xslt_stylesheet.h +0 -14
@@ -1,28 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Nokogiri
|
2
3
|
module HTML
|
3
4
|
class DocumentFragment < Nokogiri::XML::DocumentFragment
|
4
5
|
####
|
5
6
|
# Create a Nokogiri::XML::DocumentFragment from +tags+, using +encoding+
|
6
|
-
def self.parse
|
7
|
+
def self.parse(tags, encoding = nil)
|
7
8
|
doc = HTML::Document.new
|
8
9
|
|
9
10
|
encoding ||= if tags.respond_to?(:encoding)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
encoding = tags.encoding
|
12
|
+
if encoding == ::Encoding::ASCII_8BIT
|
13
|
+
'UTF-8'
|
14
|
+
else
|
15
|
+
encoding.name
|
16
|
+
end
|
17
|
+
else
|
18
|
+
'UTF-8'
|
19
|
+
end
|
19
20
|
|
20
21
|
doc.encoding = encoding
|
21
22
|
|
22
23
|
new(doc, tags)
|
23
24
|
end
|
24
25
|
|
25
|
-
def initialize
|
26
|
+
def initialize(document, tags = nil, ctx = nil)
|
26
27
|
return self unless tags
|
27
28
|
|
28
29
|
if ctx
|
@@ -32,13 +33,13 @@ module Nokogiri
|
|
32
33
|
self.errors = document.errors - preexisting_errors
|
33
34
|
else
|
34
35
|
# This is a horrible hack, but I don't care
|
35
|
-
|
36
|
-
|
36
|
+
path = if /^\s*?<body/i.match?(tags)
|
37
|
+
"/html/body"
|
37
38
|
else
|
38
|
-
|
39
|
+
"/html/body/node()"
|
39
40
|
end
|
40
41
|
|
41
|
-
temp_doc = HTML::Document.parse
|
42
|
+
temp_doc = HTML::Document.parse("<html><body>#{tags}", nil, document.encoding)
|
42
43
|
temp_doc.xpath(path).each { |child| child.parent = self }
|
43
44
|
self.errors = temp_doc.errors
|
44
45
|
end
|
@@ -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,205 @@
|
|
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 windows?
|
14
|
+
::RUBY_PLATFORM =~ /mingw|mswin/
|
15
|
+
end
|
16
|
+
|
17
|
+
def ruby_minor
|
18
|
+
Gem::Version.new(::RUBY_VERSION).segments[0..1].join(".")
|
19
|
+
end
|
20
|
+
|
21
|
+
def engine
|
22
|
+
defined?(::RUBY_ENGINE) ? ::RUBY_ENGINE : "mri"
|
23
|
+
end
|
24
|
+
|
25
|
+
def loaded_libxml_version
|
26
|
+
Gem::Version.new(Nokogiri::LIBXML_LOADED_VERSION
|
27
|
+
.scan(/^(\d+)(\d\d)(\d\d)(?!\d)/).first
|
28
|
+
.collect(&:to_i)
|
29
|
+
.join("."))
|
30
|
+
end
|
31
|
+
|
32
|
+
def compiled_libxml_version
|
33
|
+
Gem::Version.new(Nokogiri::LIBXML_COMPILED_VERSION)
|
34
|
+
end
|
35
|
+
|
36
|
+
def loaded_libxslt_version
|
37
|
+
Gem::Version.new(Nokogiri::LIBXSLT_LOADED_VERSION
|
38
|
+
.scan(/^(\d+)(\d\d)(\d\d)(?!\d)/).first
|
39
|
+
.collect(&:to_i)
|
40
|
+
.join("."))
|
41
|
+
end
|
42
|
+
|
43
|
+
def compiled_libxslt_version
|
44
|
+
Gem::Version.new(Nokogiri::LIBXSLT_COMPILED_VERSION)
|
45
|
+
end
|
46
|
+
|
47
|
+
def libxml2?
|
48
|
+
defined?(Nokogiri::LIBXML_COMPILED_VERSION)
|
49
|
+
end
|
50
|
+
|
51
|
+
def libxml2_has_iconv?
|
52
|
+
defined?(Nokogiri::LIBXML_ICONV_ENABLED) && Nokogiri::LIBXML_ICONV_ENABLED
|
53
|
+
end
|
54
|
+
|
55
|
+
def libxml2_using_packaged?
|
56
|
+
libxml2? && Nokogiri::PACKAGED_LIBRARIES
|
57
|
+
end
|
58
|
+
|
59
|
+
def libxml2_using_system?
|
60
|
+
libxml2? && !libxml2_using_packaged?
|
61
|
+
end
|
62
|
+
|
63
|
+
def libxml2_precompiled?
|
64
|
+
libxml2_using_packaged? && Nokogiri::PRECOMPILED_LIBRARIES
|
65
|
+
end
|
66
|
+
|
67
|
+
def warnings
|
68
|
+
warnings = []
|
69
|
+
|
70
|
+
if libxml2?
|
71
|
+
if compiled_libxml_version != loaded_libxml_version
|
72
|
+
warnings << "Nokogiri was built against libxml version #{compiled_libxml_version}, but has dynamically loaded #{loaded_libxml_version}"
|
73
|
+
end
|
74
|
+
|
75
|
+
if compiled_libxslt_version != loaded_libxslt_version
|
76
|
+
warnings << "Nokogiri was built against libxslt version #{compiled_libxslt_version}, but has dynamically loaded #{loaded_libxslt_version}"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
warnings
|
81
|
+
end
|
82
|
+
|
83
|
+
def to_hash
|
84
|
+
header_directory = File.expand_path(File.join(File.dirname(__FILE__), "../../../ext/nokogiri"))
|
85
|
+
|
86
|
+
{}.tap do |vi|
|
87
|
+
vi["warnings"] = []
|
88
|
+
vi["nokogiri"] = {}.tap do |nokogiri|
|
89
|
+
nokogiri["version"] = Nokogiri::VERSION
|
90
|
+
|
91
|
+
unless jruby?
|
92
|
+
# enable gems like nokogumbo to build with the following in their extconf.rb:
|
93
|
+
#
|
94
|
+
# append_cflags(Nokogiri::VERSION_INFO["nokogiri"]["cppflags"])
|
95
|
+
# append_ldflags(Nokogiri::VERSION_INFO["nokogiri"]["ldflags"])
|
96
|
+
#
|
97
|
+
cppflags = ["-I#{header_directory.shellescape}"]
|
98
|
+
ldflags = []
|
99
|
+
|
100
|
+
if libxml2_using_packaged?
|
101
|
+
cppflags << "-I#{File.join(header_directory, 'include').shellescape}"
|
102
|
+
cppflags << "-I#{File.join(header_directory, 'include/libxml2').shellescape}"
|
103
|
+
|
104
|
+
if windows?
|
105
|
+
# on windows, nokogumbo needs to link against nokogiri.so to resolve symbols. see #2167
|
106
|
+
lib_directory = File.expand_path(File.join(File.dirname(__FILE__), "../#{ruby_minor}"))
|
107
|
+
unless File.exist?(lib_directory)
|
108
|
+
lib_directory = File.expand_path(File.join(File.dirname(__FILE__), ".."))
|
109
|
+
end
|
110
|
+
ldflags << "-L#{lib_directory.shellescape}"
|
111
|
+
ldflags << "-l:nokogiri.so"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
nokogiri["cppflags"] = cppflags
|
116
|
+
nokogiri["ldflags"] = ldflags
|
117
|
+
end
|
118
|
+
end
|
119
|
+
vi["ruby"] = {}.tap do |ruby|
|
120
|
+
ruby["version"] = ::RUBY_VERSION
|
121
|
+
ruby["platform"] = ::RUBY_PLATFORM
|
122
|
+
ruby["gem_platform"] = ::Gem::Platform.local.to_s
|
123
|
+
ruby["description"] = ::RUBY_DESCRIPTION
|
124
|
+
ruby["engine"] = engine
|
125
|
+
ruby["jruby"] = jruby? if jruby?
|
126
|
+
end
|
127
|
+
|
128
|
+
if libxml2?
|
129
|
+
vi["libxml"] = {}.tap do |libxml|
|
130
|
+
if libxml2_using_packaged?
|
131
|
+
libxml["source"] = "packaged"
|
132
|
+
libxml["precompiled"] = libxml2_precompiled?
|
133
|
+
libxml["patches"] = Nokogiri::LIBXML2_PATCHES
|
134
|
+
|
135
|
+
# this is for nokogumbo and shouldn't be forever
|
136
|
+
libxml["libxml2_path"] = header_directory
|
137
|
+
else
|
138
|
+
libxml["source"] = "system"
|
139
|
+
end
|
140
|
+
libxml["iconv_enabled"] = libxml2_has_iconv?
|
141
|
+
libxml["compiled"] = compiled_libxml_version.to_s
|
142
|
+
libxml["loaded"] = loaded_libxml_version.to_s
|
143
|
+
end
|
144
|
+
|
145
|
+
vi["libxslt"] = {}.tap do |libxslt|
|
146
|
+
if libxml2_using_packaged?
|
147
|
+
libxslt["source"] = "packaged"
|
148
|
+
libxslt["precompiled"] = libxml2_precompiled?
|
149
|
+
libxslt["patches"] = Nokogiri::LIBXSLT_PATCHES
|
150
|
+
else
|
151
|
+
libxslt["source"] = "system"
|
152
|
+
end
|
153
|
+
libxslt["compiled"] = compiled_libxslt_version.to_s
|
154
|
+
libxslt["loaded"] = loaded_libxslt_version.to_s
|
155
|
+
end
|
156
|
+
|
157
|
+
vi["warnings"] = warnings
|
158
|
+
end
|
159
|
+
|
160
|
+
if defined?(Nokogiri::OTHER_LIBRARY_VERSIONS)
|
161
|
+
# see extconf for how this string is assembled: "lib1name:lib1version,lib2name:lib2version"
|
162
|
+
vi["other_libraries"] = Hash[*Nokogiri::OTHER_LIBRARY_VERSIONS.split(/[,:]/)]
|
163
|
+
elsif jruby?
|
164
|
+
vi["other_libraries"] = {}.tap do |ol|
|
165
|
+
ol["xerces"] = Nokogiri::XERCES_VERSION
|
166
|
+
ol["nekohtml"] = Nokogiri::NEKO_VERSION
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def to_markdown
|
173
|
+
begin
|
174
|
+
require "psych"
|
175
|
+
rescue LoadError
|
176
|
+
end
|
177
|
+
require "yaml"
|
178
|
+
"# Nokogiri (#{Nokogiri::VERSION})\n" +
|
179
|
+
YAML.dump(to_hash).each_line.map { |line| " #{line}" }.join
|
180
|
+
end
|
181
|
+
|
182
|
+
instance.warnings.each do |warning|
|
183
|
+
warn "WARNING: #{warning}"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
def self.uses_libxml?(requirement = nil) # :nodoc:
|
188
|
+
return false unless VersionInfo.instance.libxml2?
|
189
|
+
return true unless requirement
|
190
|
+
Gem::Requirement.new(requirement).satisfied_by?(VersionInfo.instance.loaded_libxml_version)
|
191
|
+
end
|
192
|
+
|
193
|
+
def self.jruby? # :nodoc:
|
194
|
+
VersionInfo.instance.jruby?
|
195
|
+
end
|
196
|
+
|
197
|
+
# Ensure constants used in this file are loaded - see #1896
|
198
|
+
if Nokogiri.jruby?
|
199
|
+
require "nokogiri/jruby/dependencies"
|
200
|
+
end
|
201
|
+
require "nokogiri/extension"
|
202
|
+
|
203
|
+
# More complete version information about libxml
|
204
|
+
VERSION_INFO = VersionInfo.instance.to_hash
|
205
|
+
end
|