nokogiri 1.12.5 → 1.14.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.

Files changed (156) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +41 -0
  3. data/LICENSE-DEPENDENCIES.md +830 -509
  4. data/LICENSE.md +1 -1
  5. data/README.md +23 -14
  6. data/bin/nokogiri +63 -50
  7. data/dependencies.yml +33 -66
  8. data/ext/nokogiri/extconf.rb +159 -63
  9. data/ext/nokogiri/gumbo.c +21 -11
  10. data/ext/nokogiri/html4_document.c +2 -2
  11. data/ext/nokogiri/html4_element_description.c +1 -1
  12. data/ext/nokogiri/html4_entity_lookup.c +2 -2
  13. data/ext/nokogiri/html4_sax_parser_context.c +3 -9
  14. data/ext/nokogiri/html4_sax_push_parser.c +1 -1
  15. data/ext/nokogiri/nokogiri.c +38 -51
  16. data/ext/nokogiri/nokogiri.h +26 -14
  17. data/ext/nokogiri/test_global_handlers.c +1 -1
  18. data/ext/nokogiri/xml_attr.c +3 -3
  19. data/ext/nokogiri/xml_attribute_decl.c +5 -5
  20. data/ext/nokogiri/xml_cdata.c +3 -3
  21. data/ext/nokogiri/xml_comment.c +1 -1
  22. data/ext/nokogiri/xml_document.c +53 -44
  23. data/ext/nokogiri/xml_document_fragment.c +1 -3
  24. data/ext/nokogiri/xml_dtd.c +11 -11
  25. data/ext/nokogiri/xml_element_content.c +3 -3
  26. data/ext/nokogiri/xml_element_decl.c +5 -5
  27. data/ext/nokogiri/xml_encoding_handler.c +28 -14
  28. data/ext/nokogiri/xml_entity_decl.c +6 -6
  29. data/ext/nokogiri/xml_entity_reference.c +1 -1
  30. data/ext/nokogiri/xml_namespace.c +80 -14
  31. data/ext/nokogiri/xml_node.c +982 -396
  32. data/ext/nokogiri/xml_node_set.c +4 -6
  33. data/ext/nokogiri/xml_processing_instruction.c +1 -1
  34. data/ext/nokogiri/xml_reader.c +133 -32
  35. data/ext/nokogiri/xml_relax_ng.c +1 -3
  36. data/ext/nokogiri/xml_sax_parser.c +23 -17
  37. data/ext/nokogiri/xml_sax_parser_context.c +11 -9
  38. data/ext/nokogiri/xml_sax_push_parser.c +1 -3
  39. data/ext/nokogiri/xml_schema.c +4 -6
  40. data/ext/nokogiri/xml_syntax_error.c +1 -1
  41. data/ext/nokogiri/xml_text.c +2 -2
  42. data/ext/nokogiri/xml_xpath_context.c +144 -114
  43. data/ext/nokogiri/xslt_stylesheet.c +122 -23
  44. data/gumbo-parser/Makefile +10 -0
  45. data/gumbo-parser/src/attribute.h +1 -1
  46. data/gumbo-parser/src/error.c +2 -2
  47. data/gumbo-parser/src/error.h +1 -1
  48. data/gumbo-parser/src/foreign_attrs.c +2 -2
  49. data/gumbo-parser/src/{gumbo.h → nokogiri_gumbo.h} +1 -0
  50. data/gumbo-parser/src/parser.c +8 -16
  51. data/gumbo-parser/src/replacement.h +1 -1
  52. data/gumbo-parser/src/string_buffer.h +1 -1
  53. data/gumbo-parser/src/string_piece.c +1 -1
  54. data/gumbo-parser/src/svg_attrs.c +2 -2
  55. data/gumbo-parser/src/svg_tags.c +2 -2
  56. data/gumbo-parser/src/tag.c +2 -1
  57. data/gumbo-parser/src/tag_lookup.c +7 -7
  58. data/gumbo-parser/src/tag_lookup.gperf +1 -0
  59. data/gumbo-parser/src/tag_lookup.h +1 -1
  60. data/gumbo-parser/src/token_buffer.h +1 -1
  61. data/gumbo-parser/src/tokenizer.c +1 -1
  62. data/gumbo-parser/src/tokenizer.h +1 -1
  63. data/gumbo-parser/src/utf8.c +1 -1
  64. data/gumbo-parser/src/utf8.h +1 -1
  65. data/gumbo-parser/src/util.c +1 -3
  66. data/gumbo-parser/src/util.h +4 -0
  67. data/gumbo-parser/src/vector.h +1 -1
  68. data/lib/nokogiri/class_resolver.rb +67 -0
  69. data/lib/nokogiri/css/node.rb +9 -8
  70. data/lib/nokogiri/css/parser.rb +360 -341
  71. data/lib/nokogiri/css/parser.y +249 -244
  72. data/lib/nokogiri/css/parser_extras.rb +22 -20
  73. data/lib/nokogiri/css/syntax_error.rb +1 -0
  74. data/lib/nokogiri/css/tokenizer.rb +4 -3
  75. data/lib/nokogiri/css/tokenizer.rex +3 -2
  76. data/lib/nokogiri/css/xpath_visitor.rb +184 -85
  77. data/lib/nokogiri/css.rb +44 -6
  78. data/lib/nokogiri/decorators/slop.rb +8 -7
  79. data/lib/nokogiri/encoding_handler.rb +57 -0
  80. data/lib/nokogiri/extension.rb +4 -3
  81. data/lib/nokogiri/gumbo.rb +1 -0
  82. data/lib/nokogiri/html.rb +16 -10
  83. data/lib/nokogiri/html4/builder.rb +1 -0
  84. data/lib/nokogiri/html4/document.rb +56 -164
  85. data/lib/nokogiri/html4/document_fragment.rb +11 -7
  86. data/lib/nokogiri/html4/element_description.rb +1 -0
  87. data/lib/nokogiri/html4/element_description_defaults.rb +432 -532
  88. data/lib/nokogiri/html4/encoding_reader.rb +121 -0
  89. data/lib/nokogiri/html4/entity_lookup.rb +2 -1
  90. data/lib/nokogiri/html4/sax/parser.rb +5 -2
  91. data/lib/nokogiri/html4/sax/parser_context.rb +1 -0
  92. data/lib/nokogiri/html4/sax/push_parser.rb +7 -7
  93. data/lib/nokogiri/html4.rb +12 -5
  94. data/lib/nokogiri/html5/document.rb +126 -32
  95. data/lib/nokogiri/html5/document_fragment.rb +14 -4
  96. data/lib/nokogiri/html5/node.rb +12 -7
  97. data/lib/nokogiri/html5.rb +138 -222
  98. data/lib/nokogiri/jruby/dependencies.rb +2 -19
  99. data/lib/nokogiri/jruby/nokogiri_jars.rb +43 -0
  100. data/lib/nokogiri/syntax_error.rb +1 -0
  101. data/lib/nokogiri/version/constant.rb +2 -1
  102. data/lib/nokogiri/version/info.rb +32 -24
  103. data/lib/nokogiri/version.rb +1 -0
  104. data/lib/nokogiri/xml/attr.rb +54 -3
  105. data/lib/nokogiri/xml/attribute_decl.rb +2 -1
  106. data/lib/nokogiri/xml/builder.rb +35 -33
  107. data/lib/nokogiri/xml/cdata.rb +2 -1
  108. data/lib/nokogiri/xml/character_data.rb +1 -0
  109. data/lib/nokogiri/xml/document.rb +232 -143
  110. data/lib/nokogiri/xml/document_fragment.rb +88 -42
  111. data/lib/nokogiri/xml/dtd.rb +3 -2
  112. data/lib/nokogiri/xml/element_content.rb +1 -0
  113. data/lib/nokogiri/xml/element_decl.rb +2 -1
  114. data/lib/nokogiri/xml/entity_decl.rb +3 -2
  115. data/lib/nokogiri/xml/entity_reference.rb +1 -0
  116. data/lib/nokogiri/xml/namespace.rb +44 -0
  117. data/lib/nokogiri/xml/node/save_options.rb +14 -8
  118. data/lib/nokogiri/xml/node.rb +708 -383
  119. data/lib/nokogiri/xml/node_set.rb +134 -59
  120. data/lib/nokogiri/xml/notation.rb +12 -0
  121. data/lib/nokogiri/xml/parse_options.rb +140 -56
  122. data/lib/nokogiri/xml/pp/character_data.rb +8 -6
  123. data/lib/nokogiri/xml/pp/node.rb +26 -26
  124. data/lib/nokogiri/xml/pp.rb +1 -0
  125. data/lib/nokogiri/xml/processing_instruction.rb +3 -1
  126. data/lib/nokogiri/xml/reader.rb +20 -24
  127. data/lib/nokogiri/xml/relax_ng.rb +1 -0
  128. data/lib/nokogiri/xml/sax/document.rb +20 -19
  129. data/lib/nokogiri/xml/sax/parser.rb +38 -36
  130. data/lib/nokogiri/xml/sax/parser_context.rb +7 -3
  131. data/lib/nokogiri/xml/sax/push_parser.rb +5 -5
  132. data/lib/nokogiri/xml/sax.rb +1 -0
  133. data/lib/nokogiri/xml/schema.rb +7 -6
  134. data/lib/nokogiri/xml/searchable.rb +93 -62
  135. data/lib/nokogiri/xml/syntax_error.rb +5 -4
  136. data/lib/nokogiri/xml/text.rb +1 -0
  137. data/lib/nokogiri/xml/xpath/syntax_error.rb +2 -1
  138. data/lib/nokogiri/xml/xpath.rb +12 -0
  139. data/lib/nokogiri/xml/xpath_context.rb +2 -3
  140. data/lib/nokogiri/xml.rb +4 -3
  141. data/lib/nokogiri/xslt/stylesheet.rb +1 -0
  142. data/lib/nokogiri/xslt.rb +21 -13
  143. data/lib/nokogiri.rb +22 -27
  144. data/lib/xsd/xmlparser/nokogiri.rb +28 -25
  145. data/patches/libxml2/0009-allow-wildcard-namespaces.patch +77 -0
  146. data/patches/libxslt/0001-update-automake-files-for-arm64.patch +2445 -1919
  147. data/ports/archives/libxml2-2.10.4.tar.xz +0 -0
  148. data/ports/archives/libxslt-1.1.37.tar.xz +0 -0
  149. metadata +20 -171
  150. data/patches/libxml2/0004-use-glibc-strlen.patch +0 -53
  151. data/patches/libxml2/0005-avoid-isnan-isinf.patch +0 -81
  152. data/patches/libxml2/0006-update-automake-files-for-arm64.patch +0 -2511
  153. data/patches/libxml2/0007-Fix-XPath-recursion-limit.patch +0 -31
  154. data/patches/libxslt/0002-Fix-xml2-config-check-in-configure-script.patch +0 -19
  155. data/ports/archives/libxml2-2.9.12.tar.gz +0 -0
  156. data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License
