selma 0.4.8 → 0.4.9

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: 74c02fca447133f8f9095a4b0f8528081896324b0d8afd4a8853755c4d706902
4
- data.tar.gz: 13e5eb7a79ac52229e7859c08a6bc3cdd94a194b7caea97281e8c65150768916
3
+ metadata.gz: 9470897ee5c29d09763cfbbe3fb70486b0efc76594abdbeae188a4b6d1db3917
4
+ data.tar.gz: 7df5c4a23af18df2cb483165a0e6631447da9ca5ea7f0c76270c2830e15bf8d9
5
5
  SHA512:
6
- metadata.gz: 5bc3b580ff6859e4989af13ad8d75f57b4fcbfdfbde4285d5c18d125c61791d5cfa8514471275fb1dfe365d73b1429ce427899e845e4203ceedebccf36105caa
7
- data.tar.gz: cb7ce2dd135d8ee2b501b6d0e7d626fe386cdd61c92787af0904dfc1b4037a7c9d02764237e62019aee33aac0df4840562e3faddd08dcf06a284abc5f4329338
6
+ metadata.gz: a7639b57eccda8352ff85a502aa56e3e3c0e7bfeb0381648562aae290f65f4a31a4e794797e3dc522ed3e445449463e922b79fcc89f71e769dc5f7e53933f7b8
7
+ data.tar.gz: 7db5811dbf01678d5033ac045001702c3195eba10d23183598f60bf40686f8be6e28f5e76517f7da3984972d6b530ee3e9d498f4f8a3f0f111d06806dde34c61
data/Cargo.lock CHANGED
@@ -284,9 +284,9 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
284
284
 
285
285
  [[package]]
286
286
  name = "lol_html"
287
- version = "1.2.1"
287
+ version = "2.0.0"
288
288
  source = "registry+https://github.com/rust-lang/crates.io-index"
289
- checksum = "a4629ff9c2deeb7aad9b2d0f379fc41937a02f3b739f007732c46af40339dee5"
289
+ checksum = "964b47c14635e111f7efddcd8f1f8794195f66225fef19822fa942b217a859cf"
290
290
  dependencies = [
291
291
  "bitflags 2.6.0",
292
292
  "cfg-if",
data/ext/selma/Cargo.toml CHANGED
@@ -12,7 +12,7 @@ magnus = { version = "0.7", features = ["rb-sys"] }
12
12
  rb-sys = { version = "*", default-features = false, features = [
13
13
  "stable-api-compiled-fallback",
14
14
  ] }
15
- lol_html = "1.2"
15
+ lol_html = "2.0"
16
16
 
17
17
  [lib]
18
18
  name = "selma"
@@ -350,11 +350,11 @@ impl SelmaRewriter {
350
350
  }
351
351
  }
352
352
 
353
- pub fn perform_handler_rewrite(
353
+ pub fn perform_handler_rewrite<'a>(
354
354
  &self,
355
- sanitizer_document_content_handlers: Vec<DocumentContentHandlers>,
356
- sanitizer_element_content_handlers: Vec<(Cow<Selector>, ElementContentHandlers)>,
357
- handlers: &[Handler],
355
+ sanitizer_document_content_handlers: Vec<DocumentContentHandlers<'a>>,
356
+ sanitizer_element_content_handlers: Vec<(Cow<Selector>, ElementContentHandlers<'a>)>,
357
+ handlers: &'a [Handler],
358
358
  html: String,
359
359
  ) -> Result<Vec<u8>, magnus::Error> {
360
360
  // TODO: this should ideally be done ahead of time on `initialize`, not on every `#rewrite` call
@@ -431,10 +431,12 @@ impl SelmaRewriter {
431
431
  let closure_element_stack = element_stack.clone();
432
432
 
433
433
  if let Some(end_tag_handlers) = el.end_tag_handlers() {
434
- end_tag_handlers.push(Box::new(move |_end_tag| {
435
- closure_element_stack.as_ref().borrow_mut().pop();
436
- Ok(())
437
- }));
434
+ end_tag_handlers.push(lol_html::EndTagHandler::into(Box::new(
435
+ move |_end_tag| {
436
+ closure_element_stack.as_ref().borrow_mut().pop();
437
+ Ok(())
438
+ },
439
+ )));
438
440
  }
439
441
 
440
442
  Ok(())
@@ -449,10 +451,10 @@ impl SelmaRewriter {
449
451
  )
450
452
  }
451
453
 
452
- fn run_rewrite(
454
+ fn run_rewrite<'a>(
453
455
  &self,
454
- document_content_handlers: Vec<DocumentContentHandlers>,
455
- element_content_handlers: Vec<(Cow<Selector>, ElementContentHandlers)>,
456
+ document_content_handlers: Vec<DocumentContentHandlers<'a>>,
457
+ element_content_handlers: Vec<(Cow<Selector>, ElementContentHandlers<'a>)>,
456
458
  html: &[u8],
457
459
  ) -> Result<Vec<u8>, magnus::Error> {
458
460
  let binding = &self.0.borrow();
data/lib/selma/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Selma
4
- VERSION = "0.4.8"
4
+ VERSION = "0.4.9"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: selma
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garen J. Torikian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-08 00:00:00.000000000 Z
11
+ date: 2024-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys