Skip to content

Commit 3ba0c02

Browse files
committed
Append .html to pages ending in a dot
You are not supposed to end URL's with a dot
1 parent 8da79bb commit 3ba0c02

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lib/Pod/Htmlify.pm6

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ sub rewrite-url($s) is export {
4848
# on-page link, we bail
4949
return $s;
5050
}
51-
51+
# Type
5252
when / ^ <[A..Z]> / {
5353
$r = "/type/{escape-filename(unescape-percent($s))}";
5454
succeed;
5555
}
56-
56+
# Routine
5757
when / ^ <[a..z]> | ^ <-alpha>* $ / {
5858
$r = "/routine/{escape-filename(unescape-percent($s))}";
5959
succeed;
@@ -77,7 +77,10 @@ sub rewrite-url($s) is export {
7777

7878
my $file-part = $r.split('#')[0] ~ '.html';
7979
die "$file-part not found" unless $file-part.IO:e:f:s;
80-
80+
# URL's can't end with a period. So affix the suffix.
81+
if $r.contains('#').not and $r.ends-with: '.' {
82+
$r ~= '.html';
83+
}
8184
return %cache{$s} = $r;
8285
}
8386

0 commit comments

Comments
 (0)