nokogiri 1.12.2-x64-mingw32 → 1.13.0-x64-mingw32
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 +2 -0
- data/README.md +9 -7
- data/bin/nokogiri +63 -50
- data/dependencies.yml +5 -6
- data/ext/nokogiri/extconf.rb +51 -35
- data/ext/nokogiri/gumbo.c +11 -11
- data/ext/nokogiri/html4_element_description.c +1 -1
- data/ext/nokogiri/html4_sax_parser_context.c +2 -1
- data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +1 -0
- data/ext/nokogiri/include/libxslt/xsltconfig.h +1 -1
- data/ext/nokogiri/nokogiri.c +1 -1
- data/ext/nokogiri/nokogiri.h +3 -0
- data/ext/nokogiri/xml_document.c +36 -36
- data/ext/nokogiri/xml_document_fragment.c +0 -2
- data/ext/nokogiri/xml_dtd.c +2 -2
- data/ext/nokogiri/xml_encoding_handler.c +25 -11
- data/ext/nokogiri/xml_namespace.c +2 -2
- data/ext/nokogiri/xml_node.c +647 -335
- data/ext/nokogiri/xml_reader.c +37 -11
- data/ext/nokogiri/xml_xpath_context.c +72 -49
- data/lib/nokogiri/2.6/nokogiri.so +0 -0
- data/lib/nokogiri/2.7/nokogiri.so +0 -0
- data/lib/nokogiri/3.0/nokogiri.so +0 -0
- data/lib/nokogiri/class_resolver.rb +67 -0
- data/lib/nokogiri/css/node.rb +9 -8
- data/lib/nokogiri/css/parser.rb +11 -3
- data/lib/nokogiri/css/parser.y +10 -2
- data/lib/nokogiri/css/parser_extras.rb +20 -20
- data/lib/nokogiri/css/syntax_error.rb +1 -0
- data/lib/nokogiri/css/tokenizer.rb +2 -1
- data/lib/nokogiri/css/tokenizer.rex +2 -1
- data/lib/nokogiri/css/xpath_visitor.rb +174 -75
- data/lib/nokogiri/css.rb +38 -6
- data/lib/nokogiri/decorators/slop.rb +8 -7
- data/lib/nokogiri/extension.rb +1 -1
- data/lib/nokogiri/gumbo.rb +1 -0
- data/lib/nokogiri/html.rb +16 -10
- data/lib/nokogiri/html4/builder.rb +1 -0
- data/lib/nokogiri/html4/document.rb +84 -75
- data/lib/nokogiri/html4/document_fragment.rb +11 -7
- data/lib/nokogiri/html4/element_description.rb +1 -0
- data/lib/nokogiri/html4/element_description_defaults.rb +426 -520
- data/lib/nokogiri/html4/entity_lookup.rb +2 -1
- data/lib/nokogiri/html4/sax/parser.rb +2 -1
- data/lib/nokogiri/html4/sax/parser_context.rb +1 -0
- data/lib/nokogiri/html4/sax/push_parser.rb +7 -7
- data/lib/nokogiri/html4.rb +11 -5
- data/lib/nokogiri/html5/document.rb +24 -10
- data/lib/nokogiri/html5/document_fragment.rb +5 -2
- data/lib/nokogiri/html5/node.rb +6 -3
- data/lib/nokogiri/html5.rb +68 -64
- data/lib/nokogiri/jruby/dependencies.rb +10 -9
- data/lib/nokogiri/syntax_error.rb +1 -0
- data/lib/nokogiri/version/constant.rb +2 -1
- data/lib/nokogiri/version/info.rb +19 -13
- data/lib/nokogiri/version.rb +1 -0
- data/lib/nokogiri/xml/attr.rb +5 -3
- data/lib/nokogiri/xml/attribute_decl.rb +2 -1
- data/lib/nokogiri/xml/builder.rb +69 -31
- data/lib/nokogiri/xml/cdata.rb +2 -1
- data/lib/nokogiri/xml/character_data.rb +1 -0
- data/lib/nokogiri/xml/document.rb +178 -96
- data/lib/nokogiri/xml/document_fragment.rb +41 -38
- data/lib/nokogiri/xml/dtd.rb +3 -2
- data/lib/nokogiri/xml/element_content.rb +1 -0
- data/lib/nokogiri/xml/element_decl.rb +2 -1
- data/lib/nokogiri/xml/entity_decl.rb +3 -2
- data/lib/nokogiri/xml/entity_reference.rb +1 -0
- data/lib/nokogiri/xml/namespace.rb +2 -0
- data/lib/nokogiri/xml/node/save_options.rb +7 -4
- data/lib/nokogiri/xml/node.rb +512 -348
- data/lib/nokogiri/xml/node_set.rb +46 -54
- data/lib/nokogiri/xml/notation.rb +12 -0
- data/lib/nokogiri/xml/parse_options.rb +11 -7
- data/lib/nokogiri/xml/pp/character_data.rb +8 -6
- data/lib/nokogiri/xml/pp/node.rb +24 -26
- data/lib/nokogiri/xml/pp.rb +1 -0
- data/lib/nokogiri/xml/processing_instruction.rb +2 -1
- data/lib/nokogiri/xml/reader.rb +17 -19
- data/lib/nokogiri/xml/relax_ng.rb +1 -0
- data/lib/nokogiri/xml/sax/document.rb +20 -19
- data/lib/nokogiri/xml/sax/parser.rb +36 -34
- data/lib/nokogiri/xml/sax/parser_context.rb +7 -3
- data/lib/nokogiri/xml/sax/push_parser.rb +5 -5
- data/lib/nokogiri/xml/sax.rb +1 -0
- data/lib/nokogiri/xml/schema.rb +7 -6
- data/lib/nokogiri/xml/searchable.rb +42 -22
- data/lib/nokogiri/xml/syntax_error.rb +4 -4
- data/lib/nokogiri/xml/text.rb +1 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +2 -1
- data/lib/nokogiri/xml/xpath.rb +12 -0
- data/lib/nokogiri/xml/xpath_context.rb +2 -3
- data/lib/nokogiri/xml.rb +3 -3
- data/lib/nokogiri/xslt/stylesheet.rb +1 -0
- data/lib/nokogiri/xslt.rb +3 -2
- data/lib/nokogiri.rb +19 -16
- data/lib/xsd/xmlparser/nokogiri.rb +25 -24
- metadata +122 -51
- data/lib/nokogiri/2.5/nokogiri.so +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4c65220b62e72d6f6a047d0102a0d8adc6a9b7accfb0927ee710359d7731036
|
4
|
+
data.tar.gz: a74bac75a48ca772282cabda8d9a3783fb49e8d601b241d7d1abd33c140026f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ad88fd00a58888a793ba8698353d217a32d4d26bef3b1673c0b3aea17c62ede7c98a2ab074a68ffee2dc14f882b8d7bf4b6bdd7c4269347266f444981b15abc
|
7
|
+
data.tar.gz: 19345b5258a472713f41e4d169008e7309eba0f01d01539667910e4c76458fe3c6fbf5ad3f7f70c9d0800ebacb18434aa5ce098680fa6f3f2dccdbc936ddd8eb
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# Nokogiri
|
4
4
|
|
5
|
-
Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. It provides a sensible, easy-to-understand API for [reading](https://nokogiri.org/tutorials/parsing_an_html_xml_document.html), writing, [modifying](https://nokogiri.org/tutorials/modifying_an_html_xml_document.html), and [querying](https://nokogiri.org/tutorials/searching_a_xml_html_document.html) documents. It is fast and standards-compliant by relying on native parsers like libxml2 (
|
5
|
+
Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby. It provides a sensible, easy-to-understand API for [reading](https://nokogiri.org/tutorials/parsing_an_html_xml_document.html), writing, [modifying](https://nokogiri.org/tutorials/modifying_an_html_xml_document.html), and [querying](https://nokogiri.org/tutorials/searching_a_xml_html_document.html) documents. It is fast and standards-compliant by relying on native parsers like libxml2 (CRuby) and xerces (JRuby).
|
6
6
|
|
7
7
|
## Guiding Principles
|
8
8
|
|
@@ -30,7 +30,9 @@ Some guiding principles Nokogiri tries to follow:
|
|
30
30
|
[![Appveyor CI](https://ci.appveyor.com/api/projects/status/xj2pqwvlxwuwgr06/branch/main?svg=true)](https://ci.appveyor.com/project/flavorjones/nokogiri/branch/main)
|
31
31
|
|
32
32
|
[![Gem Version](https://badge.fury.io/rb/nokogiri.svg)](https://rubygems.org/gems/nokogiri)
|
33
|
-
[![SemVer compatibility](https://
|
33
|
+
[![SemVer compatibility](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=nokogiri&package-manager=bundler&previous-version=1.11.7&new-version=1.12.5)](https://docs.github.com/en/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-dependabot-security-updates#about-compatibility-scores)
|
34
|
+
|
35
|
+
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5344/badge)](https://bestpractices.coreinfrastructure.org/projects/5344)
|
34
36
|
[![Tidelift dependencies](https://tidelift.com/badges/package/rubygems/nokogiri)](https://tidelift.com/subscription/pkg/rubygems-nokogiri?utm_source=rubygems-nokogiri&utm_medium=referral&utm_campaign=readme)
|
35
37
|
|
36
38
|
|
@@ -78,7 +80,7 @@ Full information and description of our security policy is in [`SECURITY.md`](SE
|
|
78
80
|
|
79
81
|
### Semantic Versioning Policy
|
80
82
|
|
81
|
-
Nokogiri follows [Semantic Versioning](https://semver.org/) (since 2017 or so). [![Dependabot's SemVer compatibility score for Nokogiri](https://
|
83
|
+
Nokogiri follows [Semantic Versioning](https://semver.org/) (since 2017 or so). [![Dependabot's SemVer compatibility score for Nokogiri](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=nokogiri&package-manager=bundler&previous-version=1.11.7&new-version=1.12.5)](https://docs.github.com/en/code-security/supply-chain-security/managing-vulnerabilities-in-your-projects-dependencies/about-dependabot-security-updates#about-compatibility-scores)
|
82
84
|
|
83
85
|
We bump `Major.Minor.Patch` versions following this guidance:
|
84
86
|
|
@@ -105,8 +107,8 @@ We bump `Major.Minor.Patch` versions following this guidance:
|
|
105
107
|
|
106
108
|
Requirements:
|
107
109
|
|
108
|
-
- Ruby >= 2.
|
109
|
-
- JRuby >= 9.
|
110
|
+
- Ruby >= 2.6
|
111
|
+
- JRuby >= 9.3.0.0
|
110
112
|
|
111
113
|
|
112
114
|
### Native Gems: Faster, more reliable installation
|
@@ -115,12 +117,12 @@ Requirements:
|
|
115
117
|
|
116
118
|
### Supported Platforms
|
117
119
|
|
118
|
-
|
120
|
+
Nokogiri ships pre-compiled, "native" gems for the following platforms:
|
119
121
|
|
120
122
|
- Linux: `x86-linux` and `x86_64-linux` (req: `glibc >= 2.17`), including musl platforms like Alpine
|
121
123
|
- Darwin/MacOS: `x86_64-darwin` and `arm64-darwin`
|
122
124
|
- Windows: `x86-mingw32` and `x64-mingw32`
|
123
|
-
- Java: any platform running JRuby 9.
|
125
|
+
- Java: any platform running JRuby 9.3 or higher
|
124
126
|
|
125
127
|
To determine whether your system supports one of these gems, look at the output of `bundle platform` or `ruby -e 'puts Gem::Platform.local.to_s'`.
|
126
128
|
|
data/bin/nokogiri
CHANGED
@@ -1,61 +1,77 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "optparse"
|
5
|
+
require "open-uri"
|
6
|
+
require "uri"
|
7
|
+
require "rubygems"
|
8
|
+
require "nokogiri"
|
9
|
+
autoload :IRB, "irb"
|
8
10
|
|
9
11
|
parse_class = Nokogiri
|
10
12
|
encoding = nil
|
11
13
|
|
12
14
|
# This module provides some tunables with the nokogiri CLI for use in
|
13
15
|
# your ~/.nokogirirc.
|
14
|
-
module Nokogiri
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
16
|
+
module Nokogiri
|
17
|
+
module CLI
|
18
|
+
class << self
|
19
|
+
# Specify the console engine, defaulted to IRB.
|
20
|
+
#
|
21
|
+
# call-seq:
|
22
|
+
# require 'pry'
|
23
|
+
# Nokogiri::CLI.console = Pry
|
24
|
+
attr_writer :console
|
25
|
+
|
26
|
+
def console
|
27
|
+
case @console
|
28
|
+
when Symbol
|
29
|
+
Kernel.const_get(@console)
|
30
|
+
else
|
31
|
+
@console
|
32
|
+
end
|
29
33
|
end
|
34
|
+
|
35
|
+
attr_accessor :rcfile
|
30
36
|
end
|
31
37
|
|
32
|
-
|
38
|
+
self.rcfile = File.expand_path("~/.nokogirirc")
|
39
|
+
self.console = :IRB
|
33
40
|
end
|
41
|
+
end
|
34
42
|
|
35
|
-
|
36
|
-
|
43
|
+
def safe_read(uri_or_path)
|
44
|
+
uri = URI.parse(uri_or_path)
|
45
|
+
case uri
|
46
|
+
when URI::HTTP
|
47
|
+
uri.read
|
48
|
+
when URI::File
|
49
|
+
File.read(uri.path)
|
50
|
+
else
|
51
|
+
File.read(uri_or_path)
|
52
|
+
end
|
37
53
|
end
|
38
54
|
|
39
55
|
opts = OptionParser.new do |opts|
|
40
56
|
opts.banner = "Nokogiri: an HTML, XML, SAX, and Reader parser"
|
41
|
-
opts.define_head
|
42
|
-
opts.separator
|
43
|
-
opts.separator
|
44
|
-
opts.separator
|
45
|
-
opts.separator
|
46
|
-
opts.separator
|
47
|
-
opts.separator
|
48
|
-
opts.separator
|
57
|
+
opts.define_head("Usage: nokogiri <uri|path> [options]")
|
58
|
+
opts.separator("")
|
59
|
+
opts.separator("Examples:")
|
60
|
+
opts.separator(" nokogiri https://www.ruby-lang.org/")
|
61
|
+
opts.separator(" nokogiri ./public/index.html")
|
62
|
+
opts.separator(" curl -s http://www.nokogiri.org | nokogiri -e'p $_.css(\"h1\").length'")
|
63
|
+
opts.separator("")
|
64
|
+
opts.separator("Options:")
|
49
65
|
|
50
66
|
opts.on("--type type", "Parse as type: xml or html (default: auto)", [:xml, :html]) do |v|
|
51
|
-
parse_class = {:
|
67
|
+
parse_class = { xml: Nokogiri::XML, html: Nokogiri::HTML }[v]
|
52
68
|
end
|
53
69
|
|
54
70
|
opts.on("-C file", "Specifies initialization file to load (default #{Nokogiri::CLI.rcfile})") do |v|
|
55
71
|
Nokogiri::CLI.rcfile = v
|
56
72
|
end
|
57
73
|
|
58
|
-
opts.on("-E", "--encoding encoding", "Read as encoding (default: #{encoding ||
|
74
|
+
opts.on("-E", "--encoding encoding", "Read as encoding (default: #{encoding || "none"})") do |v|
|
59
75
|
encoding = v
|
60
76
|
end
|
61
77
|
|
@@ -64,7 +80,7 @@ opts = OptionParser.new do |opts|
|
|
64
80
|
end
|
65
81
|
|
66
82
|
opts.on("--rng <uri|path>", "Validate using this rng file.") do |v|
|
67
|
-
@rng =
|
83
|
+
@rng = Nokogiri::XML::RelaxNG(safe_read(v))
|
68
84
|
end
|
69
85
|
|
70
86
|
opts.on_tail("-?", "--help", "Show this message") do
|
@@ -90,15 +106,10 @@ if File.file?(Nokogiri::CLI.rcfile)
|
|
90
106
|
load Nokogiri::CLI.rcfile
|
91
107
|
end
|
92
108
|
|
93
|
-
if url || $stdin.tty?
|
94
|
-
|
95
|
-
when URI::HTTP
|
96
|
-
@doc = parse_class.parse(uri.read, url, encoding)
|
97
|
-
else
|
98
|
-
@doc = parse_class.parse(open(url).read, nil, encoding)
|
99
|
-
end
|
109
|
+
@doc = if url || $stdin.tty?
|
110
|
+
parse_class.parse(safe_read(url), url, encoding)
|
100
111
|
else
|
101
|
-
|
112
|
+
parse_class.parse($stdin, nil, encoding)
|
102
113
|
end
|
103
114
|
|
104
115
|
$_ = @doc
|
@@ -107,12 +118,14 @@ if @rng
|
|
107
118
|
@rng.validate(@doc).each do |error|
|
108
119
|
puts error.message
|
109
120
|
end
|
110
|
-
|
111
|
-
|
112
|
-
eval
|
113
|
-
|
114
|
-
|
115
|
-
|
121
|
+
elsif @script
|
122
|
+
begin
|
123
|
+
eval(@script, binding, "<main>") # rubocop:disable Security/Eval
|
124
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
125
|
+
warn("ERROR: Exception raised while evaluating '#{@script}'")
|
126
|
+
raise e
|
116
127
|
end
|
128
|
+
else
|
129
|
+
puts "Your document is stored in @doc..."
|
130
|
+
Nokogiri::CLI.console.start
|
117
131
|
end
|
118
|
-
|
data/dependencies.yml
CHANGED
@@ -64,11 +64,10 @@ zlib:
|
|
64
64
|
# SHA-256 hash provided on http://zlib.net/
|
65
65
|
|
66
66
|
libiconv:
|
67
|
-
version: "1.
|
68
|
-
sha256: "
|
69
|
-
# gpg: Signature made Fri
|
67
|
+
version: "1.16"
|
68
|
+
sha256: "e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04"
|
69
|
+
# gpg: Signature made Fri 26 Apr 2019 03:36:38 PM EDT
|
70
70
|
# gpg: using RSA key 4F494A942E4616C2
|
71
|
-
# gpg: Good signature from "Bruno Haible (Open Source Development) <bruno@clisp.org>" [
|
72
|
-
# gpg:
|
73
|
-
# gpg: There is no indication that the signature belongs to the owner.
|
71
|
+
# gpg: Good signature from "Bruno Haible (Open Source Development) <bruno@clisp.org>" [expired]
|
72
|
+
# gpg: Note: This key has expired!
|
74
73
|
# Primary key fingerprint: 68D9 4D8A AEEA D48A E7DC 5B90 4F49 4A94 2E46 16C2
|
data/ext/nokogiri/extconf.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
|
2
|
+
|
3
|
+
# rubocop:disable Style/GlobalVars
|
4
|
+
|
5
|
+
ENV["RC_ARCHS"] = "" if RUBY_PLATFORM.include?("darwin")
|
3
6
|
|
4
7
|
require "mkmf"
|
5
8
|
require "rbconfig"
|
@@ -12,16 +15,14 @@ PACKAGE_ROOT_DIR = File.expand_path(File.join(File.dirname(__FILE__), "..", ".."
|
|
12
15
|
REQUIRED_LIBXML_VERSION = "2.6.21"
|
13
16
|
RECOMMENDED_LIBXML_VERSION = "2.9.3"
|
14
17
|
|
15
|
-
#
|
16
|
-
# Keep this version in sync with the one in the Rakefile !
|
17
|
-
REQUIRED_MINI_PORTILE_VERSION = "~> 2.6.1"
|
18
|
+
REQUIRED_MINI_PORTILE_VERSION = "~> 2.7.0" # keep this version in sync with the one in the gemspec
|
18
19
|
REQUIRED_PKG_CONFIG_VERSION = "~> 1.1"
|
19
20
|
|
20
21
|
# Keep track of what versions of what libraries we build against
|
21
22
|
OTHER_LIBRARY_VERSIONS = {}
|
22
23
|
|
23
24
|
NOKOGIRI_HELP_MESSAGE = <<~HELP
|
24
|
-
USAGE: ruby #{$
|
25
|
+
USAGE: ruby #{$PROGRAM_NAME} [options]
|
25
26
|
|
26
27
|
Flags that are always valid:
|
27
28
|
|
@@ -175,23 +176,23 @@ def config_system_libraries?
|
|
175
176
|
end
|
176
177
|
|
177
178
|
def windows?
|
178
|
-
RbConfig::CONFIG["target_os"]
|
179
|
+
RbConfig::CONFIG["target_os"].match?(/mingw|mswin/)
|
179
180
|
end
|
180
181
|
|
181
182
|
def solaris?
|
182
|
-
RbConfig::CONFIG["target_os"]
|
183
|
+
RbConfig::CONFIG["target_os"].include?("solaris")
|
183
184
|
end
|
184
185
|
|
185
186
|
def darwin?
|
186
|
-
RbConfig::CONFIG["target_os"]
|
187
|
+
RbConfig::CONFIG["target_os"].include?("darwin")
|
187
188
|
end
|
188
189
|
|
189
190
|
def openbsd?
|
190
|
-
RbConfig::CONFIG["target_os"]
|
191
|
+
RbConfig::CONFIG["target_os"].include?("openbsd")
|
191
192
|
end
|
192
193
|
|
193
194
|
def aix?
|
194
|
-
RbConfig::CONFIG["target_os"]
|
195
|
+
RbConfig::CONFIG["target_os"].include?("aix")
|
195
196
|
end
|
196
197
|
|
197
198
|
def nix?
|
@@ -284,17 +285,16 @@ ensure
|
|
284
285
|
end
|
285
286
|
|
286
287
|
def abort_could_not_find_library(lib)
|
287
|
-
|
288
|
+
callers = caller(1..2).join("\n")
|
289
|
+
abort("-----\n#{callers}\n#{lib} is missing. Please locate mkmf.log to investigate how it is failing.\n-----")
|
288
290
|
end
|
289
291
|
|
290
|
-
def chdir_for_build
|
292
|
+
def chdir_for_build(&block)
|
291
293
|
# When using rake-compiler-dock on Windows, the underlying Virtualbox shared
|
292
294
|
# folders don't support symlinks, but libiconv expects it for a build on
|
293
295
|
# Linux. We work around this limitation by using the temp dir for cooking.
|
294
|
-
build_dir = ENV["RCD_HOST_RUBY_PLATFORM"].to_s
|
295
|
-
Dir.chdir(build_dir)
|
296
|
-
yield
|
297
|
-
end
|
296
|
+
build_dir = /mingw|mswin|cygwin/.match?(ENV["RCD_HOST_RUBY_PLATFORM"].to_s) ? "/tmp" : "."
|
297
|
+
Dir.chdir(build_dir, &block)
|
298
298
|
end
|
299
299
|
|
300
300
|
def sh_export_path(path)
|
@@ -402,9 +402,9 @@ def iconv_configure_flags
|
|
402
402
|
abort_could_not_find_library("libiconv")
|
403
403
|
end
|
404
404
|
|
405
|
-
def process_recipe(name, version, static_p, cross_p, cacheable_p=true)
|
405
|
+
def process_recipe(name, version, static_p, cross_p, cacheable_p = true)
|
406
406
|
require "rubygems"
|
407
|
-
gem("mini_portile2", REQUIRED_MINI_PORTILE_VERSION)
|
407
|
+
gem("mini_portile2", REQUIRED_MINI_PORTILE_VERSION) # gemspec is not respected at install time
|
408
408
|
require "mini_portile2"
|
409
409
|
message("Using mini_portile version #{MiniPortile::VERSION}\n")
|
410
410
|
|
@@ -413,9 +413,13 @@ def process_recipe(name, version, static_p, cross_p, cacheable_p=true)
|
|
413
413
|
end
|
414
414
|
|
415
415
|
MiniPortile.new(name, version).tap do |recipe|
|
416
|
+
def recipe.port_path
|
417
|
+
"#{@target}/#{RUBY_PLATFORM}/#{@name}/#{@version}"
|
418
|
+
end
|
419
|
+
|
416
420
|
recipe.target = File.join(PACKAGE_ROOT_DIR, "ports") if cacheable_p
|
417
|
-
# Prefer host_alias over host in order to use
|
418
|
-
#
|
421
|
+
# Prefer host_alias over host in order to use the correct compiler prefix for cross build, but
|
422
|
+
# use host if not set.
|
419
423
|
recipe.host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
|
420
424
|
recipe.configure_options << "--libdir=#{File.join(recipe.path, "lib")}"
|
421
425
|
|
@@ -462,7 +466,7 @@ def process_recipe(name, version, static_p, cross_p, cacheable_p=true)
|
|
462
466
|
end
|
463
467
|
|
464
468
|
if RbConfig::CONFIG["target_cpu"] == "universal"
|
465
|
-
|
469
|
+
["CFLAGS", "LDFLAGS"].each do |key|
|
466
470
|
unless env[key].include?("-arch")
|
467
471
|
env[key] = concat_flags(env[key], RbConfig::CONFIG["ARCH_FLAG"])
|
468
472
|
end
|
@@ -473,7 +477,7 @@ def process_recipe(name, version, static_p, cross_p, cacheable_p=true)
|
|
473
477
|
"#{key}=#{value.strip}"
|
474
478
|
end
|
475
479
|
|
476
|
-
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{
|
480
|
+
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{RUBY_PLATFORM}.installed"
|
477
481
|
if File.exist?(checkpoint) && !recipe.source_directory
|
478
482
|
message("Building Nokogiri with a packaged version of #{name}-#{version}.\n")
|
479
483
|
else
|
@@ -487,7 +491,7 @@ def process_recipe(name, version, static_p, cross_p, cacheable_p=true)
|
|
487
491
|
message("The following patches are being applied:\n")
|
488
492
|
|
489
493
|
recipe.patch_files.each do |patch|
|
490
|
-
message(" - %s\n"
|
494
|
+
message(format(" - %s\n", File.basename(patch)))
|
491
495
|
end
|
492
496
|
end
|
493
497
|
|
@@ -594,6 +598,10 @@ append_cppflags(ENV["CPPFLAGS"].split) unless ENV["CPPFLAGS"].nil?
|
|
594
598
|
append_ldflags(ENV["LDFLAGS"].split) unless ENV["LDFLAGS"].nil?
|
595
599
|
$LIBS = concat_flags($LIBS, ENV["LIBS"])
|
596
600
|
|
601
|
+
# nokogumbo code uses C90/C99 features, let's make sure older compilers won't give
|
602
|
+
# errors/warnings. see #2302
|
603
|
+
append_cflags(["-std=c99", "-Wno-declaration-after-statement"])
|
604
|
+
|
597
605
|
# always include debugging information
|
598
606
|
append_cflags("-g")
|
599
607
|
|
@@ -652,7 +660,7 @@ else
|
|
652
660
|
if cross_build_p || windows?
|
653
661
|
zlib_recipe = process_recipe("zlib", dependencies["zlib"]["version"], static_p, cross_build_p) do |recipe|
|
654
662
|
recipe.files = [{
|
655
|
-
url: "
|
663
|
+
url: "https://zlib.net/fossils/#{recipe.name}-#{recipe.version}.tar.gz",
|
656
664
|
sha256: dependencies["zlib"]["sha256"],
|
657
665
|
}]
|
658
666
|
if windows?
|
@@ -696,7 +704,7 @@ else
|
|
696
704
|
end
|
697
705
|
|
698
706
|
def compile
|
699
|
-
if
|
707
|
+
if /darwin/.match?(host)
|
700
708
|
execute("compile", "make AR=#{host}-libtool")
|
701
709
|
else
|
702
710
|
super
|
@@ -710,10 +718,13 @@ else
|
|
710
718
|
libiconv_recipe = process_recipe("libiconv", dependencies["libiconv"]["version"], static_p,
|
711
719
|
cross_build_p) do |recipe|
|
712
720
|
recipe.files = [{
|
713
|
-
url: "
|
721
|
+
url: "https://ftp.gnu.org/pub/gnu/libiconv/#{recipe.name}-#{recipe.version}.tar.gz",
|
714
722
|
sha256: dependencies["libiconv"]["sha256"],
|
715
723
|
}]
|
716
724
|
|
725
|
+
# The libiconv configure script doesn't accept "arm64" host string but "aarch64"
|
726
|
+
recipe.host = recipe.host.gsub("arm64-apple-darwin", "aarch64-apple-darwin")
|
727
|
+
|
717
728
|
cflags = concat_flags(ENV["CFLAGS"], "-O2", "-U_FORTIFY_SOURCE", "-g")
|
718
729
|
|
719
730
|
recipe.configure_options += [
|
@@ -737,12 +748,21 @@ else
|
|
737
748
|
Tools" to open the developer site, download the installer for your OS
|
738
749
|
version and run it.
|
739
750
|
-----
|
740
|
-
|
751
|
+
EOM
|
741
752
|
end
|
742
753
|
|
743
|
-
|
744
|
-
|
745
|
-
|
754
|
+
if zlib_recipe
|
755
|
+
append_cppflags("-I#{zlib_recipe.path}/include")
|
756
|
+
$LIBPATH = ["#{zlib_recipe.path}/lib"] | $LIBPATH
|
757
|
+
ensure_package_configuration(opt: "zlib", pc: "zlib", lib: "z",
|
758
|
+
headers: "zlib.h", func: "gzdopen")
|
759
|
+
end
|
760
|
+
|
761
|
+
if libiconv_recipe
|
762
|
+
append_cppflags("-I#{libiconv_recipe.path}/include")
|
763
|
+
$LIBPATH = ["#{libiconv_recipe.path}/lib"] | $LIBPATH
|
764
|
+
ensure_package_configuration(opt: "iconv", pc: "iconv", lib: "iconv",
|
765
|
+
headers: "iconv.h", func: "iconv_open")
|
746
766
|
end
|
747
767
|
|
748
768
|
libxml2_recipe = process_recipe("libxml2", dependencies["libxml2"]["version"], static_p, cross_build_p) do |recipe|
|
@@ -761,7 +781,6 @@ else
|
|
761
781
|
|
762
782
|
if zlib_recipe
|
763
783
|
recipe.configure_options << "--with-zlib=#{zlib_recipe.path}"
|
764
|
-
cflags = concat_flags(cflags, "-I#{zlib_recipe.path}/include")
|
765
784
|
end
|
766
785
|
|
767
786
|
if libiconv_recipe
|
@@ -830,9 +849,6 @@ else
|
|
830
849
|
append_cppflags("-DNOKOGIRI_PACKAGED_LIBRARIES")
|
831
850
|
append_cppflags("-DNOKOGIRI_PRECOMPILED_LIBRARIES") if cross_build_p
|
832
851
|
|
833
|
-
$LIBPATH = ["#{zlib_recipe.path}/lib"] | $LIBPATH if zlib_recipe
|
834
|
-
$LIBPATH = ["#{libiconv_recipe.path}/lib"] | $LIBPATH if libiconv_recipe
|
835
|
-
|
836
852
|
$libs = $libs.shellsplit.tap do |libs|
|
837
853
|
[libxml2_recipe, libxslt_recipe].each do |recipe|
|
838
854
|
libname = recipe.name[/\Alib(.+)\z/, 1]
|
@@ -925,7 +941,7 @@ libgumbo_recipe = process_recipe("libgumbo", "1.0.0-nokogiri", static_p, cross_b
|
|
925
941
|
|
926
942
|
env = { "CC" => gcc_cmd, "CFLAGS" => cflags }
|
927
943
|
if config_cross_build?
|
928
|
-
if
|
944
|
+
if /darwin/.match?(host)
|
929
945
|
env["AR"] = "#{host}-libtool"
|
930
946
|
env["ARFLAGS"] = "-o"
|
931
947
|
else
|
data/ext/nokogiri/gumbo.c
CHANGED
@@ -75,7 +75,7 @@ new_html_doc(const char *dtd_name, const char *system, const char *public)
|
|
75
75
|
htmlDocPtr doc = htmlNewDocNoDtD(/* URI */ NULL, /* ExternalID */NULL);
|
76
76
|
assert(doc);
|
77
77
|
if (dtd_name) {
|
78
|
-
xmlCreateIntSubset(doc,
|
78
|
+
xmlCreateIntSubset(doc, (const xmlChar *)dtd_name, (const xmlChar *)public, (const xmlChar *)system);
|
79
79
|
}
|
80
80
|
return doc;
|
81
81
|
}
|
@@ -120,11 +120,11 @@ lookup_or_add_ns(
|
|
120
120
|
const char *prefix
|
121
121
|
)
|
122
122
|
{
|
123
|
-
xmlNsPtr ns = xmlSearchNs(doc, root,
|
123
|
+
xmlNsPtr ns = xmlSearchNs(doc, root, (const xmlChar *)prefix);
|
124
124
|
if (ns) {
|
125
125
|
return ns;
|
126
126
|
}
|
127
|
-
return xmlNewNs(root,
|
127
|
+
return xmlNewNs(root, (const xmlChar *)href, (const xmlChar *)prefix);
|
128
128
|
}
|
129
129
|
|
130
130
|
static void
|
@@ -181,20 +181,20 @@ build_tree(
|
|
181
181
|
|
182
182
|
case GUMBO_NODE_TEXT:
|
183
183
|
case GUMBO_NODE_WHITESPACE:
|
184
|
-
xml_child = xmlNewDocText(doc,
|
184
|
+
xml_child = xmlNewDocText(doc, (const xmlChar *)gumbo_child->v.text.text);
|
185
185
|
set_line(xml_child, gumbo_child->v.text.start_pos.line);
|
186
186
|
xmlAddChild(xml_node, xml_child);
|
187
187
|
break;
|
188
188
|
|
189
189
|
case GUMBO_NODE_CDATA:
|
190
|
-
xml_child = xmlNewCDataBlock(doc,
|
190
|
+
xml_child = xmlNewCDataBlock(doc, (const xmlChar *)gumbo_child->v.text.text,
|
191
191
|
(int) strlen(gumbo_child->v.text.text));
|
192
192
|
set_line(xml_child, gumbo_child->v.text.start_pos.line);
|
193
193
|
xmlAddChild(xml_node, xml_child);
|
194
194
|
break;
|
195
195
|
|
196
196
|
case GUMBO_NODE_COMMENT:
|
197
|
-
xml_child = xmlNewDocComment(doc,
|
197
|
+
xml_child = xmlNewDocComment(doc, (const xmlChar *)gumbo_child->v.text.text);
|
198
198
|
set_line(xml_child, gumbo_child->v.text.start_pos.line);
|
199
199
|
xmlAddChild(xml_node, xml_child);
|
200
200
|
break;
|
@@ -202,7 +202,7 @@ build_tree(
|
|
202
202
|
case GUMBO_NODE_TEMPLATE:
|
203
203
|
// XXX: Should create a template element and a new DocumentFragment
|
204
204
|
case GUMBO_NODE_ELEMENT: {
|
205
|
-
xml_child = xmlNewDocNode(doc, NULL,
|
205
|
+
xml_child = xmlNewDocNode(doc, NULL, (const xmlChar *)gumbo_child->v.element.name, NULL);
|
206
206
|
set_line(xml_child, gumbo_child->v.element.start_pos.line);
|
207
207
|
if (xml_root == NULL) {
|
208
208
|
xml_root = xml_child;
|
@@ -244,7 +244,7 @@ build_tree(
|
|
244
244
|
default:
|
245
245
|
ns = NULL;
|
246
246
|
}
|
247
|
-
xmlNewNsProp(xml_child, ns,
|
247
|
+
xmlNewNsProp(xml_child, ns, (const xmlChar *)attr->name, (const xmlChar *)attr->value);
|
248
248
|
}
|
249
249
|
|
250
250
|
// Add children for this element.
|
@@ -303,7 +303,7 @@ typedef struct {
|
|
303
303
|
static VALUE
|
304
304
|
parse_cleanup(VALUE parse_args)
|
305
305
|
{
|
306
|
-
ParseArgs *args = (ParseArgs*)parse_args;
|
306
|
+
ParseArgs *args = (ParseArgs *)parse_args;
|
307
307
|
gumbo_destroy_output(args->output);
|
308
308
|
// Make sure garbage collection doesn't mark the objects as being live based
|
309
309
|
// on references from the ParseArgs. This may be unnecessary.
|
@@ -342,7 +342,7 @@ parse(VALUE self, VALUE input, VALUE url, VALUE max_attributes, VALUE max_errors
|
|
342
342
|
static VALUE
|
343
343
|
parse_continue(VALUE parse_args)
|
344
344
|
{
|
345
|
-
ParseArgs *args = (ParseArgs*)parse_args;
|
345
|
+
ParseArgs *args = (ParseArgs *)parse_args;
|
346
346
|
GumboOutput *output = args->output;
|
347
347
|
xmlDocPtr doc;
|
348
348
|
if (output->document->v.document.has_doctype) {
|
@@ -552,7 +552,7 @@ error:
|
|
552
552
|
static VALUE
|
553
553
|
fragment_continue(VALUE parse_args)
|
554
554
|
{
|
555
|
-
ParseArgs *args = (ParseArgs*)parse_args;
|
555
|
+
ParseArgs *args = (ParseArgs *)parse_args;
|
556
556
|
GumboOutput *output = args->output;
|
557
557
|
VALUE doc_fragment = args->url_or_frag;
|
558
558
|
xmlDocPtr xml_doc = args->doc;
|
@@ -266,7 +266,7 @@ get_description(VALUE klass, VALUE tag_name)
|
|
266
266
|
);
|
267
267
|
|
268
268
|
if (NULL == description) { return Qnil; }
|
269
|
-
return Data_Wrap_Struct(klass, 0, 0, (void
|
269
|
+
return Data_Wrap_Struct(klass, 0, 0, DISCARD_CONST_QUAL(void *, description));
|
270
270
|
}
|
271
271
|
|
272
272
|
void
|
@@ -110,7 +110,8 @@ void
|
|
110
110
|
noko_init_html_sax_parser_context()
|
111
111
|
{
|
112
112
|
assert(cNokogiriXmlSaxParserContext);
|
113
|
-
cNokogiriHtml4SaxParserContext = rb_define_class_under(mNokogiriHtml4Sax, "ParserContext",
|
113
|
+
cNokogiriHtml4SaxParserContext = rb_define_class_under(mNokogiriHtml4Sax, "ParserContext",
|
114
|
+
cNokogiriXmlSaxParserContext);
|
114
115
|
|
115
116
|
rb_define_singleton_method(cNokogiriHtml4SaxParserContext, "memory", parse_memory, 2);
|
116
117
|
rb_define_singleton_method(cNokogiriHtml4SaxParserContext, "file", parse_file, 2);
|
@@ -209,6 +209,7 @@ typedef enum {
|
|
209
209
|
XML_ERR_VERSION_MISMATCH, /* 109 */
|
210
210
|
XML_ERR_NAME_TOO_LONG, /* 110 */
|
211
211
|
XML_ERR_USER_STOP, /* 111 */
|
212
|
+
XML_ERR_COMMENT_ABRUPTLY_ENDED, /* 112 */
|
212
213
|
XML_NS_ERR_XML_NAMESPACE = 200,
|
213
214
|
XML_NS_ERR_UNDEFINED_NAMESPACE, /* 201 */
|
214
215
|
XML_NS_ERR_QNAME, /* 202 */
|
@@ -133,7 +133,7 @@ extern "C" {
|
|
133
133
|
#ifndef WITH_MODULES
|
134
134
|
#define WITH_MODULES
|
135
135
|
#endif
|
136
|
-
#define LIBXSLT_DEFAULT_PLUGINS_PATH() "/home/flavorjones/code/oss/nokogiri/ports/
|
136
|
+
#define LIBXSLT_DEFAULT_PLUGINS_PATH() "/home/flavorjones/code/oss/nokogiri/ports/x64-mingw32/libxslt/1.1.34/lib/libxslt-plugins"
|
137
137
|
#endif
|
138
138
|
|
139
139
|
/**
|
data/ext/nokogiri/nokogiri.c
CHANGED
@@ -220,7 +220,7 @@ Init_nokogiri()
|
|
220
220
|
xmlInitParser();
|
221
221
|
exsltRegisterAll();
|
222
222
|
|
223
|
-
if (xsltExtModuleFunctionLookup((xmlChar*)"date-time", EXSLT_DATE_NAMESPACE)) {
|
223
|
+
if (xsltExtModuleFunctionLookup((const xmlChar *)"date-time", EXSLT_DATE_NAMESPACE)) {
|
224
224
|
rb_const_set(mNokogiri, rb_intern("LIBXSLT_DATETIME_ENABLED"), Qtrue);
|
225
225
|
} else {
|
226
226
|
rb_const_set(mNokogiri, rb_intern("LIBXSLT_DATETIME_ENABLED"), Qfalse);
|
data/ext/nokogiri/nokogiri.h
CHANGED
@@ -197,6 +197,9 @@ NOKOPUBFUN VALUE Nokogiri_wrap_xml_document(VALUE klass,
|
|
197
197
|
#define NOKOGIRI_SAX_TUPLE_NEW(_ctxt, _self) nokogiri_sax_tuple_new(_ctxt, _self)
|
198
198
|
#define NOKOGIRI_SAX_TUPLE_DESTROY(_tuple) free(_tuple)
|
199
199
|
|
200
|
+
#define DISCARD_CONST_QUAL(t, v) ((t)(uintptr_t)(v))
|
201
|
+
#define DISCARD_CONST_QUAL_XMLCHAR(v) DISCARD_CONST_QUAL(xmlChar *, v)
|
202
|
+
|
200
203
|
void Nokogiri_structured_error_func_save(libxmlStructuredErrorHandlerState *handler_state);
|
201
204
|
void Nokogiri_structured_error_func_save_and_set(libxmlStructuredErrorHandlerState *handler_state, void *user_data,
|
202
205
|
xmlStructuredErrorFunc handler);
|