Skip to content

Commit f382bbc

Browse files
committed
add caching for link-rewrite
1 parent 412f6c0 commit f382bbc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/Pod/Htmlify.pm6

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ constant badchars = qw[$ / \ . % ? & = # + " ' : ~ < >];
1818
my \goodnames = badchars.map: '$' ~ *.uniname.subst(' ', '_', :g);
1919
constant length = badchars.elems;
2020

21-
sub escape-filename($s is copy) is export {
21+
use experimental :cached;
22+
23+
sub escape-filename($s is copy) is export is cached {
2224
# return $s if $s ~~ m{^ <[a..z]>+ '://'}; # bail on external links
2325

2426
loop (my int $i = 0;$i < length;$i++) {
@@ -28,7 +30,7 @@ sub escape-filename($s is copy) is export {
2830
$s
2931
}
3032

31-
sub rewrite-url($s) is export {
33+
sub rewrite-url($s) is export is cached {
3234
my Str $r;
3335
given $s {
3436
when / ^ [ 'http' | 'https' | 'irc' ] '://' / {

0 commit comments

Comments
 (0)