fix page source storing

This saves space, and stores the data under the right keys.
master
Joey Hess 2008-03-21 14:42:59 -04:00
parent e3866fd94f
commit 5d9ed614db
1 changed files with 8 additions and 7 deletions

View File

@ -914,12 +914,13 @@ sub loadindex () { #{{{
return 0; return 0;
} }
my %index=%$ret; my %index=%$ret;
foreach my $page (keys %index) { foreach my $src (keys %index) {
my %d=%{$index{$page}}; my %d=%{$index{$src}};
my $page=pagename($src);
$pagectime{$page}=$d{ctime}; $pagectime{$page}=$d{ctime};
if (! $config{rebuild}) { if (! $config{rebuild}) {
$pagesources{$page}=$src;
$pagemtime{$page}=$d{mtime}; $pagemtime{$page}=$d{mtime};
$pagesources{$page}=$d{src};
$renderedfiles{$page}=$d{dest}; $renderedfiles{$page}=$d{dest};
if (exists $d{links} && ref $d{links}) { if (exists $d{links} && ref $d{links}) {
$links{$page}=$d{links}; $links{$page}=$d{links};
@ -961,23 +962,23 @@ sub saveindex () { #{{{
my %index; my %index;
foreach my $page (keys %pagemtime) { foreach my $page (keys %pagemtime) {
next unless $pagemtime{$page}; next unless $pagemtime{$page};
my $src=$pagesources{$page};
$index{$page}={ $index{$src}={
ctime => $pagectime{$page}, ctime => $pagectime{$page},
mtime => $pagemtime{$page}, mtime => $pagemtime{$page},
src => $pagesources{$page},
dest => $renderedfiles{$page}, dest => $renderedfiles{$page},
links => $links{$page}, links => $links{$page},
}; };
if (exists $depends{$page}) { if (exists $depends{$page}) {
$index{$page}{depends} = $depends{$page}; $index{$src}{depends} = $depends{$page};
} }
if (exists $pagestate{$page}) { if (exists $pagestate{$page}) {
foreach my $id (@hookids) { foreach my $id (@hookids) {
foreach my $key (keys %{$pagestate{$page}{$id}}) { foreach my $key (keys %{$pagestate{$page}{$id}}) {
$index{$page}{state}{$id}{$key}=$pagestate{$page}{$id}{$key}; $index{$src}{state}{$id}{$key}=$pagestate{$page}{$id}{$key};
} }
} }
} }