nokogiri 1.17.2 → 1.18.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a915fe582aabad2932ced42915cdb777c64c1a3f3ea8bfd89341fa222c022d62
4
- data.tar.gz: 90301f89de7232df132f7f6d664fe7c1e490ffcd18ceaf517b614581ec34eaac
3
+ metadata.gz: 2679f31fc93dd9d3024cd46179269b006164ee0f54bc0f65cbc63c8db2d5139c
4
+ data.tar.gz: 6a55139a96f9394360945cc889d55c98c114f0f7007654bb058165eb3973cf34
5
5
  SHA512:
6
- metadata.gz: 8ffd386186555f7dd6ea54d30f82a902e6fafc4c15a1cf7fc181964bf85f8d69043f2289133ca1ae3f294889e03841056963486897b947d05eefa389735ca2d8
7
- data.tar.gz: 2582576f9d51851a2bf41ecd9c18ec972c4e909b51590dc46503b484ca3a91a6999dd5bcff943a4be9f899346405217b56431d9d554d5b198ad62b382e286cbd
6
+ metadata.gz: 390eeaf3c32f09f2a60efca24c37056911d82f91193eac0fba6ae243e55183999479b42e383781412ec46169cc0fa3ee132b8de696072a06cce82c6283475bef
7
+ data.tar.gz: 7aaf5fa7d8228438de89c8efaf4ab68a5dd42c58ad81b21c9ae85c3c5b5beead377e6ab31bc182ede92a0523d3d20de3feb1473c3f5289b16c34e56057c7d629
data/Gemfile CHANGED
@@ -11,20 +11,20 @@ group :development do
11
11
 
12
12
  # building extensions
13
13
  gem "rake-compiler", "1.2.8"
14
- gem "rake-compiler-dock", "1.5.2"
14
+ gem "rake-compiler-dock", "1.7.0"
15
15
 
16
16
  # parser generator
17
17
  gem "rexical", "1.0.8"
18
18
 
19
19
  # tests
20
- gem "minitest", "5.25.2"
20
+ gem "minitest", "5.25.4"
21
21
  gem "minitest-parallel_fork", "2.0.0"
22
22
  gem "ruby_memcheck", "3.0.0"
23
23
  gem "rubyzip", "~> 2.3.2"
24
24
  gem "simplecov", "= 0.21.2"
25
25
 
26
26
  # rubocop
27
- gem "standard", "1.42.1"
27
+ gem "standard", "1.43.0"
28
28
  gem "rubocop-minitest", "0.36.0"
29
29
  gem "rubocop-packaging", "0.5.2"
30
30
  gem "rubocop-rake", "0.6.0"
@@ -34,5 +34,6 @@ end
34
34
  # `bundle config set --local without rdoc`
35
35
  # Then re-run `bundle install`.
36
36
  group :rdoc do
37
- gem "rdoc", "6.8.1"
37
+ gem "rdoc", "6.10.0"
38
+ gem "jar-dependencies", "0.4.1" if RUBY_PLATFORM == "java" # https://github.com/jruby/jruby/issues/7262
38
39
  end
@@ -10,9 +10,9 @@ Note that this document is broken into multiple sections, each of which describe
10
10
 