2
2
 
3
- Copyright 2008 -- 2021 by Mike Dalessio, Aaron Patterson, Yoko Harada, Akinori MUSHA, John Shahid, Karol Bucek, Sam Ruby, Craig Barnes, Stephen Checkoway, Lars Kanis, Sergio Arbeo, Timothy Elliott, Nobuyoshi Nakada, Charles Nutter, Patrick Mahoney.
3
+ Copyright 2008 -- 2023 by Mike Dalessio, Aaron Patterson, Yoko Harada, Akinori MUSHA, John Shahid, Karol Bucek, Sam Ruby, Craig Barnes, Stephen Checkoway, Lars Kanis, Sergio Arbeo, Timothy Elliott, Nobuyoshi Nakada, Charles Nutter, Patrick Mahoney.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
6
 
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 (C) and xerces (Java).
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, libgumbo, and xerces.
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://api.dependabot.com/badges/compatibility_score?dependency-name=nokogiri&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score/?dependency-name=nokogiri&package-manager=bundler)
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
 
@@ -38,10 +40,6 @@ Some guiding principles Nokogiri tries to follow:
38
40
 
39
41
  All official documentation is posted at https://nokogiri.org (the source for which is at https://github.com/sparklemotion/nokogiri.org/, and we welcome contributions).
