X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/d6d1d944964efe6ede8e0dedd953cdcdbfc53111..7bd7e78e4a7d31c460909776057687e0e29dba12:/IkiWiki.pm?ds=sidebyside diff --git a/IkiWiki.pm b/IkiWiki.pm index 43ffb1fd8..5563a03af 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -661,9 +661,15 @@ sub pagetype ($) { 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*$// @@ -672,6 +678,8 @@ sub pagename ($) { if ($config{indexpages} && $page=~/(.*)\/index$/) { $page=$1; } + + $pagename_cache{$file} = $page; return $page; } @@ -1507,8 +1515,13 @@ sub loadindex () { $links{$page}=$d->{links}; $oldlinks{$page}=[@{$d->{links}}]; } - if (exists $d->{depends}) { - $depends{$page}=$d->{depends}; + if (exists $d->{dependslist}) { + $depends{$page}={ + map { $_ => 1 } @{$d->{dependslist}} + }; + } + elsif (exists $d->{depends}) { + $depends{$page}={$d->{depends} => 1}; } if (exists $d->{state}) { $pagestate{$page}=$d->{state}; @@ -1554,7 +1567,7 @@ sub saveindex () { }; if (exists $depends{$page}) { - $index{page}{$src}{depends} = $depends{$page}; + $index{page}{$src}{dependslist} = [ keys %{$depends{$page}} ]; } if (exists $pagestate{$page}) { @@ -1724,16 +1737,10 @@ sub rcs_receive () { sub add_depends ($$) { my $page=shift; my $pagespec=shift; - - return unless pagespec_valid($pagespec); - if (! exists $depends{$page}) { - $depends{$page}=$pagespec; - } - else { - $depends{$page}=pagespec_merge($depends{$page}, $pagespec); - } + return unless pagespec_valid($pagespec); + $depends{$page}{$pagespec} = 1; return 1; } @@ -1817,14 +1824,6 @@ sub add_link ($$) { unless grep { $_ eq $link } @{$links{$page}}; } -sub pagespec_merge ($$) { - my $a=shift; - my $b=shift; - - return $a if $a eq $b; - return "($a) or ($b)"; -} - sub pagespec_translate ($) { my $spec=shift;