11
11
  - [Platform Releases](#platform-releases)
12
12
  * [Default platform release ("ruby")](#default-platform-release-ruby)
13
- * [Native LinuxⓇ platform releases ("x86_64-linux", "arm64-linux", "aarch64-linux", and "arm-linux")](#native-linux%E2%93%A1-platform-releases-x86_64-linux-arm64-linux-aarch64-linux-and-arm-linux)
13
+ * [Native LinuxⓇ platform releases ("x86_64-linux", "aarch64-linux", and "arm-linux")](#native-linux%E2%93%A1-platform-releases-x86_64-linux-aarch64-linux-and-arm-linux)
14
14
  * [Native Darwin (macOSⓇ) platform releases ("x86_64-darwin" and "arm64-darwin")](#native-darwin-macos%E2%93%A1-platform-releases-x86_64-darwin-and-arm64-darwin)
15
- * [Native WindowsⓇ platform releases ("x86-mingw32" and "x64-mingw32")](#native-windows%E2%93%A1-platform-releases-x86-mingw32-and-x64-mingw32)
15
+ * [Native WindowsⓇ platform releases ("x64-mingw-ucrt")](#native-windows%E2%93%A1-platform-releases-x64-mingw-ucrt)
16
16
  * [JavaⓇ (JRuby) platform release ("java")](#java%E2%93%A1-jruby-platform-release-java)
17
17
  - [Appendix: Dependencies' License Texts](#appendix-dependencies-license-texts)
18
18
  * [libgumbo](#libgumbo)
@@ -51,7 +51,7 @@ The default platform release distributes the following dependencies in source fo
51
51
  This distribution can be identified by inspecting the included Gem::Specification, which will have the value "ruby" for its "platform" attribute.
52
52
 
53
53
 
54
- ### Native LinuxⓇ platform releases ("x86_64-linux", "arm64-linux", "aarch64-linux", and "arm-linux")
54
+ ### Native LinuxⓇ platform releases ("x86_64-linux", "aarch64-linux", and "arm-linux")
55
55
 
56
56
  The native LinuxⓇ platform release distributes the following dependencies in source form:
57
57
 
@@ -60,7 +60,7 @@ The native LinuxⓇ platform release distributes the following dependencies in s
60
60
  * [libgumbo](#libgumbo)
61
61
  * [zlib](#zlib)
62
62
 
63
- This distribution can be identified by inspecting the included Gem::Specification, which will have a value similar to "x86_64-linux" or "arm64-linux" for its "platform.cpu" attribute.
63
+ This distribution can be identified by inspecting the included Gem::Specification, which will have a value similar to "x86_64-linux" or "aarch64-linux" for its "platform.cpu" attribute.
64
64
 
65
65
 
66
66
  ### Native Darwin (macOSⓇ) platform releases ("x86_64-darwin" and "arm64-darwin")
@@ -76,7 +76,7 @@ The native Darwin platform release distributes the following dependencies in sou
76
76
  This distribution can be identified by inspecting the included Gem::Specification, which will have a value similar to "x86_64-darwin" or "arm64-darwin" for its "platform.cpu" attribute. Darwin is also known more familiarly as "OSX" or "macOSⓇ" and is the operating system for many AppleⓇ computers.
77
77
 
78
78
 
79
- ### Native WindowsⓇ platform releases ("x86-mingw32" and "x64-mingw32")
79
+ ### Native WindowsⓇ platform releases ("x64-mingw-ucrt")
80
80
 
81
81
  The native WindowsⓇ platform release distributes the following dependencies in source form:
82
82
 
@@ -86,7 +86,7 @@ The native WindowsⓇ platform release distributes the following dependencies in
86
86
  * [zlib](#zlib)
87
87
  * [libiconv](#libiconv)
88
88
 
89
- This distribution can be identified by inspecting the included Gem::Specification, which will have a value similar to "x64-mingw32" or "x86-mingw32" for its "platform.cpu" attribute.
89
+ This distribution can be identified by inspecting the included Gem::Specification, which will have a value similar to "x64-mingw-ucrt" for its "platform.cpu" attribute.
90
90
 
91
91
 
92
92
  ### JavaⓇ (JRuby) platform release ("java")
data/README.md CHANGED
@@ -114,7 +114,7 @@ You can help sponsor the maintainers of this software through one of these organ
114
114
 
115
115
  Requirements:
116
116
 
117
- - Ruby >= 3.0
117
+ - Ruby >= 3.1
118
118
  - JRuby >= 9.4.0.0
119
119
 
120
120
  If you are compiling the native extension against a system version of libxml2:
@@ -131,11 +131,10 @@ If you are compiling the native extension against a system version of libxml2:
131
131
  Nokogiri ships pre-compiled, "native" gems for the following platforms:
132
132
 
133
133
  - Linux:
134
- - `x86-linux` and `x86_64-linux` (req: `glibc >= 2.17`)
135
- - `aarch64-linux` and `arm-linux` (req: `glibc >= 2.29`)
136
- - Note that musl platforms like Alpine **are** supported
134
+ - `x86_64-linux-gnu`, `aarch64-linux-gnu`, and `arm-linux-gnu` (req: `glibc >= 2.29`)
135
+ - `x86_64-linux-musl`, `aarch64-linux-musl`, and `arm-linux-musl`
137
136
  - Darwin/MacOS: `x86_64-darwin` and `arm64-darwin`
138
- - Windows: `x86-mingw32`, `x64-mingw32`, and `x64-mingw-ucrt`
137
+ - Windows: `x64-mingw-ucrt`
139
138
  - Java: any platform running JRuby 9.4 or higher
140
139
 
141
140
  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'`.
@@ -847,7 +847,7 @@ else
847
847
  # The libiconv configure script doesn't accept "arm64" host string but "aarch64"
848
848
  recipe.host = recipe.host.gsub("arm64-apple-darwin", "aarch64-apple-darwin")
849
849
 
850
- cflags = concat_flags(ENV["CFLAGS"], "-O2", "-U_FORTIFY_SOURCE", "-g")
850
+ cflags = concat_flags(ENV["CFLAGS"], "-O2", "-g")
851
851
 
852
852
  recipe.configure_options += [
853
853
  "--disable-dependency-tracking",
@@ -911,7 +911,7 @@ else
911
911
  end
912
912
 
913
913
  cppflags = concat_flags(ENV["CPPFLAGS"])
914
- cflags = concat_flags(ENV["CFLAGS"], "-O2", "-U_FORTIFY_SOURCE", "-g")
914
+ cflags = concat_flags(ENV["CFLAGS"], "-O2", "-g")
915
915
 
916
916
  if cross_build_p
917
917
  cppflags = concat_flags(cppflags, "-DNOKOGIRI_PRECOMPILED_LIBRARIES")
@@ -952,7 +952,6 @@ else
952
952
  "--with-c14n",
953
953
  "--with-debug",
954
954
  "--with-threads",
955
- "--without-tls", # see https://github.com/sparklemotion/nokogiri/issues/3031
956
955
  "CPPFLAGS=#{cppflags}",
957
956
  "CFLAGS=#{cflags}",
958
957
  ]
@@ -971,7 +970,7 @@ else
971
970
  recipe.patch_files = Dir[File.join(PACKAGE_ROOT_DIR, "patches", "libxslt", "*.patch")].sort
972
971
  end
973
972
 
974
- cflags = concat_flags(ENV["CFLAGS"], "-O2", "-U_FORTIFY_SOURCE", "-g")
973
+ cflags = concat_flags(ENV["CFLAGS"], "-O2", "-g")
975
974
 
976
975
  if darwin? && !cross_build_p
977
976
  recipe.configure_options << "RANLIB=/usr/bin/ranlib" unless ENV.key?("RANLIB")
@@ -1117,14 +1116,7 @@ else
1117
1116
  end
1118
1117
  env["RANLIB"] = "#{host}-ranlib"
1119
1118
  if windows?
1120
- # NOTE: that in any particular windows gem package, we only ever compile against either
1121
- # msvcrt (ruby <= 3.0) or ucrt (ruby > 3.0), so even though this gets evaluated only once
1122
- # per gem (and not per-version-of-ruby), it's OK.
1123
- env["CFLAGS"] = if RbConfig::CONFIG["RUBY_SO_NAME"].include?("msvcrt")
1124
- concat_flags(env["CFLAGS"], "-D_RUBY_MSVCRT")
1125
- else
1126
- concat_flags(env["CFLAGS"], "-D_RUBY_UCRT")
1127
- end
1119
+ concat_flags(env["CFLAGS"], "-D_RUBY_UCRT")
1128
1120
  end
1129
1121
  end
1130
1122
 
@@ -1141,7 +1133,7 @@ end
1141
1133
  have_func("xmlCtxtSetOptions") # introduced in libxml2 2.13.0
1142
1134
  have_func("xmlCtxtGetOptions") # introduced in libxml2 2.14.0
1143
1135
  have_func("xmlSwitchEncodingName") # introduced in libxml2 2.13.0
1144
- have_func("rb_category_warning") # introduced in Ruby 3.0
1136
+ have_func("rb_category_warning") # introduced in Ruby 3.0 but had trouble resolving this symbol in truffleruby
1145
1137
 
1146
1138
  other_library_versions_string = OTHER_LIBRARY_VERSIONS.map { |k, v| [k, v].join(":") }.join(",")
1147
1139
  append_cppflags(%[-DNOKOGIRI_OTHER_LIBRARY_VERSIONS="\\"#{other_library_versions_string}\\""])
@@ -12,23 +12,23 @@ static const xmlChar *NOKOGIRI_BUILTIN_PREFIX = (const xmlChar *)"nokogiri-built
12
12
  static const xmlChar *NOKOGIRI_BUILTIN_URI = (const xmlChar *)"https://www.nokogiri.org/default_ns/ruby/builtins";
13
13
 
14
14
  static void
15
- xml_xpath_context_deallocate(void *data)
15
+ _noko_xml_xpath_context_dfree(void *data)
16
16
  {
17
17
  xmlXPathContextPtr c_context = data;
18
18
  xmlXPathFreeContext(c_context);
19
19
  }
20
20
 
21
- static const rb_data_type_t xml_xpath_context_type = {
21
+ static const rb_data_type_t _noko_xml_xpath_context_type = {
22
22
  .wrap_struct_name = "xmlXPathContext",
23
23
  .function = {
24
- .dfree = xml_xpath_context_deallocate,
24
+ .dfree = _noko_xml_xpath_context_dfree,
25
25
  },
26
26
  .flags = RUBY_TYPED_FREE_IMMEDIATELY | RUBY_TYPED_WB_PROTECTED,
27
27
  };
28
28
 
29
29
  /* find a CSS class in an HTML element's `class` attribute */
30
30
  static const xmlChar *
31
- builtin_css_class(const xmlChar *str, const xmlChar *val)
31
+ _noko_xml_xpath_context__css_class(const xmlChar *str, const xmlChar *val)
32
32
  {
33
33
  int val_len;
34
34
 
@@ -62,9 +62,9 @@ builtin_css_class(const xmlChar *str, const xmlChar *val)
62
62
  return (NULL);
63
63
  }
64
64
 
65
- /* xmlXPathFunction to wrap builtin_css_class() */
65
+ /* xmlXPathFunction to wrap _noko_xml_xpath_context__css_class() */
66
66
  static void
67
- xpath_builtin_css_class(xmlXPathParserContextPtr ctxt, int nargs)
67
+ noko_xml_xpath_context_xpath_func_css_class(xmlXPathParserContextPtr ctxt, int nargs)
68
68
  {
69
69
  xmlXPathObjectPtr hay, needle;
70
70
 
@@ -85,7 +85,7 @@ xpath_builtin_css_class(xmlXPathParserContextPtr ctxt, int nargs)
85
85
  XP_ERROR(XPATH_INVALID_TYPE);
86
86
  }
87
87
 
88
- if (builtin_css_class(hay->stringval, needle->stringval)) {
88
+ if (_noko_xml_xpath_context__css_class(hay->stringval, needle->stringval)) {
89
89
  valuePush(ctxt, xmlXPathNewBoolean(1));
90
90
  } else {
91
91
  valuePush(ctxt, xmlXPathNewBoolean(0));
@@ -99,7 +99,7 @@ xpath_builtin_css_class(xmlXPathParserContextPtr ctxt, int nargs)
99
99
  /* xmlXPathFunction to select nodes whose local name matches, for HTML5 CSS queries that should
100
100
  * ignore namespaces */
101
101
  static void
102
- xpath_builtin_local_name_is(xmlXPathParserContextPtr ctxt, int nargs)
102
+ noko_xml_xpath_context_xpath_func_local_name_is(xmlXPathParserContextPtr ctxt, int nargs)
103
103
  {
104
104
  xmlXPathObjectPtr element_name;
105
105
 
@@ -124,25 +124,26 @@ xpath_builtin_local_name_is(xmlXPathParserContextPtr ctxt, int nargs)
124
124
  * register_ns(prefix, uri) → Nokogiri::XML::XPathContext
125
125
  *
126
126
  * Register the namespace with +prefix+ and +uri+ for use in future queries.
127
+ * Passing a uri of +nil+ will unregister the namespace.
127
128
  *
128
129
  * [Returns] +self+
129
130
  */
130
131
  static VALUE
131
- rb_xml_xpath_context_register_ns(VALUE rb_context, VALUE prefix, VALUE uri)
132
+ noko_xml_xpath_context_register_ns(VALUE rb_context, VALUE prefix, VALUE uri)
132
133
  {
133
134
  xmlXPathContextPtr c_context;
135
+ const xmlChar *ns_uri;
134
136
 
135
- TypedData_Get_Struct(
136
- rb_context,
137
- xmlXPathContext,
138
- &xml_xpath_context_type,
139
- c_context
140
- );
137
+ TypedData_Get_Struct(rb_context, xmlXPathContext, &_noko_xml_xpath_context_type, c_context);
138
+
139
+ if (NIL_P(uri)) {
140
+ ns_uri = NULL;
141
+ } else {
142
+ ns_uri = (const xmlChar *)StringValueCStr(uri);
143
+ }
144
+
145
+ xmlXPathRegisterNs(c_context, (const xmlChar *)StringValueCStr(prefix), ns_uri);
141
146
 
142
- xmlXPathRegisterNs(c_context,
143
- (const xmlChar *)StringValueCStr(prefix),
144
- (const xmlChar *)StringValueCStr(uri)
145
- );
146
147
  return rb_context;
147
148
  }
148
149
 
@@ -151,29 +152,25 @@ rb_xml_xpath_context_register_ns(VALUE rb_context, VALUE prefix, VALUE uri)
151
152
  * register_variable(name, value) → Nokogiri::XML::XPathContext
152
153
  *
153
154
  * Register the variable +name+ with +value+ for use in future queries.
155
+ * Passing a value of +nil+ will unregister the variable.
154
156
  *
155
157
  * [Returns] +self+
156
158
  */
157
159
  static VALUE
158
- rb_xml_xpath_context_register_variable(VALUE rb_context, VALUE name, VALUE value)
160
+ noko_xml_xpath_context_register_variable(VALUE rb_context, VALUE name, VALUE value)
159
161
  {
160
162
  xmlXPathContextPtr c_context;
161
163
  xmlXPathObjectPtr xmlValue;
162
164
 
163
- TypedData_Get_Struct(
164
- rb_context,
165
- xmlXPathContext,
166
- &xml_xpath_context_type,
167
- c_context
168
- );
165
+ TypedData_Get_Struct(rb_context, xmlXPathContext, &_noko_xml_xpath_context_type, c_context);
169
166
 
170
- xmlValue = xmlXPathNewCString(StringValueCStr(value));
167
+ if (NIL_P(value)) {
168
+ xmlValue = NULL;
169
+ } else {
170
+ xmlValue = xmlXPathNewCString(StringValueCStr(value));
171
+ }
171
172
 
172
- xmlXPathRegisterVariable(
173
- c_context,
174
- (const xmlChar *)StringValueCStr(name),
175
- xmlValue
176
- );
173
+ xmlXPathRegisterVariable(c_context, (const xmlChar *)StringValueCStr(name), xmlValue);
177
174
 
178
175
  return rb_context;
179
176
  }
@@ -184,7 +181,7 @@ rb_xml_xpath_context_register_variable(VALUE rb_context, VALUE name, VALUE value
184
181
  * returns Qundef if no conversion was possible.
185
182
  */
186
183
  static VALUE
187
- xpath2ruby(xmlXPathObjectPtr c_xpath_object, xmlXPathContextPtr c_context)
184
+ _noko_xml_xpath_context__xpath2ruby(xmlXPathObjectPtr c_xpath_object, xmlXPathContextPtr c_context)
188
185
  {
189
186
  VALUE rb_retval;
190
187
 
@@ -238,7 +235,7 @@ Nokogiri_marshal_xpath_funcall_and_return_values(
238
235
 
239
236
  for (int j = argc - 1 ; j >= 0 ; --j) {
240
237
  c_xpath_object = valuePop(ctxt);
241
- argv[j] = xpath2ruby(c_xpath_object, ctxt->context);
238
+ argv[j] = _noko_xml_xpath_context__xpath2ruby(c_xpath_object, ctxt->context);
242
239
  if (argv[j] == Qundef) {
243
240
  argv[j] = NOKOGIRI_STR_NEW2(xmlXPathCastToString(c_xpath_object));
244
241
  }
@@ -294,7 +291,7 @@ Nokogiri_marshal_xpath_funcall_and_return_values(
294
291
  }
295
292
 
296
293
  static void
297
- method_caller(xmlXPathParserContextPtr ctxt, int argc)
294
+ _noko_xml_xpath_context__handler_invoker(xmlXPathParserContextPtr ctxt, int argc)
298
295
  {
299
296
  VALUE rb_xpath_handler = Qnil;
300
297
  const char *method_name = NULL ;
@@ -316,15 +313,15 @@ method_caller(xmlXPathParserContextPtr ctxt, int argc)
316
313
  }
317
314
 
318
315
  static xmlXPathFunction
319
- handler_lookup(void *data, const xmlChar *c_name, const xmlChar *c_ns_uri)
316
+ _noko_xml_xpath_context_handler_lookup(void *data, const xmlChar *c_name, const xmlChar *c_ns_uri)
320
317
  {
321
318
  VALUE rb_handler = (VALUE)data;
322
319
  if (rb_respond_to(rb_handler, rb_intern((const char *)c_name))) {
323
320
  if (c_ns_uri == NULL) {
324
321
  NOKO_WARN_DEPRECATION("A custom XPath or CSS handler function named '%s' is being invoked without a namespace. Please update your query to reference this function as 'nokogiri:%s'. Invoking custom handler functions without a namespace is deprecated and will become an error in Nokogiri v1.17.0.",
325
- c_name, c_name); // deprecated in v1.15.0, remove in v1.17.0
322
+ c_name, c_name); // TODO deprecated in v1.15.0, remove in v1.19.0
326
323
  }
327
- return method_caller;
324
+ return _noko_xml_xpath_context__handler_invoker;
328
325
  }
329
326
 
330
327
  return NULL;
@@ -332,7 +329,7 @@ handler_lookup(void *data, const xmlChar *c_name, const xmlChar *c_ns_uri)
332
329
 
333
330
  PRINTFLIKE_DECL(2, 3)
334
331
  static void
335
- generic_exception_pusher(void *data, const char *msg, ...)
332
+ _noko_xml_xpath_context__generic_exception_pusher(void *data, const char *msg, ...)
336
333
  {
337
334
  VALUE rb_errors = (VALUE)data;
338
335
  VALUE rb_message;
@@ -343,7 +340,7 @@ generic_exception_pusher(void *data, const char *msg, ...)
343
340
  #ifdef TRUFFLERUBY_NOKOGIRI_SYSTEM_LIBRARIES
344
341
  /* It is not currently possible to pass var args from native
345
342
  functions to sulong, so we work around the issue here. */
346
- rb_message = rb_sprintf("generic_exception_pusher: %s", msg);
343
+ rb_message = rb_sprintf("_noko_xml_xpath_context__generic_exception_pusher: %s", msg);
347
344
  #else
348
345
  va_list args;
349
346
  va_start(args, msg);
@@ -365,58 +362,55 @@ generic_exception_pusher(void *data, const char *msg, ...)
365
362
  * a +Float+, or a boolean.
366
363
  */
367
364
  static VALUE
368
- rb_xml_xpath_context_evaluate(int argc, VALUE *argv, VALUE rb_context)
365
+ noko_xml_xpath_context_evaluate(int argc, VALUE *argv, VALUE rb_context)
369
366
  {
370
- VALUE search_path, xpath_handler;
371
- VALUE retval = Qnil;
372
367
  xmlXPathContextPtr c_context;
373
- xmlXPathObjectPtr xpath;
374
- xmlChar *query;
375
- VALUE errors = rb_ary_new();
376
-
377
- TypedData_Get_Struct(
378
- rb_context,
379
- xmlXPathContext,
380
- &xml_xpath_context_type,
381
- c_context
382
- );
368
+ VALUE rb_expression = Qnil;
369
+ VALUE rb_function_lookup_handler = Qnil;
370
+ xmlChar *c_expression_str = NULL;
371
+ VALUE rb_errors = rb_ary_new();
372
+ xmlXPathObjectPtr c_xpath_object;
373
+ VALUE rb_xpath_object = Qnil;
383
374
 
384
- if (rb_scan_args(argc, argv, "11", &search_path, &xpath_handler) == 1) {
385
- xpath_handler = Qnil;
386
- }
375
+ TypedData_Get_Struct(rb_context, xmlXPathContext, &_noko_xml_xpath_context_type, c_context);
376
+
377
+ rb_scan_args(argc, argv, "11", &rb_expression, &rb_function_lookup_handler);
387
378
 
388
- query = (xmlChar *)StringValueCStr(search_path);
379
+ c_expression_str = (xmlChar *)StringValueCStr(rb_expression);
389
380
 
390
- if (Qnil != xpath_handler) {
381
+ if (Qnil != rb_function_lookup_handler) {
391
382
  /* FIXME: not sure if this is the correct place to shove private data. */
392
- c_context->userData = (void *)xpath_handler;
383
+ c_context->userData = (void *)rb_function_lookup_handler;
393
384
  xmlXPathRegisterFuncLookup(
394
385
  c_context,
395
- handler_lookup,
396
- (void *)xpath_handler
386
+ _noko_xml_xpath_context_handler_lookup,
387
+ (void *)rb_function_lookup_handler
397
388
  );
398
389
  }
399
390
 
400
- xmlSetStructuredErrorFunc((void *)errors, noko__error_array_pusher);
401
- xmlSetGenericErrorFunc((void *)errors, generic_exception_pusher);
391
+ /* TODO: use xmlXPathSetErrorHandler (as of 2.13.0) */
392
+ xmlSetStructuredErrorFunc((void *)rb_errors, noko__error_array_pusher);
393
+ xmlSetGenericErrorFunc((void *)rb_errors, _noko_xml_xpath_context__generic_exception_pusher);
402
394
 
403
- xpath = xmlXPathEvalExpression(query, c_context);
395
+ c_xpath_object = xmlXPathEvalExpression(c_expression_str, c_context);
404
396
 
405
397
  xmlSetStructuredErrorFunc(NULL, NULL);
406
398
  xmlSetGenericErrorFunc(NULL, NULL);
407
399
 
408
- if (xpath == NULL) {
409
- rb_exc_raise(rb_ary_entry(errors, 0));
400
+ xmlXPathRegisterFuncLookup(c_context, NULL, NULL);
401
+
402
+ if (c_xpath_object == NULL) {
403
+ rb_exc_raise(rb_ary_entry(rb_errors, 0));
410
404
  }
411
405
 
412
- retval = xpath2ruby(xpath, c_context);
413
- if (retval == Qundef) {
414
- retval = noko_xml_node_set_wrap(NULL, DOC_RUBY_OBJECT(c_context->doc));
406
+ rb_xpath_object = _noko_xml_xpath_context__xpath2ruby(c_xpath_object, c_context);
407
+ if (rb_xpath_object == Qundef) {
408
+ rb_xpath_object = noko_xml_node_set_wrap(NULL, DOC_RUBY_OBJECT(c_context->doc));
415
409
  }
416
410
 
417
- xmlXPathFreeNodeSetList(xpath);
411
+ xmlXPathFreeNodeSetList(c_xpath_object);
418
412
 
419
- return retval;
413
+ return rb_xpath_object;
420
414
  }
421
415
 
422
416
  /*
@@ -426,45 +420,53 @@ rb_xml_xpath_context_evaluate(int argc, VALUE *argv, VALUE rb_context)
426
420
  * Create a new XPathContext with +node+ as the context node.
427
421
  */
428
422
  static VALUE
429
- rb_xml_xpath_context_new(VALUE klass, VALUE rb_node)
423
+ noko_xml_xpath_context_new(VALUE klass, VALUE rb_node)
430
424
  {
431
- xmlNodePtr node;
425
+ xmlNodePtr c_node;
432
426
  xmlXPathContextPtr c_context;
433
427
  VALUE rb_context;
434
428
 
435
- Noko_Node_Get_Struct(rb_node, xmlNode, node);
429
+ Noko_Node_Get_Struct(rb_node, xmlNode, c_node);
436
430
 
437
431
  #if LIBXML_VERSION < 21000
438
- /* deprecated in 40483d0 */
439
- xmlXPathInit();
432
+ xmlXPathInit(); /* deprecated in 40483d0 */
440
433
  #endif
441
434
 
442
- c_context = xmlXPathNewContext(node->doc);
443
- c_context->node = node;
435
+ c_context = xmlXPathNewContext(c_node->doc);
436
+ c_context->node = c_node;
444
437
 
445
438
  xmlXPathRegisterNs(c_context, NOKOGIRI_PREFIX, NOKOGIRI_URI);
446
439
  xmlXPathRegisterNs(c_context, NOKOGIRI_BUILTIN_PREFIX, NOKOGIRI_BUILTIN_URI);
447
- xmlXPathRegisterFuncNS(
448
- c_context,
449
- (const xmlChar *)"css-class",
450
- NOKOGIRI_BUILTIN_URI,
451
- xpath_builtin_css_class
452
- );
453
- xmlXPathRegisterFuncNS(
454
- c_context,
455
- (const xmlChar *)"local-name-is",
456
- NOKOGIRI_BUILTIN_URI,
457
- xpath_builtin_local_name_is
458
- );
459
440
 
460
- rb_context = TypedData_Wrap_Struct(
461
- klass,
462
- &xml_xpath_context_type,
463
- c_context
464
- );
441
+ xmlXPathRegisterFuncNS(c_context,
442
+ (const xmlChar *)"css-class", NOKOGIRI_BUILTIN_URI,
443
+ noko_xml_xpath_context_xpath_func_css_class);
444
+ xmlXPathRegisterFuncNS(c_context,
445
+ (const xmlChar *)"local-name-is", NOKOGIRI_BUILTIN_URI,
446
+ noko_xml_xpath_context_xpath_func_local_name_is);
447
+
448
+ rb_context = TypedData_Wrap_Struct(klass, &_noko_xml_xpath_context_type, c_context);
449
+
465
450
  return rb_context;
466
451
  }
467
452
 
453
+
454
+ /* :nodoc: */
455
+ static VALUE
456
+ noko_xml_xpath_context_set_node(VALUE rb_context, VALUE rb_node)
457
+ {
458
+ xmlNodePtr c_node;
459
+ xmlXPathContextPtr c_context;
460
+
461
+ TypedData_Get_Struct(rb_context, xmlXPathContext, &_noko_xml_xpath_context_type, c_context);
462
+ Noko_Node_Get_Struct(rb_node, xmlNode, c_node);
463
+
464
+ c_context->doc = c_node->doc;
465
+ c_context->node = c_node;
466
+
467
+ return rb_node;
468
+ }
469
+
468
470
  void
469
471
  noko_init_xml_xpath_context(void)
470
472
  {
@@ -475,9 +477,10 @@ noko_init_xml_xpath_context(void)
475
477
 
476
478
  rb_undef_alloc_func(cNokogiriXmlXpathContext);
477
479
 
478
- rb_define_singleton_method(cNokogiriXmlXpathContext, "new", rb_xml_xpath_context_new, 1);
480
+ rb_define_singleton_method(cNokogiriXmlXpathContext, "new", noko_xml_xpath_context_new, 1);
479
481
 
480
- rb_define_method(cNokogiriXmlXpathContext, "evaluate", rb_xml_xpath_context_evaluate, -1);
481
- rb_define_method(cNokogiriXmlXpathContext, "register_variable", rb_xml_xpath_context_register_variable, 2);
482
- rb_define_method(cNokogiriXmlXpathContext, "register_ns", rb_xml_xpath_context_register_ns, 2);
482
+ rb_define_method(cNokogiriXmlXpathContext, "evaluate", noko_xml_xpath_context_evaluate, -1);
483
+ rb_define_method(cNokogiriXmlXpathContext, "register_variable", noko_xml_xpath_context_register_variable, 2);
484
+ rb_define_method(cNokogiriXmlXpathContext, "register_ns", noko_xml_xpath_context_register_ns, 2);
485
+ rb_define_method(cNokogiriXmlXpathContext, "node=", noko_xml_xpath_context_set_node, 1);
483
486
  }
@@ -44,8 +44,8 @@ const unsigned char _gumbo_ascii_table[0x80] = {
44
44
  };
45
45
 
46
46
  // Table generation code.
47
- // clang -DGUMBO_GEN_TABLE=1 ascii.c && ./a.out && rm a.out
48
- #if GUMBO_GEN_TABLE
47
+ // clang -DGUMBO_GEN_TABLE ascii.c && ./a.out && rm a.out
48
+ #ifdef GUMBO_GEN_TABLE
49
49
  #include <stdio.h>
50
50
 
51
51
  int main() {
@@ -318,7 +318,7 @@ static GumboNode* create_node(GumboNodeType type) {
318
318
  return node;
319
319
  }
320
320
 
321
- static GumboNode* new_document_node() {
321
+ static GumboNode* new_document_node(void) {
322
322
  GumboNode* document_node = create_node(GUMBO_NODE_DOCUMENT);
323
323
  document_node->parse_flags = GUMBO_INSERTION_BY_PARSER;
324
324
  gumbo_vector_init(1, &document_node->v.document.children);
@@ -1997,7 +1997,7 @@ static void adjust_svg_tag(GumboToken* token) {
1997
1997
  assert(token->type == GUMBO_TOKEN_START_TAG);
1998
1998
  if (token->v.start_tag.tag == GUMBO_TAG_FOREIGNOBJECT) {
1999
1999
  assert(token->v.start_tag.name == NULL);
2000
- token->v.start_tag.name = "foreignObject";
2000
+ token->v.start_tag.name = (char *)"foreignObject";
2001
2001
  } else if (token->v.start_tag.tag == GUMBO_TAG_UNKNOWN) {
2002
2002
  assert(token->v.start_tag.name);
2003
2003
  const StringReplacement *replacement = gumbo_get_svg_tag_replacement(
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Nokogiri
4
4
  # The version of Nokogiri you are using
5
- VERSION = "1.17.2"
5
+ VERSION = "1.18.0"
6
6
  end
@@ -207,35 +207,26 @@ module Nokogiri
207
207
 
208
208
  private
209
209
 
210
- def css_internal(node, rules, handler, ns)
211
- xpath_internal(node, css_rules_to_xpath(rules, ns), handler, ns, nil)
212
- end
213
-
214
- def xpath_internal(node, paths, handler, ns, binds)
215
- document = node.document
216
- return NodeSet.new(document) unless document
217
-
218
- if paths.length == 1
219
- return xpath_impl(node, paths.first, handler, ns, binds)
210
+ def extract_params(params) # :nodoc:
211
+ handler = params.find do |param|
212
+ ![Hash, String, Symbol].include?(param.class)
220
213
  end
214
+ params -= [handler] if handler
221
215
 
222
- NodeSet.new(document) do |combined|
223
- paths.each do |path|
224
- xpath_impl(node, path, handler, ns, binds).each { |set| combined << set }
225
- end
216
+ hashes = []
217
+ while Hash === params.last || params.last.nil?
218
+ hashes << params.pop
219
+ break if params.empty?
226
220
  end
227
- end
221
+ ns, binds = hashes.reverse
228
222
 
229
- def xpath_impl(node, path, handler, ns, binds)
230
- ctx = XPathContext.new(node)
231
- ctx.register_namespaces(ns)
232
- path = path.gsub("xmlns:", " :") unless Nokogiri.uses_libxml?
223
+ ns ||= document.root&.namespaces || {}
233
224
 
234
- binds&.each do |key, value|
235
- ctx.register_variable(key.to_s, value)
236
- end
225
+ [params, handler, ns, binds]
226
+ end
237
227
 
238
- ctx.evaluate(path, handler)
228
+ def css_internal(node, rules, handler, ns)
229
+ xpath_internal(node, css_rules_to_xpath(rules, ns), handler, ns, nil)
239
230
  end
240
231
 
241
232
  def css_rules_to_xpath(rules, ns)
@@ -254,22 +245,29 @@ module Nokogiri
254
245
  end.join(" | ")
255
246
  end
256
247
 
257
- def extract_params(params) # :nodoc:
258
- handler = params.find do |param|
259
- ![Hash, String, Symbol].include?(param.class)
248
+ def xpath_internal(node, paths, handler, ns, binds)
249
+ document = node.document
250
+ return NodeSet.new(document) unless document
251
+
252
+ if paths.length == 1
253
+ return xpath_impl(node, paths.first, handler, ns, binds)
260
254
  end
261
- params -= [handler] if handler
262
255
 
263
- hashes = []
264
- while Hash === params.last || params.last.nil?
265
- hashes << params.pop
266
- break if params.empty?
256
+ NodeSet.new(document) do |combined|
257
+ paths.each do |path|
258
+ xpath_impl(node, path, handler, ns, binds).each { |set| combined << set }
259
+ end
267
260
  end
268
- ns, binds = hashes.reverse
261
+ end
269
262
 
270
- ns ||= document.root&.namespaces || {}
263
+ def xpath_impl(node, path, handler, ns, binds)
264
+ context = XPathContext.new(node)
265
+ context.register_namespaces(ns)
266
+ context.register_variables(binds)
271
267
 
272
- [params, handler, ns, binds]
268
+ path = path.gsub("xmlns:", " :") unless Nokogiri.uses_libxml?
269
+
270
+ context.evaluate(path, handler)
273
271
  end
274
272
  end
275
273
  end
@@ -6,9 +6,20 @@ module Nokogiri
6
6
  ###
7
7
  # Register namespaces in +namespaces+
8
8
  def register_namespaces(namespaces)
9
- namespaces.each do |k, v|
10
- k = k.to_s.gsub(/.*:/, "") # strip off 'xmlns:' or 'xml:'
11
- register_ns(k, v)
9
+ namespaces.each do |key, value|
10
+ key = key.to_s.gsub(/.*:/, "") # strip off 'xmlns:' or 'xml:'
11
+
12
+ register_ns(key, value)
13
+ end
14
+ end
15
+
16
+ def register_variables(binds)
17
+ return if binds.nil?
18
+
19
+ binds.each do |key, value|
20
+ key = key.to_s
21
+
22
+ register_variable(key, value)
12
23
  end
13
24
  end
14
25
  end
@@ -0,0 +1,244 @@
1
+ From d3e3526111097560cf7c002613e2cb1d469b59e0 Mon Sep 17 00:00:00 2001
2
+ From: Nick Wellnhofer <wellnhofer@aevum.de>
3
+ Date: Sat, 21 Dec 2024 16:03:46 +0100
4
+ Subject: [PATCH] xpath: Use separate static hash table for standard functions
5
+
6
+ This avoids registering standard functions when creating an XPath
7
+ context.
8
+
9
+ Lookup of extension functions is a bit slower now, but ultimately, all
10
+ function lookups should be moved to the compilation phase.
11
+
12
+ (cherry picked from commit bf5fcf6e646bb51a0f6a3655a1d64bea97274867)
13
+ ---
14
+ xpath.c | 170 ++++++++++++++++++++++++++++++++------------------------
15
+ 1 file changed, 98 insertions(+), 72 deletions(-)
16
+
17
+ diff --git a/xpath.c b/xpath.c
18
+ index 485d7747..21711653 100644
19
+ --- a/xpath.c
20
+ +++ b/xpath.c
21
+ @@ -136,11 +136,48 @@
22
+
23
+ #if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
24
+
25
+ -/************************************************************************
26
+ - * *
27
+ - * Floating point stuff *
28
+ - * *
29
+ - ************************************************************************/
30
+ +static void
31
+ +xmlXPathNameFunction(xmlXPathParserContextPtr ctxt, int nargs);
32
+ +
33
+ +static const struct {
34
+ + const char *name;
35
+ + xmlXPathFunction func;
36
+ +} xmlXPathStandardFunctions[] = {
37
+ + { "boolean", xmlXPathBooleanFunction },
38
+ + { "ceiling", xmlXPathCeilingFunction },
39
+ + { "count", xmlXPathCountFunction },
40
+ + { "concat", xmlXPathConcatFunction },
41
+ + { "contains", xmlXPathContainsFunction },
42
+ + { "id", xmlXPathIdFunction },
43
+ + { "false", xmlXPathFalseFunction },
44
+ + { "floor", xmlXPathFloorFunction },
45
+ + { "last", xmlXPathLastFunction },
46
+ + { "lang", xmlXPathLangFunction },
47
+ + { "local-name", xmlXPathLocalNameFunction },
48
+ + { "not", xmlXPathNotFunction },
49
+ + { "name", xmlXPathNameFunction },
50
+ + { "namespace-uri", xmlXPathNamespaceURIFunction },
51
+ + { "normalize-space", xmlXPathNormalizeFunction },
52
+ + { "number", xmlXPathNumberFunction },
53
+ + { "position", xmlXPathPositionFunction },
54
+ + { "round", xmlXPathRoundFunction },
55
+ + { "string", xmlXPathStringFunction },
56
+ + { "string-length", xmlXPathStringLengthFunction },
57
+ + { "starts-with", xmlXPathStartsWithFunction },
58
+ + { "substring", xmlXPathSubstringFunction },
59
+ + { "substring-before", xmlXPathSubstringBeforeFunction },
60
+ + { "substring-after", xmlXPathSubstringAfterFunction },
61
+ + { "sum", xmlXPathSumFunction },
62
+ + { "true", xmlXPathTrueFunction },
63
+ + { "translate", xmlXPathTranslateFunction }
64
+ +};
65
+ +
66
+ +#define NUM_STANDARD_FUNCTIONS \
67
+ + (sizeof(xmlXPathStandardFunctions) / sizeof(xmlXPathStandardFunctions[0]))
68
+ +
69
+ +#define SF_HASH_SIZE 64
70
+ +
71
+ +static unsigned char xmlXPathSFHash[SF_HASH_SIZE];
72
+
73
+ double xmlXPathNAN = 0.0;
74
+ double xmlXPathPINF = 0.0;
75
+ @@ -156,6 +193,18 @@ xmlXPathInit(void) {
76
+ xmlInitParser();
77
+ }
78
+
79
+ +ATTRIBUTE_NO_SANITIZE_INTEGER
80
+ +static unsigned
81
+ +xmlXPathSFComputeHash(const xmlChar *name) {
82
+ + unsigned hashValue = 5381;
83
+ + const xmlChar *ptr;
84
+ +
85
+ + for (ptr = name; *ptr; ptr++)
86
+ + hashValue = hashValue * 33 + *ptr;
87
+ +
88
+ + return(hashValue);
89
+ +}
90
+ +
91
+ /**
92
+ * xmlInitXPathInternal:
93
+ *
94
+ @@ -164,6 +213,8 @@ xmlXPathInit(void) {
95
+ ATTRIBUTE_NO_SANITIZE("float-divide-by-zero")
96
+ void
97
+ xmlInitXPathInternal(void) {
98
+ + size_t i;
99
+ +
100
+ #if defined(NAN) && defined(INFINITY)
101
+ xmlXPathNAN = NAN;
102
+ xmlXPathPINF = INFINITY;
103
+ @@ -175,8 +226,34 @@ xmlInitXPathInternal(void) {
104
+ xmlXPathPINF = 1.0 / zero;
105
+ xmlXPathNINF = -xmlXPathPINF;
106
+ #endif
107
+ +
108
+ + /*
109
+ + * Initialize hash table for standard functions
110
+ + */
111
+ +
112
+ + for (i = 0; i < SF_HASH_SIZE; i++)
113
+ + xmlXPathSFHash[i] = UCHAR_MAX;
114
+ +
115
+ + for (i = 0; i < NUM_STANDARD_FUNCTIONS; i++) {
116
+ + const char *name = xmlXPathStandardFunctions[i].name;
117
+ + int bucketIndex = xmlXPathSFComputeHash(BAD_CAST name) % SF_HASH_SIZE;
118
+ +
119
+ + while (xmlXPathSFHash[bucketIndex] != UCHAR_MAX) {
120
+ + bucketIndex += 1;
121
+ + if (bucketIndex >= SF_HASH_SIZE)
122
+ + bucketIndex = 0;
123
+ + }
124
+ +
125
+ + xmlXPathSFHash[bucketIndex] = i;
126
+ + }
127
+ }
128
+
129
+ +/************************************************************************
130
+ + * *
131
+ + * Floating point stuff *
132
+ + * *
133
+ + ************************************************************************/
134
+ +
135
+ /**
136
+ * xmlXPathIsNaN:
137
+ * @val: a double value
138
+ @@ -3979,18 +4056,6 @@ xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt,
139
+ */
140
+ xmlXPathFunction
141
+ xmlXPathFunctionLookup(xmlXPathContextPtr ctxt, const xmlChar *name) {
142
+ - if (ctxt == NULL)
143
+ - return (NULL);
144
+ -
145
+ - if (ctxt->funcLookupFunc != NULL) {
146
+ - xmlXPathFunction ret;
147
+ - xmlXPathFuncLookupFunc f;
148
+ -
149
+ - f = ctxt->funcLookupFunc;
150
+ - ret = f(ctxt->funcLookupData, name, NULL);
151
+ - if (ret != NULL)
152
+ - return(ret);
153
+ - }
154
+ return(xmlXPathFunctionLookupNS(ctxt, name, NULL));
155
+ }
156
+
157
+ @@ -4015,6 +4080,22 @@ xmlXPathFunctionLookupNS(xmlXPathContextPtr ctxt, const xmlChar *name,
158
+ if (name == NULL)
159
+ return(NULL);
160
+
161
+ + if (ns_uri == NULL) {
162
+ + int bucketIndex = xmlXPathSFComputeHash(name) % SF_HASH_SIZE;
163
+ +
164
+ + while (xmlXPathSFHash[bucketIndex] != UCHAR_MAX) {
165
+ + int funcIndex = xmlXPathSFHash[bucketIndex];
166
+ +
167
+ + if (strcmp(xmlXPathStandardFunctions[funcIndex].name,
168
+ + (char *) name) == 0)
169
+ + return(xmlXPathStandardFunctions[funcIndex].func);
170
+ +
171
+ + bucketIndex += 1;
172
+ + if (bucketIndex >= SF_HASH_SIZE)
173
+ + bucketIndex = 0;
174
+ + }
175
+ + }
176
+ +
177
+ if (ctxt->funcLookupFunc != NULL) {
178
+ xmlXPathFuncLookupFunc f;
179
+
180
+ @@ -13494,61 +13575,6 @@ xmlXPathEscapeUriFunction(xmlXPathParserContextPtr ctxt, int nargs) {
181
+ void
182
+ xmlXPathRegisterAllFunctions(xmlXPathContextPtr ctxt)
183
+ {
184
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"boolean",
185
+ - xmlXPathBooleanFunction);
186
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"ceiling",
187
+ - xmlXPathCeilingFunction);
188
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"count",
189
+ - xmlXPathCountFunction);
190
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"concat",
191
+ - xmlXPathConcatFunction);
192
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"contains",
193
+ - xmlXPathContainsFunction);
194
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"id",
195
+ - xmlXPathIdFunction);
196
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"false",
197
+ - xmlXPathFalseFunction);
198
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"floor",
199
+ - xmlXPathFloorFunction);
200
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"last",
201
+ - xmlXPathLastFunction);
202
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"lang",
203
+ - xmlXPathLangFunction);
204
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"local-name",
205
+ - xmlXPathLocalNameFunction);
206
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"not",
207
+ - xmlXPathNotFunction);
208
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"name",
209
+ - xmlXPathNameFunction);
210
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"namespace-uri",
211
+ - xmlXPathNamespaceURIFunction);
212
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"normalize-space",
213
+ - xmlXPathNormalizeFunction);
214
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"number",
215
+ - xmlXPathNumberFunction);
216
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"position",
217
+ - xmlXPathPositionFunction);
218
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"round",
219
+ - xmlXPathRoundFunction);
220
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"string",
221
+ - xmlXPathStringFunction);
222
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"string-length",
223
+ - xmlXPathStringLengthFunction);
224
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"starts-with",
225
+ - xmlXPathStartsWithFunction);
226
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"substring",
227
+ - xmlXPathSubstringFunction);
228
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"substring-before",
229
+ - xmlXPathSubstringBeforeFunction);
230
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"substring-after",
231
+ - xmlXPathSubstringAfterFunction);
232
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"sum",
233
+ - xmlXPathSumFunction);
234
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"true",
235
+ - xmlXPathTrueFunction);
236
+ - xmlXPathRegisterFunc(ctxt, (const xmlChar *)"translate",
237
+ - xmlXPathTranslateFunction);
238
+ -
239
+ xmlXPathRegisterFuncNS(ctxt, (const xmlChar *)"escape-uri",
240
+ (const xmlChar *)"http://www.w3.org/2002/08/xquery-functions",
241
+ xmlXPathEscapeUriFunction);
242
+ --
243
+ 2.47.1
244
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nokogiri
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.17.2
4
+ version: 1.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Dalessio
@@ -20,7 +20,7 @@ authors:
20
20
  autorequire:
21
21
  bindir: bin
22
22
  cert_chain: []
23
- date: 2024-12-12 00:00:00.000000000 Z
23
+ date: 2024-12-25 00:00:00.000000000 Z
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: mini_portile2
@@ -272,6 +272,7 @@ files:
272
272
  - patches/libxml2/0009-allow-wildcard-namespaces.patch
273
273
  - patches/libxml2/0010-update-config.guess-and-config.sub-for-libxml2.patch
274
274
  - patches/libxml2/0011-rip-out-libxml2-s-libc_single_threaded-support.patch
275
+ - patches/libxml2/0019-xpath-Use-separate-static-hash-table-for-standard-fu.patch
275
276
  - patches/libxslt/0001-update-config.guess-and-config.sub-for-libxslt.patch
276
277
  - ports/archives/libxml2-2.13.5.tar.xz
277
278
  - ports/archives/libxslt-1.1.42.tar.xz
@@ -295,14 +296,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
295
296
  requirements:
296
297
  - - ">="
297
298
  - !ruby/object:Gem::Version
298
- version: 3.0.0
299
+ version: 3.1.0
299
300
  required_rubygems_version: !ruby/object:Gem::Requirement
300
301
  requirements:
301
302
  - - ">="
302
303
  - !ruby/object:Gem::Version
303
304
  version: '0'
304
305
  requirements: []
305
- rubygems_version: 3.3.22
306
+ rubygems_version: 3.5.11
306
307
  signing_key:
307
308
  specification_version: 4
308
309
  summary: Nokogiri (鋸) makes it easy and painless to work with XML and HTML from Ruby.