selma 0.4.9 → 0.4.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Cargo.lock +69 -73
- data/README.md +48 -46
- data/ext/selma/Cargo.toml +1 -1
- data/ext/selma/src/rewriter.rs +3 -3
- data/lib/selma/version.rb +1 -1
- metadata +5 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae851f7bc424c7fc5e023632b3faa7b277877c6cadf87cc7f62522395d840c31
|
4
|
+
data.tar.gz: 7ddf1ec6fcba33124266e8a42bf2e15377e8daabd15854e6d5b16279b25f77c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 026d9ca139227477365dabd422caf691926fdf09d8b7bf35a80274669de344b3d7d0e98872e4b099ccd9bf28da3343f67a2aed3a0c0a3ae8582585d489820829
|
7
|
+
data.tar.gz: 2b993bc1be6cf561ad54bd77d1c327e57e2e77ba41865fe3fca479849a6c375868c3c82eb10733964a0347d36715715095763ebda94fae416f4d66efe31f92e9
|
data/Cargo.lock
CHANGED
@@ -2,18 +2,6 @@
|
|
2
2
|
# It is not intended for manual editing.
|
3
3
|
version = 3
|
4
4
|
|
5
|
-
[[package]]
|
6
|
-
name = "ahash"
|
7
|
-
version = "0.8.11"
|
8
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
9
|
-
checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011"
|
10
|
-
dependencies = [
|
11
|
-
"cfg-if",
|
12
|
-
"once_cell",
|
13
|
-
"version_check",
|
14
|
-
"zerocopy",
|
15
|
-
]
|
16
|
-
|
17
5
|
[[package]]
|
18
6
|
name = "aho-corasick"
|
19
7
|
version = "1.1.3"
|
@@ -23,11 +11,17 @@ dependencies = [
|
|
23
11
|
"memchr",
|
24
12
|
]
|
25
13
|
|
14
|
+
[[package]]
|
15
|
+
name = "allocator-api2"
|
16
|
+
version = "0.2.21"
|
17
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
18
|
+
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
19
|
+
|
26
20
|
[[package]]
|
27
21
|
name = "bindgen"
|
28
|
-
version = "0.69.
|
22
|
+
version = "0.69.5"
|
29
23
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
30
|
-
checksum = "
|
24
|
+
checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
|
31
25
|
dependencies = [
|
32
26
|
"bitflags 2.6.0",
|
33
27
|
"cexpr",
|
@@ -40,7 +34,7 @@ dependencies = [
|
|
40
34
|
"regex",
|
41
35
|
"rustc-hash",
|
42
36
|
"shlex",
|
43
|
-
"syn 2.0.
|
37
|
+
"syn 2.0.93",
|
44
38
|
]
|
45
39
|
|
46
40
|
[[package]]
|
@@ -117,7 +111,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
117
111
|
checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331"
|
118
112
|
dependencies = [
|
119
113
|
"quote",
|
120
|
-
"syn 2.0.
|
114
|
+
"syn 2.0.93",
|
121
115
|
]
|
122
116
|
|
123
117
|
[[package]]
|
@@ -130,7 +124,7 @@ dependencies = [
|
|
130
124
|
"proc-macro2",
|
131
125
|
"quote",
|
132
126
|
"rustc_version",
|
133
|
-
"syn 2.0.
|
127
|
+
"syn 2.0.93",
|
134
128
|
]
|
135
129
|
|
136
130
|
[[package]]
|
@@ -156,9 +150,9 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"
|
|
156
150
|
|
157
151
|
[[package]]
|
158
152
|
name = "encoding_rs"
|
159
|
-
version = "0.8.
|
153
|
+
version = "0.8.35"
|
160
154
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
161
|
-
checksum = "
|
155
|
+
checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
|
162
156
|
dependencies = [
|
163
157
|
"cfg-if",
|
164
158
|
]
|
@@ -186,9 +180,15 @@ checksum = "a1ab991c1362ac86c61ab6f556cff143daa22e5a15e4e189df818b2fd19fe65b"
|
|
186
180
|
dependencies = [
|
187
181
|
"proc-macro2",
|
188
182
|
"quote",
|
189
|
-
"syn 2.0.
|
183
|
+
"syn 2.0.93",
|
190
184
|
]
|
191
185
|
|
186
|
+
[[package]]
|
187
|
+
name = "equivalent"
|
188
|
+
version = "1.0.1"
|
189
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
190
|
+
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
|
191
|
+
|
192
192
|
[[package]]
|
193
193
|
name = "escapist"
|
194
194
|
version = "0.0.2"
|
@@ -198,6 +198,12 @@ dependencies = [
|
|
198
198
|
"entities",
|
199
199
|
]
|
200
200
|
|
201
|
+
[[package]]
|
202
|
+
name = "foldhash"
|
203
|
+
version = "0.1.4"
|
204
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
205
|
+
checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f"
|
206
|
+
|
201
207
|
[[package]]
|
202
208
|
name = "fxhash"
|
203
209
|
version = "0.2.1"
|
@@ -220,17 +226,19 @@ dependencies = [
|
|
220
226
|
|
221
227
|
[[package]]
|
222
228
|
name = "glob"
|
223
|
-
version = "0.3.
|
229
|
+
version = "0.3.2"
|
224
230
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
225
|
-
checksum = "
|
231
|
+
checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
|
226
232
|
|
227
233
|
[[package]]
|
228
234
|
name = "hashbrown"
|
229
|
-
version = "0.
|
235
|
+
version = "0.15.2"
|
230
236
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
231
|
-
checksum = "
|
237
|
+
checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289"
|
232
238
|
dependencies = [
|
233
|
-
"
|
239
|
+
"allocator-api2",
|
240
|
+
"equivalent",
|
241
|
+
"foldhash",
|
234
242
|
]
|
235
243
|
|
236
244
|
[[package]]
|
@@ -262,15 +270,15 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
|
|
262
270
|
|
263
271
|
[[package]]
|
264
272
|
name = "libc"
|
265
|
-
version = "0.2.
|
273
|
+
version = "0.2.169"
|
266
274
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
267
|
-
checksum = "
|
275
|
+
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
|
268
276
|
|
269
277
|
[[package]]
|
270
278
|
name = "libloading"
|
271
|
-
version = "0.8.
|
279
|
+
version = "0.8.6"
|
272
280
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
273
|
-
checksum = "
|
281
|
+
checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34"
|
274
282
|
dependencies = [
|
275
283
|
"cfg-if",
|
276
284
|
"windows-targets",
|
@@ -284,9 +292,9 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"
|
|
284
292
|
|
285
293
|
[[package]]
|
286
294
|
name = "lol_html"
|
287
|
-
version = "2.
|
295
|
+
version = "2.1.0"
|
288
296
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
289
|
-
checksum = "
|
297
|
+
checksum = "2872b88213f3cd4b04f719ec8f2e0b37c98882a7c4aa6fc13ba2f19f5eba1bd2"
|
290
298
|
dependencies = [
|
291
299
|
"bitflags 2.6.0",
|
292
300
|
"cfg-if",
|
@@ -321,7 +329,7 @@ checksum = "5968c820e2960565f647819f5928a42d6e874551cab9d88d75e3e0660d7f71e3"
|
|
321
329
|
dependencies = [
|
322
330
|
"proc-macro2",
|
323
331
|
"quote",
|
324
|
-
"syn 2.0.
|
332
|
+
"syn 2.0.93",
|
325
333
|
]
|
326
334
|
|
327
335
|
[[package]]
|
@@ -364,12 +372,6 @@ dependencies = [
|
|
364
372
|
"minimal-lexical",
|
365
373
|
]
|
366
374
|
|
367
|
-
[[package]]
|
368
|
-
name = "once_cell"
|
369
|
-
version = "1.19.0"
|
370
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
371
|
-
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
372
|
-
|
373
375
|
[[package]]
|
374
376
|
name = "phf"
|
375
377
|
version = "0.8.0"
|
@@ -447,18 +449,18 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
|
|
447
449
|
|
448
450
|
[[package]]
|
449
451
|
name = "proc-macro2"
|
450
|
-
version = "1.0.
|
452
|
+
version = "1.0.92"
|
451
453
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
452
|
-
checksum = "
|
454
|
+
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
|
453
455
|
dependencies = [
|
454
456
|
"unicode-ident",
|
455
457
|
]
|
456
458
|
|
457
459
|
[[package]]
|
458
460
|
name = "quote"
|
459
|
-
version = "1.0.
|
461
|
+
version = "1.0.38"
|
460
462
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
461
|
-
checksum = "
|
463
|
+
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
|
462
464
|
dependencies = [
|
463
465
|
"proc-macro2",
|
464
466
|
]
|
@@ -516,18 +518,18 @@ dependencies = [
|
|
516
518
|
|
517
519
|
[[package]]
|
518
520
|
name = "rb-sys"
|
519
|
-
version = "0.9.
|
521
|
+
version = "0.9.105"
|
520
522
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
521
|
-
checksum = "
|
523
|
+
checksum = "4b3a1f3ce8e7c36d777d52fe7a99039fe4fea7c8ec355a4c4f3a17f92a14029f"
|
522
524
|
dependencies = [
|
523
525
|
"rb-sys-build",
|
524
526
|
]
|
525
527
|
|
526
528
|
[[package]]
|
527
529
|
name = "rb-sys-build"
|
528
|
-
version = "0.9.
|
530
|
+
version = "0.9.105"
|
529
531
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
530
|
-
checksum = "
|
532
|
+
checksum = "3e6b246c29c0809e1cbe60a1ba9e093da72a4676d02adc68469297d1e589bbf0"
|
531
533
|
dependencies = [
|
532
534
|
"bindgen",
|
533
535
|
"lazy_static",
|
@@ -535,7 +537,7 @@ dependencies = [
|
|
535
537
|
"quote",
|
536
538
|
"regex",
|
537
539
|
"shell-words",
|
538
|
-
"syn 2.0.
|
540
|
+
"syn 2.0.93",
|
539
541
|
]
|
540
542
|
|
541
543
|
[[package]]
|
@@ -546,9 +548,9 @@ checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb"
|
|
546
548
|
|
547
549
|
[[package]]
|
548
550
|
name = "regex"
|
549
|
-
version = "1.
|
551
|
+
version = "1.11.1"
|
550
552
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
551
|
-
checksum = "
|
553
|
+
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
552
554
|
dependencies = [
|
553
555
|
"aho-corasick",
|
554
556
|
"memchr",
|
@@ -558,9 +560,9 @@ dependencies = [
|
|
558
560
|
|
559
561
|
[[package]]
|
560
562
|
name = "regex-automata"
|
561
|
-
version = "0.4.
|
563
|
+
version = "0.4.9"
|
562
564
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
563
|
-
checksum = "
|
565
|
+
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
564
566
|
dependencies = [
|
565
567
|
"aho-corasick",
|
566
568
|
"memchr",
|
@@ -569,9 +571,9 @@ dependencies = [
|
|
569
571
|
|
570
572
|
[[package]]
|
571
573
|
name = "regex-syntax"
|
572
|
-
version = "0.8.
|
574
|
+
version = "0.8.5"
|
573
575
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
574
|
-
checksum = "
|
576
|
+
checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c"
|
575
577
|
|
576
578
|
[[package]]
|
577
579
|
name = "rustc-hash"
|
@@ -581,9 +583,9 @@ checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
|
581
583
|
|
582
584
|
[[package]]
|
583
585
|
name = "rustc_version"
|
584
|
-
version = "0.4.
|
586
|
+
version = "0.4.1"
|
585
587
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
586
|
-
checksum = "
|
588
|
+
checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
|
587
589
|
dependencies = [
|
588
590
|
"semver",
|
589
591
|
]
|
@@ -621,9 +623,9 @@ dependencies = [
|
|
621
623
|
|
622
624
|
[[package]]
|
623
625
|
name = "semver"
|
624
|
-
version = "1.0.
|
626
|
+
version = "1.0.24"
|
625
627
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
626
|
-
checksum = "
|
628
|
+
checksum = "3cb6eb87a131f756572d7fb904f6e7b68633f09cca868c5df1c4b8d1a694bbba"
|
627
629
|
|
628
630
|
[[package]]
|
629
631
|
name = "seq-macro"
|
@@ -684,9 +686,9 @@ dependencies = [
|
|
684
686
|
|
685
687
|
[[package]]
|
686
688
|
name = "syn"
|
687
|
-
version = "2.0.
|
689
|
+
version = "2.0.93"
|
688
690
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
689
|
-
checksum = "
|
691
|
+
checksum = "9c786062daee0d6db1132800e623df74274a0a87322d8e183338e01b3d98d058"
|
690
692
|
dependencies = [
|
691
693
|
"proc-macro2",
|
692
694
|
"quote",
|
@@ -701,35 +703,29 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"
|
|
701
703
|
|
702
704
|
[[package]]
|
703
705
|
name = "thiserror"
|
704
|
-
version = "1.0.
|
706
|
+
version = "1.0.69"
|
705
707
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
706
|
-
checksum = "
|
708
|
+
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
707
709
|
dependencies = [
|
708
710
|
"thiserror-impl",
|
709
711
|
]
|
710
712
|
|
711
713
|
[[package]]
|
712
714
|
name = "thiserror-impl"
|
713
|
-
version = "1.0.
|
715
|
+
version = "1.0.69"
|
714
716
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
715
|
-
checksum = "
|
717
|
+
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
716
718
|
dependencies = [
|
717
719
|
"proc-macro2",
|
718
720
|
"quote",
|
719
|
-
"syn 2.0.
|
721
|
+
"syn 2.0.93",
|
720
722
|
]
|
721
723
|
|
722
724
|
[[package]]
|
723
725
|
name = "unicode-ident"
|
724
|
-
version = "1.0.
|
725
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
726
|
-
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
|
727
|
-
|
728
|
-
[[package]]
|
729
|
-
name = "version_check"
|
730
|
-
version = "0.9.5"
|
726
|
+
version = "1.0.14"
|
731
727
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
732
|
-
checksum = "
|
728
|
+
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
|
733
729
|
|
734
730
|
[[package]]
|
735
731
|
name = "wasi"
|
@@ -819,5 +815,5 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e"
|
|
819
815
|
dependencies = [
|
820
816
|
"proc-macro2",
|
821
817
|
"quote",
|
822
|
-
"syn 2.0.
|
818
|
+
"syn 2.0.93",
|
823
819
|
]
|
data/README.md
CHANGED
@@ -134,7 +134,6 @@ The `Selma::Selector` object has three possible kwargs:
|
|
134
134
|
Here's an example for `handle_text_chunk` which changes strings in various elements which are _not_ `pre` or `code`:
|
135
135
|
|
136
136
|
```ruby
|
137
|
-
|
138
137
|
class MatchText
|
139
138
|
SELECTOR = Selma::Selector.new(match_text_within: "*", ignore_text_within: ["pre", "code"])
|
140
139
|
|
@@ -189,6 +188,7 @@ Selma::Rewriter.new(options: { memory: { max_allowed_memory_usage: 1_000_000 } }
|
|
189
188
|
```
|
190
189
|
|
191
190
|
The structure of the `memory` options looks like this:
|
191
|
+
|
192
192
|
```ruby
|
193
193
|
{
|
194
194
|
memory: {
|
@@ -215,43 +215,44 @@ input size = 25309 bytes, 0.03 MB
|
|
215
215
|
|
216
216
|
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
|
217
217
|
Warming up --------------------------------------
|
218
|
-
|
219
|
-
|
218
|
+
sanitize-sm 15.000 i/100ms
|
219
|
+
selma-sm 127.000 i/100ms
|
220
220
|
Calculating -------------------------------------
|
221
|
-
|
222
|
-
|
221
|
+
sanitize-sm 157.643 (± 1.9%) i/s - 4.740k in 30.077172s
|
222
|
+
selma-sm 1.278k (± 1.5%) i/s - 38.354k in 30.019722s
|
223
223
|
|
224
224
|
Comparison:
|
225
|
-
|
226
|
-
|
225
|
+
selma-sm: 1277.9 i/s
|
226
|
+
sanitize-sm: 157.6 i/s - 8.11x slower
|
227
227
|
|
228
228
|
input size = 86686 bytes, 0.09 MB
|
229
229
|
|
230
230
|
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
|
231
231
|
Warming up --------------------------------------
|
232
|
-
|
233
|
-
|
232
|
+
sanitize-md 4.000 i/100ms
|
233
|
+
selma-md 33.000 i/100ms
|
234
234
|
Calculating -------------------------------------
|
235
|
-
|
236
|
-
|
235
|
+
sanitize-md 40.034 (± 5.0%) i/s - 1.200k in 30.043322s
|
236
|
+
selma-md 332.959 (± 2.1%) i/s - 9.999k in 30.045733s
|
237
237
|
|
238
238
|
Comparison:
|
239
|
-
|
240
|
-
|
239
|
+
selma-md: 333.0 i/s
|
240
|
+
sanitize-md: 40.0 i/s - 8.32x slower
|
241
241
|
|
242
242
|
input size = 7172510 bytes, 7.17 MB
|
243
243
|
|
244
244
|
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
|
245
245
|
Warming up --------------------------------------
|
246
|
-
|
247
|
-
|
246
|
+
sanitize-lg 1.000 i/100ms
|
247
|
+
selma-lg 1.000 i/100ms
|
248
248
|
Calculating -------------------------------------
|
249
|
-
|
250
|
-
|
249
|
+
sanitize-lg 0.141 (± 0.0%) i/s - 5.000 in 35.426127s
|
250
|
+
selma-lg 3.963 (± 0.0%) i/s - 119.000 in 30.037386s
|
251
251
|
|
252
252
|
Comparison:
|
253
|
-
|
254
|
-
|
253
|
+
selma-lg: 4.0 i/s
|
254
|
+
sanitize-lg: 0.1 i/s - 28.03x slower
|
255
|
+
|
255
256
|
</pre>
|
256
257
|
</details>
|
257
258
|
<!-- prettier-ignore-end -->
|
@@ -267,52 +268,53 @@ input size = 25309 bytes, 0.03 MB
|
|
267
268
|
|
268
269
|
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
|
269
270
|
Warming up --------------------------------------
|
270
|
-
|
271
|
-
|
272
|
-
|
271
|
+
nokogiri-sm 79.000 i/100ms
|
272
|
+
nokolexbor-sm 295.000 i/100ms
|
273
|
+
selma-sm 237.000 i/100ms
|
273
274
|
Calculating -------------------------------------
|
274
|
-
|
275
|
-
|
276
|
-
|
275
|
+
nokogiri-sm 800.531 (± 2.2%) i/s - 24.016k in 30.016056s
|
276
|
+
nokolexbor-sm 3.033k (± 3.6%) i/s - 91.155k in 30.094884s
|
277
|
+
selma-sm 2.386k (± 1.6%) i/s - 71.574k in 30.001701s
|
277
278
|
|
278
279
|
Comparison:
|
279
|
-
|
280
|
-
|
281
|
-
|
280
|
+
nokolexbor-sm: 3033.1 i/s
|
281
|
+
selma-sm: 2386.3 i/s - 1.27x slower
|
282
|
+
nokogiri-sm: 800.5 i/s - 3.79x slower
|
282
283
|
|
283
284
|
input size = 86686 bytes, 0.09 MB
|
284
285
|
|
285
286
|
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
|
286
287
|
Warming up --------------------------------------
|
287
|
-
|
288
|
-
|
289
|
-
|
288
|
+
nokogiri-md 8.000 i/100ms
|
289
|
+
nokolexbor-md 43.000 i/100ms
|
290
|
+
selma-md 38.000 i/100ms
|
290
291
|
Calculating -------------------------------------
|
291
|
-
|
292
|
-
|
293
|
-
|
292
|
+
nokogiri-md 85.013 (± 8.2%) i/s - 2.024k in 52.257472s
|
293
|
+
nokolexbor-md 416.074 (±11.1%) i/s - 12.341k in 30.111613s
|
294
|
+
selma-md 361.471 (± 4.7%) i/s - 10.830k in 30.033997s
|
294
295
|
|
295
296
|
Comparison:
|
296
|
-
|
297
|
-
|
298
|
-
|
297
|
+
nokolexbor-md: 416.1 i/s
|
298
|
+
selma-md: 361.5 i/s - same-ish: difference falls within error
|
299
|
+
nokogiri-md: 85.0 i/s - 4.89x slower
|
299
300
|
|
300
301
|
input size = 7172510 bytes, 7.17 MB
|
301
302
|
|
302
303
|
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [arm64-darwin23]
|
303
304
|
Warming up --------------------------------------
|
304
|
-
|
305
|
-
|
306
|
-
|
305
|
+
nokogiri-lg 1.000 i/100ms
|
306
|
+
nokolexbor-lg 1.000 i/100ms
|
307
|
+
selma-lg 1.000 i/100ms
|
307
308
|
Calculating -------------------------------------
|
308
|
-
|
309
|
-
|
310
|
-
|
309
|
+
nokogiri-lg 0.805 (± 0.0%) i/s - 25.000 in 31.148730s
|
310
|
+
nokolexbor-lg 2.194 (± 0.0%) i/s - 66.000 in 30.278108s
|
311
|
+
selma-lg 5.541 (± 0.0%) i/s - 166.000 in 30.037197s
|
311
312
|
|
312
313
|
Comparison:
|
313
|
-
|
314
|
-
|
315
|
-
|
314
|
+
selma-lg: 5.5 i/s
|
315
|
+
nokolexbor-lg: 2.2 i/s - 2.53x slower
|
316
|
+
nokogiri-lg: 0.8 i/s - 6.88x slower
|
317
|
+
|
316
318
|
</pre>
|
317
319
|
</details>
|
318
320
|
<!-- prettier-ignore-end -->
|
data/ext/selma/Cargo.toml
CHANGED
data/ext/selma/src/rewriter.rs
CHANGED
@@ -397,13 +397,13 @@ impl SelmaRewriter {
|
|
397
397
|
move |text| {
|
398
398
|
let element_stack = closure_element_stack.as_ref().borrow();
|
399
399
|
if selector.ignore_text_within().is_some() {
|
400
|
-
// check if current tag is a tag we should be ignoring text within
|
401
|
-
|
400
|
+
// check if current tag is a tag we should be ignoring text within;
|
401
|
+
// also checks if tag is within an ancestery of ignored tags
|
402
402
|
if selector
|
403
403
|
.ignore_text_within()
|
404
404
|
.unwrap()
|
405
405
|
.iter()
|
406
|
-
.any(|
|
406
|
+
.any(|t| element_stack.contains(t))
|
407
407
|
{
|
408
408
|
return Ok(());
|
409
409
|
}
|
data/lib/selma/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: selma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garen J. Torikian
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date: 2024-
|
10
|
+
date: 2024-12-29 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rb_sys
|
@@ -52,7 +51,6 @@ dependencies:
|
|
52
51
|
- - "~>"
|
53
52
|
- !ruby/object:Gem::Version
|
54
53
|
version: '1.2'
|
55
|
-
description:
|
56
54
|
email:
|
57
55
|
- gjtorikian@gmail.com
|
58
56
|
executables: []
|
@@ -90,7 +88,6 @@ files:
|
|
90
88
|
- lib/selma/sanitizer/config/restricted.rb
|
91
89
|
- lib/selma/selector.rb
|
92
90
|
- lib/selma/version.rb
|
93
|
-
homepage:
|
94
91
|
licenses:
|
95
92
|
- MIT
|
96
93
|
metadata:
|
@@ -98,7 +95,6 @@ metadata:
|
|
98
95
|
funding_uri: https://github.com/sponsors/gjtorikian/
|
99
96
|
source_code_uri: https://github.com/gjtorikian/selma
|
100
97
|
rubygems_mfa_required: 'true'
|
101
|
-
post_install_message:
|
102
98
|
rdoc_options: []
|
103
99
|
require_paths:
|
104
100
|
- lib
|
@@ -109,12 +105,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
105
|
version: '3.1'
|
110
106
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
107
|
requirements:
|
112
|
-
- - "
|
108
|
+
- - "~>"
|
113
109
|
- !ruby/object:Gem::Version
|
114
|
-
version: 3.
|
110
|
+
version: '3.4'
|
115
111
|
requirements: []
|
116
|
-
rubygems_version: 3.
|
117
|
-
signing_key:
|
112
|
+
rubygems_version: 3.6.2
|
118
113
|
specification_version: 4
|
119
114
|
summary: Selma selects and matches HTML nodes using CSS rules. Backed by Rust's lol_html
|
120
115
|
parser.
|