You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CHANGELOG.md
+66-11
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,14 @@ Nokogiri follows [Semantic Versioning](https://semver.org/), please see the [REA
4
4
5
5
---
6
6
7
-
## v1.next / unreleased
7
+
## v1.17.0 / 2024-12-08
8
8
9
9
### Dependencies
10
10
11
11
*[CRuby] Vendored libxml2 is updated to [v2.13.5](https://gitlab.gnome.org/GNOME/libxml2/-/releases/v2.13.5). @flavorjones
12
12
*[CRuby] Vendored libxslt is updated to [v1.1.42](https://gitlab.gnome.org/GNOME/libxslt/-/releases/v1.1.42). @flavorjones
13
13
*[CRuby] Minimum supported version of libxml2 raised to v2.9.2 (released 2014-10-16) from v2.6.21. [#3232, #3287]@flavorjones
14
-
*[JRuby] Minimum supported versino of Java raised to 8 (released 2014-03-18) from 7. [#3134]@flavorjones
14
+
*[JRuby] Minimum supported version of Java raised to 8 (released 2014-03-18) from 7. [#3134]@flavorjones
15
15
*[CRuby] Update to rake-compiler-dock v1.5.1 for building precompiled native gems. [#3216]@flavorjones
16
16
17
17
@@ -30,25 +30,36 @@ If your application relies on the SAX parsers, and in particular if you're SAX-p
30
30
31
31
Document fragment parsing has been improved, particularly with respect to handling malformed fragments or fragments with implicit namespace prefixes. Namespace reconciliation still isn't where we want it to be, but it's an improvement.
32
32
33
-
HTML5 fragment parsing now allows the context node to be specified as a keyword argument to the `HTML5::DocumentFragment.parse` and `.new` methods, which in particular should allow for more flexible sanitization and support for the [draft HTML Sanitizer API](https://wicg.github.io/sanitizer-api/) in downstream libraries.
33
+
HTML5 fragment parsing now allows the context node to be specified as a `context:`keyword argument to the `HTML5::DocumentFragment.parse` and `.new` methods, which should allow for more flexible sanitization and future support for the [draft HTML Sanitizer API](https://wicg.github.io/sanitizer-api/) in downstream libraries.
34
34
35
35
36
36
#### Error handling
37
37
38
-
In scenarios where multiple errors could be reported by the underlying parser, the errors will be aggregated into a single `Nokogiri::XML::SyntaxError` that is raised. Previously only the final error reported by libxml2 was raised which was often misleading if it was only a warning and not the fatal error.
38
+
In scenarios where multiple errors could be reported by the underlying parser, the errors will be aggregated into a single `Nokogiri::XML::SyntaxError` that is raised. Previously only the final error reported by libxml2 was raised (which was often misleading if it was only a warning and not the fatal error).
39
39
40
40
41
41
#### Schema validation
42
42
43
43
We've resolved many long-standing bugs in the various schema classes, validation methods, and their error reporting. Behavior is now consistent across schema types and input types, as well as parser backends (Xerces and libxml2).
44
44
45
45
46
+
#### Keyword arguments
47
+
48
+
The following methods now accept keyword arguments in addition to positional arguments, and use `...` parameter forwarding when possible:
Special thanks to those contributors who participated in the RubyConf 2024 Hack Day to work on #3323 to help modernize Nokogiri by adding keyword arguments and using parameter forwarding in many methods, and expanding some of the documentation! We intend to continue adding keyword argument support to more methods. #3323#3324#3326#3327#3329#3330#3332#3333#3334#3335#3336#3342#3355#3356@infews@matiasow@MattJones@mononoken@openbl@flavorjones
52
+
53
+
46
54
### Added
47
55
48
56
* Introduce support for a new SAX callback `XML::SAX::Document#reference`, which is called to report some parsed XML entities when `XML::SAX::ParserContext#replace_entities` is set to the default value `false`. This is necessary functionality for some applications that were previously relying on incorrect entity error reporting which has been fixed (see below). For more information, read the docs for `Nokogiri::XML::SAX::Document`. [#1926]@flavorjones
49
57
*`XML::SAX::Parser#parse_memory` and `#parse_file` now accept an optional `encoding` argument. When not provided, the parser will fall back to the encoding passed to the initializer, and then fall back to autodetection. [#3288]@flavorjones
50
58
*`XML::SAX::ParserContext.memory` now accepts an optional `encoding` argument. When not provided, the encoding will be autodetected. [#3288]@flavorjones
51
-
* New attributes `XML::DocumentFragment#parse_options` and `HTML4::DocumentFragment#parse_options` contain the options used to parse the document fragment. @flavorjones
59
+
* New readonly attributes `XML::DocumentFragment#parse_options` and `HTML4::DocumentFragment#parse_options` return the options used to parse the document fragment. @flavorjones
60
+
* New method `XML::Reader.new` is the primary constructor to which `XML::Reader()` forwards. Both methods now take `url:`, `encoding:`, and `options:` kwargs in addition to the previous calling convention of passing positional parameters. #3326@infews@flavorjones
61
+
*[CRuby] The HTML5 parse methods accept a `:parse_noscript_content_as_text` keyword argument which will emulate the parsing behavior of a browser which has scripting enabled. [#3178, #3231]@stevecheckoway
62
+
*[CRuby]`HTML5::DocumentFragment.parse` and `.new` accept a `:context` keyword argument that is the parse context node or element name. Previously this could only be passed in as a positional argument to `.new` and not at all to `.parse`. @flavorjones
52
63
*[CRuby]`Nokogiri::HTML5::Builder` is similar to `HTML4::Builder` but returns an `HTML5::Document`. [#3119]@flavorjones
53
64
*[CRuby] Attributes in an HTML5 document can be serialized individually, something that has always been supported by the HTML4 serializer. [#3125, #3127]@flavorjones
54
65
*[CRuby] Introduce a compile-time option, `--disable-xml2-legacy`, to remove from libxml2 its dependencies on `zlib` and `liblzma` and disable implicit `HTTP` network requests. These all remain enabled by default, and are present in the precompiled native gems. This option is a precursor for removing these libraries in a future major release, but may be interesting for the security-minded who do not need features like automatic decompression and would like to remove these dependencies. You can read more and give feedback on these plans in #3168. [#3247]@flavorjones
@@ -57,17 +68,16 @@ We've resolved many long-standing bugs in the various schema classes, validation
57
68
58
69
### Improved
59
70
71
+
* Documentation has been improved for `XML::RelaxNG`, `XML::Schema`, `XML::Reader`, `HTML5`, `HTML5::Document`, `HTML5::DocumentFragment`, `HTML4::Document`, `HTML4::DocumentFragment`, `XML`, `XML::Document`, `XML::DocumentFragment`. #3355@flavorjones
60
72
* Documentation has been improved for `CSS.xpath_for`. [#3224]@flavorjones
61
73
* Documentation for the SAX parsing classes has been greatly improved, including encoding overrides and the complex entity-handling behavior. [#3265]@flavorjones
62
74
*`XML::Schema#read_memory` and `XML::RelaxNG#read_memory` are now Ruby methods that call `#from_document`. Previously these were native functions, but they were buggy on both CRuby and JRuby (but worse on JRuby) and so this is now useful, comparable in performance, and simpler code that is easier to maintain. [#2113, #2115]@flavorjones
63
75
*`XML::SAX::ParserContext.io`'s `encoding` argument is now optional, and can now be an `Encoding` or an encoding name. When not provided will default to autodetecting the encoding. [#3288]@flavorjones
64
-
*[CRuby] When compiling packaged libraries from source, allow users' `AR` and `LD` environment variables to set the archiver and linker commands, respectively. This augments the existing `CC` environment variable to set the compiler command. [#3165]@ziggythehamster
65
-
*[CRuby] The HTML5 parse methods accept a `:parse_noscript_content_as_text` keyword argument which will emulate the parsing behavior of a browser which has scripting enabled. [#3178, #3231]@stevecheckoway
66
-
*[CRuby]`HTML5::DocumentFragment.parse` and `.new` accept a `:context` keyword argument that is the parse context node or element name. Previously this could only be passed in as a positional argument to `.new` and not at all to `.parse`. @flavorjones
67
76
*[CRuby] The update to libxml v2.13 improves "in context" fragment parsing recovery. We removed our hacky workaround for recovery that led to silently-degraded functionality when parsing fragments with parse errors. Specifically, malformed XML fragments that used implicit namespace prefixes will now "link up" to the namespaces in the parent document or node, where previously they did not. [#2092]@flavorjones
68
77
*[CRuby] When multiple errors could be detected by the parser and there's no obvious document to save them in (for example, when parsing a document with the recovery parse option turned off), the libxml2 errors are aggregated into a single `Nokogiri::XML::SyntaxError`. Previously, only the last error recorded by libxml2 was raised, which might be misleading if it's merely a warning and not the fatal error preventing the operation. [#2562]@flavorjones
69
78
*[CRuby] The SAX parser context and handler implementation has been simplified and now takes advantage of some of libxml2's default SAX handlers for entities and DTD management. [#3265]@flavorjones
70
-
*[CRuby] When building from source on MacOS, environment variables AR and RANLIB are now respected when set instead of being overridden to /usr/bin/{ar,ranlib} (which is still the default). [#3338]@joshheinrichs-shopify
79
+
*[CRuby] When compiling packaged libraries from source, allow users' `AR` and `LD` environment variables to set the archiver and linker commands, respectively. This augments the existing `CC` environment variable to set the compiler command. [#3165]@ziggythehamster
80
+
*[CRuby] When building from source on MacOS, environment variables `AR` and `RANLIB` are now respected when set instead of being overridden to /usr/bin/{ar,ranlib} (which is still the default). [#3338]@joshheinrichs-shopify
71
81
72
82
73
83
### Fixed
@@ -80,7 +90,7 @@ We've resolved many long-standing bugs in the various schema classes, validation
80
90
*[CRuby] libgumbo (the HTML5 parser) treats reaching max-depth as EOF. This addresses a class of issues when the parser is interrupted in this way. [#3121]@stevecheckoway
81
91
*[CRuby] Update node GC lifecycle to avoid a potential memory leak with fragments in libxml 2.13.0 caused by changes in `xmlAddChild`. [#3156]@flavorjones
82
92
*[CRuby] libgumbo correctly prints nonstandard element names in error messages. [#3219]@stevecheckoway
83
-
*[CRuby]SAX parsing no longer registers errors when encountering external entity references. [#1926]@flavorjones
93
+
*[CRuby]External entity references no long cause the SAX parser to register errors. [#1926]@flavorjones
84
94
*[JRuby] Fixed entity reference serialization, which rendered both the reference and the replacement text. Incredibly nobody noticed this bug for over a decade. [#3272]@flavorjones
85
95
*[JRuby] Fixed some bugs in how `Node#attributes` handles attributes with namespaces. [#2677, #2679]@flavorjones
86
96
*[JRuby] Fix `Schema#validate` to only return the most recent Document's errors. Previously, if multiple documents were validated, this method returned the accumulated errors of all previous documents. [#1282]@flavorjones
@@ -93,7 +103,7 @@ We've resolved many long-standing bugs in the various schema classes, validation
93
103
94
104
### Changed
95
105
96
-
*[CRuby]`Nokogiri::XML::CData.new` no longer accepts `nil` as the content argument, making `CData` behave like other character data classes (like `Comment` and `Text`). This change was necessitated by behavioral changes in the upcoming libxml 2.13.0 release. If you wish to create an empty CDATA node, pass an empty string. [#3156]@flavorjones
106
+
*[CRuby]`Nokogiri::XML::CData.new` no longer accepts `nil` as the content argument, making `CData` behave like other character data classes (like `Comment` and `Text`). This change was necessitated by behavioral changes in libxml2 v2.13.0. If you wish to create an empty CDATA node, pass an empty string. [#3156]@flavorjones
97
107
* Internals:
98
108
* The internal `CSS::XPathVisitor` class now accepts the xpath prefix and the context namespaces as constructor arguments. The `prefix:` and `ns:` keyword arguments to `CSS.xpath_for` cannot be specified if the `visitor:` keyword argument is also used. `CSS::XPathVisitor` now exposes `#builtins`, `#doctype`, `#prefix`, and `#namespaces` attributes. [#3225]@flavorjones
99
109
* The internal CSS selector cache has been extracted into a distinct class, `CSS::SelectorCache`. Previously it was part of the `CSS::Parser` class. [#3226]@flavorjones
@@ -107,6 +117,51 @@ We've resolved many long-standing bugs in the various schema classes, validation
107
117
* Passing libxml2 encoding IDs to `SAX::ParserContext` methods is now deprecated and will generate a warning. The use of `SAX::Parser::ENCODINGS` is also deprecated. Use `Encoding` objects or encoding names instead.
108
118
109
119
120
+
### Thank you!
121
+
122
+
The following people and organizations were kind enough to sponsor @flavorjones or the Nokogiri project during the development of v1.17.0:
123
+
124
+
* via Github sponsors
125
+
* renuo @renuo
126
+
* Ajaya Agrawalla @ajaya
127
+
* Rob Stringer @Mycobee
128
+
* Better Stack Community @betterstack-community
129
+
* Prowly @prowlycom
130
+
* Maxime Gauthier @biximilien
131
+
* Harry Lascelles @hlascelles
132
+
* Evil Martians @evilmartians
133
+
* Typesense @typesense
134
+
* YOSHIDA Katsuhiko @kyoshidajp
135
+
* Quan Nguyen @qu8n
136
+
* Sentry @getsentry
137
+
* Codecov @codecov
138
+
* Frank Groeneveld @frenkel
139
+
* Hiroshi SHIBATA @hsbt
140
+
* Nando Vieira @fnando
141
+
* Orien Madgwick @orien
142
+
* Avo @avo-hq
143
+
* Zoran Pesic @zokioki
144
+
*@zzak
145
+
* Graham Watts @GingerGraham
146
+
* Nandang Permana Kusuma @nandangpk
147
+
* Mr. Henry @mrhenry
148
+
* Götz Görisch @GoetzGoerisch
149
+
* Andrew Nesbitt @andrew
150
+
* via Thanks.dev
151
+
* Sentry @getsentry
152
+
* Codecov @codecov
153
+
* Keygen @keygen-sh
154
+
* Keith Bauson @kwbauson
155
+
* Nicco Kunzmann @niccokunzmann
156
+
* timhaynes @timhaynes
157
+
* via Open Collective
158
+
* Airbnb @airbnb
159
+
* Nemo @captn3m0
160
+
* Velocity Labs @velocity-labs
161
+
162
+
We'd also like to thank @github who donate a ton of compute time for our CI pipelines!
0 commit comments