Skip to content

Commit 901db16

Browse files
committed
unescape some uri-escaped bits before filename-escaping
1 parent c7e0805 commit 901db16

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

lib/Pod/Htmlify.pm6

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,22 @@ sub rewrite-url($s) is export {
4141
return $s;
4242
}
4343

44+
when / ^ <[A..Z]> / {
45+
$r = "/type/{uri_unescape($s)}";
46+
succeed;
47+
}
48+
49+
when / ^ <[a..z]> | ^ <-alpha>* $ / {
50+
$r = "/routine/{uri_unescape($s)}";
51+
succeed;
52+
}
53+
4454
# special case the really nasty ones
4555
when / ^ '/routine//' $ / { return '/routine/' ~ escape-filename('/'); succeed; }
4656
when / ^ '/routine///' $ / { return '/routine/' ~ escape-filename('//'); succeed; }
4757

4858
when / ^ ([ '/routine/' | '/syntax/' | '/language/' | '/programs/' | '/type/' ]) (<-[#/]>+) [ ('#') (<-[/#]>+) ]* $ / {
49-
$r = $0 ~ escape-filename($1) ~ $2 ~ uri_escape($3);
59+
$r = $0 ~ escape-filename(uri_unescape($1)) ~ $2 ~ uri_escape($3);
5060
succeed;
5161
}
5262

@@ -58,7 +68,6 @@ sub rewrite-url($s) is export {
5868
}
5969

6070
my $file-part = $r.split('#')[0] ~ '.html';
61-
6271
die "$file-part not found" unless $file-part.IO:e:f:s;
6372

6473
return $r;

0 commit comments

Comments
 (0)