return;
}
+my %pagename_cache;
+
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*$//
if ($config{indexpages} && $page=~/(.*)\/index$/) {
$page=$1;
}
+
+ $pagename_cache{$file} = $page;
return $page;
}
$oldlinks{$page}=[@{$d->{links}}];
}
if (exists $d->{dependslist}) {
- $depends{$page}=$d->{dependslist};
+ $depends{$page}={
+ map { $_ => 1 } @{$d->{dependslist}}
+ };
}
elsif (exists $d->{depends}) {
- $depends{$page}=[$d->{depends}];
+ $depends{$page}={$d->{depends} => 1};
}
if (exists $d->{state}) {
$pagestate{$page}=$d->{state};
};
if (exists $depends{$page}) {
- $index{page}{$src}{dependslist} = $depends{$page};
+ $index{page}{$src}{dependslist} = [ keys %{$depends{$page}} ];
}
if (exists $pagestate{$page}) {
my $page=shift;
my $pagespec=shift;
- return unless pagespec_valid($pagespec);
-
- if (! exists $depends{$page}) {
- $depends{$page}=[$pagespec];
- }
- else {
- foreach my $p (@{$depends{$page}}) {
- return 1 if $p eq $pagespec;
+ if (ref $pagespec eq 'ARRAY') {
+ foreach my $ps (@$pagespec) {
+ if (pagespec_valid($ps)) {
+ $depends{$page}{$ps} = 1;
+ }
}
- push @{$depends{$page}}, $pagespec;
+ return;
}
+ return unless pagespec_valid($pagespec);
+
+ $depends{$page}{$pagespec} = 1;
return 1;
}