40
42
 
41
- Consider subscribing to [Tidelift][tidelift] which provides license assurances and timely security notifications for your open source dependencies, including Nokogiri. [Tidelift][tidelift] subscriptions also help the Nokogiri maintainers fund our [automated testing](https://ci.nokogiri.org) which in turn allows us to ship releases, bugfixes, and security updates more often.
42
-
43
- [tidelift]: https://tidelift.com/subscription/pkg/rubygems-nokogiri?utm_source=rubygems-nokogiri&utm_medium=referral&utm_campaign=readme
44
-
45
43
  ### Reading
46
44
 
47
45
  Your first stops for learning more about Nokogiri should be:
@@ -55,7 +53,6 @@ Your first stops for learning more about Nokogiri should be:
55
53
 
56
54
  There are a few ways to ask exploratory questions:
57
55
 
58
- - The Ruby Discord chat server is active at https://discord.gg/UyQnKrT
59
56
  - The Nokogiri mailing list is active at https://groups.google.com/group/nokogiri-talk
60
57
  - Open an issue using the "Help Request" template at https://github.com/sparklemotion/nokogiri/issues
61
58
 
@@ -78,7 +75,7 @@ Full information and description of our security policy is in [`SECURITY.md`](SE
78
75
 
79
76
  ### Semantic Versioning Policy
80
77
 
81
- Nokogiri follows [Semantic Versioning](https://semver.org/) (since 2017 or so). [![Dependabot's SemVer compatibility score for Nokogiri](https://api.dependabot.com/badges/compatibility_score?dependency-name=nokogiri&package-manager=bundler&version-scheme=semver)](https://dependabot.com/compatibility-score/?dependency-name=nokogiri&package-manager=bundler)
78
+ 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
79
 
83
80
  We bump `Major.Minor.Patch` versions following this guidance:
84
81
 
@@ -101,12 +98,21 @@ We bump `Major.Minor.Patch` versions following this guidance:
101
98
  - Updating packaged libraries for security-related reasons.
102
99
 
103
100
 
101
+ ### Sponsorship
102
+
103
+ You can help sponsor the maintainers of this software through one of these organizations:
104
+
105
+ - [github.com/sponsors/flavorjones](https://github.com/sponsors/flavorjones)
106
+ - [opencollective.com/nokogiri](https://opencollective.com/nokogiri)
107
+ - [tidelift.com/subscription/pkg/rubygems-nokogiri](https://tidelift.com/subscription/pkg/rubygems-nokogiri?utm_source=rubygems-nokogiri&utm_medium=referral&utm_campaign=readme)
108
+
109
+
104
110
  ## Installation
105
111
 
106
112
  Requirements:
107
113
 
108
- - Ruby >= 2.5
109
- - JRuby >= 9.2.0.0
114
+ - Ruby >= 2.7
115
+ - JRuby >= 9.4.0.0
110
116
 
111
117
 
112
118
  ### Native Gems: Faster, more reliable installation
@@ -115,12 +121,15 @@ Requirements:
115
121
 
116
122
  ### Supported Platforms
117
123
 
118
- As of v1.11.0, Nokogiri ships pre-compiled, "native" gems for the following platforms:
124
+ Nokogiri ships pre-compiled, "native" gems for the following platforms:
119
125
 
120
- - Linux: `x86-linux` and `x86_64-linux` (req: `glibc >= 2.17`), including musl platforms like Alpine
126
+ - Linux:
127
+ - `x86-linux` and `x86_64-linux` (req: `glibc >= 2.17`)
128
+ - `aarch64-linux` and `arm-linux` (req: `glibc >= 2.29`)
129
+ - Note that musl platforms like Alpine **are** supported
121
130
  - Darwin/MacOS: `x86_64-darwin` and `arm64-darwin`
122
- - Windows: `x86-mingw32` and `x64-mingw32`
123
- - Java: any platform running JRuby 9.2 or higher
131
+ - Windows: `x86-mingw32`, `x64-mingw32`, and `x64-mingw-ucrt`
132
+ - Java: any platform running JRuby 9.4 or higher
124
133
 
125
134
  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
135
 
data/bin/nokogiri CHANGED
@@ -1,61 +1,77 @@
1
1
  #!/usr/bin/env ruby
2
- require 'optparse'
3
- require 'open-uri'
4
- require 'uri'
5
- require 'rubygems'
6
- require 'nokogiri'
7
- autoload :IRB, 'irb'
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::CLI
15
- class << self
16
- # Specify the console engine, defaulted to IRB.
17
- #
18
- # call-seq:
19
- # require 'pry'
20
- # Nokogiri::CLI.console = Pry
21
- attr_writer :console
22
-
23
- def console
24
- case @console
25
- when Symbol
26
- Kernel.const_get(@console)
27
- else
28
- @console
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
- attr_accessor :rcfile
38
+ self.rcfile = File.expand_path("~/.nokogirirc")
39
+ self.console = :IRB
33
40
  end
41
+ end
34
42
 
35
- self.rcfile = File.expand_path('~/.nokogirirc')
36
- self.console = :IRB
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 "Usage: nokogiri <uri|path> [options]"
42
- opts.separator ""
43
- opts.separator "Examples:"
44
- opts.separator " nokogiri https://www.ruby-lang.org/"
45
- opts.separator " nokogiri ./public/index.html"
46
- opts.separator " curl -s http://www.nokogiri.org | nokogiri -e'p $_.css(\"h1\").length'"
47
- opts.separator ""
48
- opts.separator "Options:"
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 = {:xml => Nokogiri::XML, :html => Nokogiri::HTML}[v]
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 || 'none'})") do |v|
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 = open(v) {|f| Nokogiri::XML::RelaxNG(f)}
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
- case uri = (URI(url) rescue url)
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
- @doc = parse_class.parse($stdin, nil, encoding)
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
- else
111
- if @script
112
- eval @script, binding, '<main>'
113
- else
114
- puts "Your document is stored in @doc..."
115
- Nokogiri::CLI.console.start
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,41 @@
1
1
  libxml2:
2
- version: "2.9.12"
3
- sha256: "c8d6681e38c56f172892c85ddc0852e1fd4b53b4209e7f4ebf17f7e2eae71d92"
4
- # manually verified checksum:
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.10.4"
3
+ sha256: "ed0c91c5845008f1936739e4eee2035531c1c94742c6541f44ee66d885948d45"
4
+ # sha-256 hash provided in https://download.gnome.org/sources/libxml2/2.10/libxml2-2.10.4.sha256sum
30
5
 
31
6
  libxslt:
32
- version: "1.1.34"
33
- sha256: "98b1bd46d6792925ad2dfe9a87452ea2adebf69dcb9919ffd55bf926a7f93f7f"
34
- # manually verified checksum:
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.37"
8
+ sha256: "3a4b27dc8027ccd6146725950336f1ec520928f320f144eb5fa7990ae6123ab4"
9
+ # sha-256 hash provided in https://download.gnome.org/sources/libxslt/1.1/libxslt-1.1.37.sha256sum
60
10
 
61
11
  zlib:
62
- version: "1.2.11"
63
- sha256: "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1"
12
+ version: "1.2.13"
13
+ sha256: "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30"
64
14
  # SHA-256 hash provided on http://zlib.net/
65
15
 
66
16
  libiconv:
67
- version: "1.15"
68
- sha256: "ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178"
69
- # gpg: Signature made Fri Feb 3 00:38:12 2017 CET
70
- # gpg: using RSA key 4F494A942E4616C2
71
- # gpg: Good signature from "Bruno Haible (Open Source Development) <bruno@clisp.org>" [unknown]
72
- # gpg: WARNING: This key is not certified with a trusted signature!
73
- # gpg: There is no indication that the signature belongs to the owner.
74
- # Primary key fingerprint: 68D9 4D8A AEEA D48A E7DC 5B90 4F49 4A94 2E46 16C2
17
+ version: "1.17"
18
+ sha256: "8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313"
19
+ # signature verified by following this path:
20
+ # - release announced at https://savannah.gnu.org/forum/forum.php?forum_id=10175
21
+ # - which links to https://savannah.gnu.org/users/haible as the releaser
22
+ # - which links to https://savannah.gnu.org/people/viewgpg.php?user_id=1871 as the gpg key
23
+ #
24
+ # So:
25
+ # - wget -q -O - https://savannah.gnu.org/people/viewgpg.php?user_id=1871 | gpg --import
26
+ # gpg: key F5BE8B267C6A406D: 1 signature not checked due to a missing key
27
+ # gpg: key F5BE8B267C6A406D: public key "Bruno Haible (Open Source Development) <bruno@clisp.org>" imported
28
+ # gpg: Total number processed: 1
29
+ # gpg: imported: 1
30
+ # gpg: marginals needed: 3 completes needed: 1 trust model: pgp
31
+ # gpg: depth: 0 valid: 4 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 4u
32
+ # gpg: next trustdb check due at 2024-05-09
33
+ # - gpg --verify libiconv-1.17.tar.gz.sig ports/archives/libiconv-1.17.tar.gz
34
+ # gpg: Signature made Sun 15 May 2022 11:26:42 AM EDT
35
+ # gpg: using RSA key 9001B85AF9E1B83DF1BDA942F5BE8B267C6A406D
36
+ # gpg: Good signature from "Bruno Haible (Open Source Development) <bruno@clisp.org>" [unknown]
37
+ # gpg: WARNING: This key is not certified with a trusted signature!
38
+ # gpg: There is no indication that the signature belongs to the owner.
39
+ # Primary key fingerprint: 9001 B85A F9E1 B83D F1BD A942 F5BE 8B26 7C6A 406D
40
+ #
41
+ # And this sha256sum is calculated from that verified tarball.