This relies for its correctness on %config, %hooks and pagetype() not
changing.
sub pagename ($) {
my $file=shift;
sub pagename ($) {
my $file=shift;
+ if (exists $pagename_cache{$file}) {
+ return $pagename_cache{$file};
+ }
+
my $type=pagetype($file);
my $page=$file;
$page=~s/\Q.$type\E*$//
my $type=pagetype($file);
my $page=$file;
$page=~s/\Q.$type\E*$//
if ($config{indexpages} && $page=~/(.*)\/index$/) {
$page=$1;
}
if ($config{indexpages} && $page=~/(.*)\/index$/) {
$page=$1;
}
+
+ $pagename_cache{$file} = $page;