nokogiri 1.12.5 → 1.13.8
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 +13 -64
- data/ext/nokogiri/extconf.rb +66 -44
- data/ext/nokogiri/gumbo.c +1 -1
- data/ext/nokogiri/html4_sax_parser_context.c +2 -3
- data/ext/nokogiri/nokogiri.h +8 -0
- data/ext/nokogiri/xml_attr.c +2 -2
- data/ext/nokogiri/xml_attribute_decl.c +3 -3
- data/ext/nokogiri/xml_cdata.c +1 -1
- data/ext/nokogiri/xml_document.c +36 -36
- data/ext/nokogiri/xml_document_fragment.c +0 -2
- data/ext/nokogiri/xml_dtd.c +10 -10
- data/ext/nokogiri/xml_element_decl.c +3 -3
- data/ext/nokogiri/xml_encoding_handler.c +25 -11
- data/ext/nokogiri/xml_entity_decl.c +5 -5
- data/ext/nokogiri/xml_node.c +707 -381
- data/ext/nokogiri/xml_node_set.c +4 -4
- data/ext/nokogiri/xml_reader.c +88 -11
- data/ext/nokogiri/xml_sax_parser_context.c +10 -3
- data/ext/nokogiri/xml_schema.c +3 -3
- data/ext/nokogiri/xml_text.c +1 -1
- data/ext/nokogiri/xml_xpath_context.c +73 -50
- data/ext/nokogiri/xslt_stylesheet.c +107 -9
- data/gumbo-parser/src/parser.c +0 -11
- data/lib/nokogiri/class_resolver.rb +67 -0
- data/lib/nokogiri/css/node.rb +9 -8
- data/lib/nokogiri/css/parser.rb +360 -341
- data/lib/nokogiri/css/parser.y +249 -244
- data/lib/nokogiri/css/parser_extras.rb +22 -20
- data/lib/nokogiri/css/syntax_error.rb +1 -0
- data/lib/nokogiri/css/tokenizer.rb +4 -3
- data/lib/nokogiri/css/tokenizer.rex +3 -2
- data/lib/nokogiri/css/xpath_visitor.rb +179 -82
- 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 +88 -77
- 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 +5 -2
- 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 +27 -10
- data/lib/nokogiri/html5/document_fragment.rb +5 -2
- data/lib/nokogiri/html5/node.rb +10 -3
- data/lib/nokogiri/html5.rb +69 -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 +20 -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 +34 -32
- data/lib/nokogiri/xml/cdata.rb +2 -1
- data/lib/nokogiri/xml/character_data.rb +1 -0
- data/lib/nokogiri/xml/document.rb +144 -103
- 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 +8 -4
- data/lib/nokogiri/xml/node.rb +521 -351
- data/lib/nokogiri/xml/node_set.rb +50 -54
- data/lib/nokogiri/xml/notation.rb +12 -0
- data/lib/nokogiri/xml/parse_options.rb +12 -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 +20 -24
- 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 +37 -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 +93 -62
- data/lib/nokogiri/xml/syntax_error.rb +5 -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 +4 -3
- data/lib/nokogiri/xslt/stylesheet.rb +1 -0
- data/lib/nokogiri/xslt.rb +21 -13
- data/lib/nokogiri.rb +19 -16
- data/lib/xsd/xmlparser/nokogiri.rb +25 -24
- data/patches/libxml2/0004-use-glibc-strlen.patch +3 -3
- data/patches/libxml2/0006-update-automake-files-for-arm64.patch +2443 -1914
- data/patches/libxml2/0008-htmlParseComment-handle-abruptly-closed-comments.patch +61 -0
- data/patches/libxml2/0009-allow-wildcard-namespaces.patch +77 -0
- data/patches/libxslt/0001-update-automake-files-for-arm64.patch +2445 -1919
- data/ports/archives/libxml2-2.9.14.tar.xz +0 -0
- data/ports/archives/libxslt-1.1.35.tar.xz +0 -0
- metadata +104 -32
- data/patches/libxml2/0007-Fix-XPath-recursion-limit.patch +0 -31
- data/patches/libxslt/0002-Fix-xml2-config-check-in-configure-script.patch +0 -19
- data/ports/archives/libxml2-2.9.12.tar.gz +0 -0
- data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57a1be1596b77f21f907091ed4f729cc99bd4807cc8a116fdb2c705ff7be634c
|
4
|
+
data.tar.gz: e885178e15ae558183b813476584f96c2723a5176e9bbc0d1afcdd94e7c5b02d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b46507c07b2eb1e1747ea33a450cf28ebe719966bc394a1a0a25d348b189168cd8c4c75dbe0405dd1f40d386096468119492b96ddd6322a2ce02228a7e62ceb
|
7
|
+
data.tar.gz: ea9338bde47956061977946250aa4d687cc1e526b99ced6f4413d1a57442390e133646cc0b8c9b7c9f169ecb96695873e4221b07803230dab1fe68420f6650eb
|
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
@@ -1,74 +1,23 @@
|
|
1
1
|
libxml2:
|
2
|
-
version: "2.9.
|
3
|
-
sha256: "
|
4
|
-
#
|
5
|
-
#
|
6
|
-
# $ gpg --verify libxml2-2.9.12.tar.gz.asc ports/archives/libxml2-2.9.12.tar.gz
|
7
|
-
# gpg: Signature made Thu 13 May 2021 02:59:16 PM EDT
|
8
|
-
# gpg: using RSA key DB46681BB91ADCEA170FA2D415588B26596BEA5D
|
9
|
-
# gpg: Good signature from "Daniel Veillard (Red Hat work email) <veillard@redhat.com>" [unknown]
|
10
|
-
# gpg: aka "Daniel Veillard <Daniel.Veillard@w3.org>" [unknown]
|
11
|
-
# gpg: WARNING: This key is not certified with a trusted signature!
|
12
|
-
# gpg: There is no indication that the signature belongs to the owner.
|
13
|
-
# Primary key fingerprint: C744 15BA 7C9C 7F78 F02E 1DC3 4606 B8A5 DE95 BC1F
|
14
|
-
# Subkey fingerprint: DB46 681B B91A DCEA 170F A2D4 1558 8B26 596B EA5D
|
15
|
-
#
|
16
|
-
# using this pgp signature:
|
17
|
-
#
|
18
|
-
# -----BEGIN PGP SIGNATURE-----
|
19
|
-
#
|
20
|
-
# iQEzBAABCAAdFiEE20ZoG7ka3OoXD6LUFViLJllr6l0FAmCddwQACgkQFViLJllr
|
21
|
-
# 6l11LQgAioRTdfmcC+uK/7+6HPtF/3c5zkX6j8VGYuvFBwZ0jayqMRBAl++fcpjE
|
22
|
-
# JUU/JKebSZ/KCYjzyeOWK/i3Gq77iqm3UbZFB85rqu4a5P3gmj/4STWVyAx0KU3z
|
23
|
-
# G3jKqDhJOt7c0acXb5lh2DngfDa1dn/VGcQcIXsqplNxNr4ET7MnSJjZ3nlxYfW2
|
24
|
-
# E5vWBdPCMUeXDBl6MjYvw9XnGGBLUAaEJWoFToG6jKmVf4GAd9nza20jj5dtbcJq
|
25
|
-
# QEOaSDKDr+f9h2NS8haOhJ9vOpy52PdeGzaFlbRkXarGXuAr8kITgATVs8FAqcgv
|
26
|
-
# MoVhmrO5r2hJf0dCM9fZoYqzpMfmNA==
|
27
|
-
# =KfJ9
|
28
|
-
# -----END PGP SIGNATURE-----
|
29
|
-
#
|
2
|
+
version: "2.9.14"
|
3
|
+
sha256: "60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee"
|
4
|
+
# sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.14.sha256sum
|
30
5
|
|
31
6
|
libxslt:
|
32
|
-
version: "1.1.
|
33
|
-
sha256: "
|
34
|
-
#
|
35
|
-
#
|
36
|
-
# $ gpg --verify ~/Downloads/libxslt-1.1.34.tar.gz.asc ports/archives/libxslt-1.1.34.tar.gz
|
37
|
-
# gpg: Signature made Wed 30 Oct 2019 04:02:48 PM EDT
|
38
|
-
# gpg: using RSA key DB46681BB91ADCEA170FA2D415588B26596BEA5D
|
39
|
-
# gpg: Good signature from "Daniel Veillard (Red Hat work email) <veillard@redhat.com>" [unknown]
|
40
|
-
# gpg: aka "Daniel Veillard <Daniel.Veillard@w3.org>" [unknown]
|
41
|
-
# gpg: WARNING: This key is not certified with a trusted signature!
|
42
|
-
# gpg: There is no indication that the signature belongs to the owner.
|
43
|
-
# Primary key fingerprint: C744 15BA 7C9C 7F78 F02E 1DC3 4606 B8A5 DE95 BC1F
|
44
|
-
# Subkey fingerprint: DB46 681B B91A DCEA 170F A2D4 1558 8B26 596B EA5D
|
45
|
-
#
|
46
|
-
# using this pgp signature:
|
47
|
-
#
|
48
|
-
# -----BEGIN PGP SIGNATURE-----
|
49
|
-
#
|
50
|
-
# iQEzBAABCAAdFiEE20ZoG7ka3OoXD6LUFViLJllr6l0FAl257GgACgkQFViLJllr
|
51
|
-
# 6l2vVggAjJEHmASiS56SxhPOsGqbfBihM66gQFoIymQfMu2430N1GSTkLsfbkJO8
|
52
|
-
# 8yBX11NjzK/m9uxwshMW3rVCU7EpL3PUimN3reXdPiQj9hAOAWF1V3BZNevbQC2E
|
53
|
-
# FCIraioukaidf8sjUG4/sGpK/gOcP/3hYoN0HUoBigCNJjDqhijxM3M3GJJtCASp
|
54
|
-
# jL4CQbs2OmxW8ixOZbuWEESvFFHUgYRsdZjRVN+GRfSOvJjxypurmYwQ3RjO7JxL
|
55
|
-
# 2FY8qKQ+xpeID8NV8F5OUEvWBjk1QS133VTqBZNlONdnEtV/og6jNu5k0O/Kvhup
|
56
|
-
# caR+8TMErOcLr9OgDklO6DoYyAsf9Q==
|
57
|
-
# =g4i4
|
58
|
-
# -----END PGP SIGNATURE-----
|
59
|
-
#
|
7
|
+
version: "1.1.35"
|
8
|
+
sha256: "8247f33e9a872c6ac859aa45018bc4c4d00b97e2feac9eebc10c93ce1f34dd79"
|
9
|
+
# sha-256 hash provided in https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.35.sha256sum
|
60
10
|
|
61
11
|
zlib:
|
62
|
-
version: "1.2.
|
63
|
-
sha256: "
|
12
|
+
version: "1.2.12"
|
13
|
+
sha256: "91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9"
|
64
14
|
# SHA-256 hash provided on http://zlib.net/
|
65
15
|
|
66
16
|
libiconv:
|
67
|
-
version: "1.
|
68
|
-
sha256: "
|
69
|
-
# gpg: Signature made Fri
|
17
|
+
version: "1.16"
|
18
|
+
sha256: "e6a1b1b589654277ee790cce3734f07876ac4ccfaecbee8afa0b649cf529cc04"
|
19
|
+
# gpg: Signature made Fri 26 Apr 2019 03:36:38 PM EDT
|
70
20
|
# 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.
|
21
|
+
# gpg: Good signature from "Bruno Haible (Open Source Development) <bruno@clisp.org>" [expired]
|
22
|
+
# gpg: Note: This key has expired!
|
74
23
|
# 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.8.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?
|
@@ -210,6 +211,18 @@ def local_have_library(lib, func = nil, headers = nil)
|
|
210
211
|
have_library(lib, func, headers) || have_library("lib#{lib}", func, headers)
|
211
212
|
end
|
212
213
|
|
214
|
+
def gnome_source
|
215
|
+
# As of 2022-02-20, some mirrors have expired SSL certificates. I'm able to retrieve from my home,
|
216
|
+
# but whatever host is resolved on the github actions workers see an expired cert.
|
217
|
+
#
|
218
|
+
# See https://github.com/sparklemotion/nokogiri/runs/5266206403?check_suite_focus=true
|
219
|
+
if ENV["NOKOGIRI_USE_CANONICAL_GNOME_SOURCE"]
|
220
|
+
"https://download.gnome.org"
|
221
|
+
else
|
222
|
+
"https://mirror.csclub.uwaterloo.ca/gnome" # old reliable
|
223
|
+
end
|
224
|
+
end
|
225
|
+
|
213
226
|
LOCAL_PACKAGE_RESPONSE = Object.new
|
214
227
|
def LOCAL_PACKAGE_RESPONSE.%(package)
|
215
228
|
package ? "yes: #{package}" : "no"
|
@@ -284,17 +297,16 @@ ensure
|
|
284
297
|
end
|
285
298
|
|
286
299
|
def abort_could_not_find_library(lib)
|
287
|
-
|
300
|
+
callers = caller(1..2).join("\n")
|
301
|
+
abort("-----\n#{callers}\n#{lib} is missing. Please locate mkmf.log to investigate how it is failing.\n-----")
|
288
302
|
end
|
289
303
|
|
290
|
-
def chdir_for_build
|
304
|
+
def chdir_for_build(&block)
|
291
305
|
# When using rake-compiler-dock on Windows, the underlying Virtualbox shared
|
292
306
|
# folders don't support symlinks, but libiconv expects it for a build on
|
293
307
|
# 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
|
308
|
+
build_dir = /mingw|mswin|cygwin/.match?(ENV["RCD_HOST_RUBY_PLATFORM"].to_s) ? "/tmp" : "."
|
309
|
+
Dir.chdir(build_dir, &block)
|
298
310
|
end
|
299
311
|
|
300
312
|
def sh_export_path(path)
|
@@ -370,6 +382,7 @@ def iconv_configure_flags
|
|
370
382
|
["iconv", "opt"].each do |target|
|
371
383
|
config = preserving_globals { dir_config(target) }
|
372
384
|
next unless config.any? && try_link_iconv("--with-#{target}-* flags") { dir_config(target) }
|
385
|
+
|
373
386
|
idirs, ldirs = config.map do |dirs|
|
374
387
|
Array(dirs).flat_map do |dir|
|
375
388
|
dir.split(File::PATH_SEPARATOR)
|
@@ -402,9 +415,9 @@ def iconv_configure_flags
|
|
402
415
|
abort_could_not_find_library("libiconv")
|
403
416
|
end
|
404
417
|
|
405
|
-
def process_recipe(name, version, static_p, cross_p, cacheable_p=true)
|
418
|
+
def process_recipe(name, version, static_p, cross_p, cacheable_p = true)
|
406
419
|
require "rubygems"
|
407
|
-
gem("mini_portile2", REQUIRED_MINI_PORTILE_VERSION)
|
420
|
+
gem("mini_portile2", REQUIRED_MINI_PORTILE_VERSION) # gemspec is not respected at install time
|
408
421
|
require "mini_portile2"
|
409
422
|
message("Using mini_portile version #{MiniPortile::VERSION}\n")
|
410
423
|
|
@@ -413,9 +426,13 @@ def process_recipe(name, version, static_p, cross_p, cacheable_p=true)
|
|
413
426
|
end
|
414
427
|
|
415
428
|
MiniPortile.new(name, version).tap do |recipe|
|
429
|
+
def recipe.port_path
|
430
|
+
"#{@target}/#{RUBY_PLATFORM}/#{@name}/#{@version}"
|
431
|
+
end
|
432
|
+
|
416
433
|
recipe.target = File.join(PACKAGE_ROOT_DIR, "ports") if cacheable_p
|
417
|
-
# Prefer host_alias over host in order to use
|
418
|
-
#
|
434
|
+
# Prefer host_alias over host in order to use the correct compiler prefix for cross build, but
|
435
|
+
# use host if not set.
|
419
436
|
recipe.host = RbConfig::CONFIG["host_alias"].empty? ? RbConfig::CONFIG["host"] : RbConfig::CONFIG["host_alias"]
|
420
437
|
recipe.configure_options << "--libdir=#{File.join(recipe.path, "lib")}"
|
421
438
|
|
@@ -462,7 +479,7 @@ def process_recipe(name, version, static_p, cross_p, cacheable_p=true)
|
|
462
479
|
end
|
463
480
|
|
464
481
|
if RbConfig::CONFIG["target_cpu"] == "universal"
|
465
|
-
|
482
|
+
["CFLAGS", "LDFLAGS"].each do |key|
|
466
483
|
unless env[key].include?("-arch")
|
467
484
|
env[key] = concat_flags(env[key], RbConfig::CONFIG["ARCH_FLAG"])
|
468
485
|
end
|
@@ -473,7 +490,7 @@ def process_recipe(name, version, static_p, cross_p, cacheable_p=true)
|
|
473
490
|
"#{key}=#{value.strip}"
|
474
491
|
end
|
475
492
|
|
476
|
-
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{
|
493
|
+
checkpoint = "#{recipe.target}/#{recipe.name}-#{recipe.version}-#{RUBY_PLATFORM}.installed"
|
477
494
|
if File.exist?(checkpoint) && !recipe.source_directory
|
478
495
|
message("Building Nokogiri with a packaged version of #{name}-#{version}.\n")
|
479
496
|
else
|
@@ -487,7 +504,7 @@ def process_recipe(name, version, static_p, cross_p, cacheable_p=true)
|
|
487
504
|
message("The following patches are being applied:\n")
|
488
505
|
|
489
506
|
recipe.patch_files.each do |patch|
|
490
|
-
message(" - %s\n"
|
507
|
+
message(format(" - %s\n", File.basename(patch)))
|
491
508
|
end
|
492
509
|
end
|
493
510
|
|
@@ -508,6 +525,7 @@ def process_recipe(name, version, static_p, cross_p, cacheable_p=true)
|
|
508
525
|
|
509
526
|
EOM
|
510
527
|
|
528
|
+
pp(recipe.files)
|
511
529
|
chdir_for_build { recipe.cook }
|
512
530
|
FileUtils.touch(checkpoint)
|
513
531
|
end
|
@@ -656,7 +674,7 @@ else
|
|
656
674
|
if cross_build_p || windows?
|
657
675
|
zlib_recipe = process_recipe("zlib", dependencies["zlib"]["version"], static_p, cross_build_p) do |recipe|
|
658
676
|
recipe.files = [{
|
659
|
-
url: "
|
677
|
+
url: "https://zlib.net/fossils/#{recipe.name}-#{recipe.version}.tar.gz",
|
660
678
|
sha256: dependencies["zlib"]["sha256"],
|
661
679
|
}]
|
662
680
|
if windows?
|
@@ -698,14 +716,6 @@ else
|
|
698
716
|
execute("configure",
|
699
717
|
["env", "CHOST=#{host}", "CFLAGS=#{cflags}", "./configure", "--static", configure_prefix])
|
700
718
|
end
|
701
|
-
|
702
|
-
def compile
|
703
|
-
if host =~ /darwin/
|
704
|
-
execute("compile", "make AR=#{host}-libtool")
|
705
|
-
else
|
706
|
-
super
|
707
|
-
end
|
708
|
-
end
|
709
719
|
end
|
710
720
|
end
|
711
721
|
end
|
@@ -714,10 +724,13 @@ else
|
|
714
724
|
libiconv_recipe = process_recipe("libiconv", dependencies["libiconv"]["version"], static_p,
|
715
725
|
cross_build_p) do |recipe|
|
716
726
|
recipe.files = [{
|
717
|
-
url: "
|
727
|
+
url: "https://ftp.gnu.org/pub/gnu/libiconv/#{recipe.name}-#{recipe.version}.tar.gz",
|
718
728
|
sha256: dependencies["libiconv"]["sha256"],
|
719
729
|
}]
|
720
730
|
|
731
|
+
# The libiconv configure script doesn't accept "arm64" host string but "aarch64"
|
732
|
+
recipe.host = recipe.host.gsub("arm64-apple-darwin", "aarch64-apple-darwin")
|
733
|
+
|
721
734
|
cflags = concat_flags(ENV["CFLAGS"], "-O2", "-U_FORTIFY_SOURCE", "-g")
|
722
735
|
|
723
736
|
recipe.configure_options += [
|
@@ -741,12 +754,21 @@ else
|
|
741
754
|
Tools" to open the developer site, download the installer for your OS
|
742
755
|
version and run it.
|
743
756
|
-----
|
744
|
-
|
757
|
+
EOM
|
745
758
|
end
|
746
759
|
|
747
|
-
|
748
|
-
|
749
|
-
|
760
|
+
if zlib_recipe
|
761
|
+
append_cppflags("-I#{zlib_recipe.path}/include")
|
762
|
+
$LIBPATH = ["#{zlib_recipe.path}/lib"] | $LIBPATH
|
763
|
+
ensure_package_configuration(opt: "zlib", pc: "zlib", lib: "z",
|
764
|
+
headers: "zlib.h", func: "gzdopen")
|
765
|
+
end
|
766
|
+
|
767
|
+
if libiconv_recipe
|
768
|
+
append_cppflags("-I#{libiconv_recipe.path}/include")
|
769
|
+
$LIBPATH = ["#{libiconv_recipe.path}/lib"] | $LIBPATH
|
770
|
+
ensure_package_configuration(opt: "iconv", pc: "iconv", lib: "iconv",
|
771
|
+
headers: "iconv.h", func: "iconv_open")
|
750
772
|
end
|
751
773
|
|
752
774
|
libxml2_recipe = process_recipe("libxml2", dependencies["libxml2"]["version"], static_p, cross_build_p) do |recipe|
|
@@ -754,8 +776,9 @@ else
|
|
754
776
|
if source_dir
|
755
777
|
recipe.source_directory = source_dir
|
756
778
|
else
|
779
|
+
minor_version = Gem::Version.new(recipe.version).segments.take(2).join(".")
|
757
780
|
recipe.files = [{
|
758
|
-
url: "
|
781
|
+
url: "#{gnome_source}/sources/libxml2/#{minor_version}/#{recipe.name}-#{recipe.version}.tar.xz",
|
759
782
|
sha256: dependencies["libxml2"]["sha256"],
|
760
783
|
}]
|
761
784
|
recipe.patch_files = Dir[File.join(PACKAGE_ROOT_DIR, "patches", "libxml2", "*.patch")].sort
|
@@ -765,7 +788,6 @@ else
|
|
765
788
|
|
766
789
|
if zlib_recipe
|
767
790
|
recipe.configure_options << "--with-zlib=#{zlib_recipe.path}"
|
768
|
-
cflags = concat_flags(cflags, "-I#{zlib_recipe.path}/include")
|
769
791
|
end
|
770
792
|
|
771
793
|
if libiconv_recipe
|
@@ -803,8 +825,9 @@ else
|
|
803
825
|
if source_dir
|
804
826
|
recipe.source_directory = source_dir
|
805
827
|
else
|
828
|
+
minor_version = Gem::Version.new(recipe.version).segments.take(2).join(".")
|
806
829
|
recipe.files = [{
|
807
|
-
url: "
|
830
|
+
url: "#{gnome_source}/sources/libxslt/#{minor_version}/#{recipe.name}-#{recipe.version}.tar.xz",
|
808
831
|
sha256: dependencies["libxslt"]["sha256"],
|
809
832
|
}]
|
810
833
|
recipe.patch_files = Dir[File.join(PACKAGE_ROOT_DIR, "patches", "libxslt", "*.patch")].sort
|
@@ -834,9 +857,6 @@ else
|
|
834
857
|
append_cppflags("-DNOKOGIRI_PACKAGED_LIBRARIES")
|
835
858
|
append_cppflags("-DNOKOGIRI_PRECOMPILED_LIBRARIES") if cross_build_p
|
836
859
|
|
837
|
-
$LIBPATH = ["#{zlib_recipe.path}/lib"] | $LIBPATH if zlib_recipe
|
838
|
-
$LIBPATH = ["#{libiconv_recipe.path}/lib"] | $LIBPATH if libiconv_recipe
|
839
|
-
|
840
860
|
$libs = $libs.shellsplit.tap do |libs|
|
841
861
|
[libxml2_recipe, libxslt_recipe].each do |recipe|
|
842
862
|
libname = recipe.name[/\Alib(.+)\z/, 1]
|
@@ -929,7 +949,7 @@ libgumbo_recipe = process_recipe("libgumbo", "1.0.0-nokogiri", static_p, cross_b
|
|
929
949
|
|
930
950
|
env = { "CC" => gcc_cmd, "CFLAGS" => cflags }
|
931
951
|
if config_cross_build?
|
932
|
-
if
|
952
|
+
if /darwin/.match?(host)
|
933
953
|
env["AR"] = "#{host}-libtool"
|
934
954
|
env["ARFLAGS"] = "-o"
|
935
955
|
else
|
@@ -953,6 +973,8 @@ have_func("xmlRelaxNGSetParserStructuredErrors") # introduced in libxml 2.6.24
|
|
953
973
|
have_func("xmlRelaxNGSetValidStructuredErrors") # introduced in libxml 2.6.21
|
954
974
|
have_func("xmlSchemaSetValidStructuredErrors") # introduced in libxml 2.6.23
|
955
975
|
have_func("xmlSchemaSetParserStructuredErrors") # introduced in libxml 2.6.23
|
976
|
+
have_func("rb_gc_location") # introduced in Ruby 2.7
|
977
|
+
have_func("rb_category_warning") # introduced in Ruby 3.0
|
956
978
|
|
957
979
|
have_func("vasprintf")
|
958
980
|
|
data/ext/nokogiri/gumbo.c
CHANGED
@@ -19,9 +19,8 @@ parse_memory(VALUE klass, VALUE data, VALUE encoding)
|
|
19
19
|
{
|
20
20
|
htmlParserCtxtPtr ctxt;
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
}
|
22
|
+
Check_Type(data, T_STRING);
|
23
|
+
|
25
24
|
if (!(int)RSTRING_LEN(data)) {
|
26
25
|
rb_raise(rb_eRuntimeError, "data cannot be empty");
|
27
26
|
}
|
data/ext/nokogiri/nokogiri.h
CHANGED
@@ -170,6 +170,8 @@ int noko_io_read(void *ctx, char *buffer, int len);
|
|
170
170
|
int noko_io_write(void *ctx, char *buffer, int len);
|
171
171
|
int noko_io_close(void *ctx);
|
172
172
|
|
173
|
+
#define Noko_Node_Get_Struct(obj,type,sval) ((sval) = (type*)DATA_PTR(obj))
|
174
|
+
|
173
175
|
VALUE noko_xml_node_wrap(VALUE klass, xmlNodePtr node) ;
|
174
176
|
VALUE noko_xml_node_wrap_node_set_result(xmlNodePtr node, VALUE node_set) ;
|
175
177
|
VALUE noko_xml_node_attrs(xmlNodePtr node) ;
|
@@ -200,6 +202,12 @@ NOKOPUBFUN VALUE Nokogiri_wrap_xml_document(VALUE klass,
|
|
200
202
|
#define DISCARD_CONST_QUAL(t, v) ((t)(uintptr_t)(v))
|
201
203
|
#define DISCARD_CONST_QUAL_XMLCHAR(v) DISCARD_CONST_QUAL(xmlChar *, v)
|
202
204
|
|
205
|
+
#if HAVE_RB_CATEGORY_WARNING
|
206
|
+
# define NOKO_WARN_DEPRECATION(message) rb_category_warning(RB_WARN_CATEGORY_DEPRECATED, message)
|
207
|
+
#else
|
208
|
+
# define NOKO_WARN_DEPRECATION(message) rb_warning(message)
|
209
|
+
#endif
|
210
|
+
|
203
211
|
void Nokogiri_structured_error_func_save(libxmlStructuredErrorHandlerState *handler_state);
|
204
212
|
void Nokogiri_structured_error_func_save_and_set(libxmlStructuredErrorHandlerState *handler_state, void *user_data,
|
205
213
|
xmlStructuredErrorFunc handler);
|