X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/ca366fc9025197a5d32034a446dc35b776101d78..72e8ace28d921bb533a617c4b4078d0fb532fe98:/ikiwiki diff --git a/ikiwiki b/ikiwiki index 5c708919a..9001c5e2a 100755 --- a/ikiwiki +++ b/ikiwiki @@ -8,7 +8,8 @@ use File::Spec; use HTML::Template; use lib '.'; # For use without installation, removed by Makefile. -use vars qw{%config %links %oldlinks %oldpagemtime %renderedfiles %pagesources}; +use vars qw{%config %links %oldlinks %oldpagemtime %pagectime + %renderedfiles %pagesources}; sub usage () { #{{{ die "usage: ikiwiki [options] source dest\n"; @@ -316,13 +317,20 @@ sub loadindex () { #{{{ while () { $_=possibly_foolish_untaint($_); chomp; - my ($mtime, $file, $rendered, @links)=split(' ', $_); - my $page=pagename($file); - $pagesources{$page}=$file; - $oldpagemtime{$page}=$mtime; - $oldlinks{$page}=[@links]; - $links{$page}=[@links]; - $renderedfiles{$page}=$rendered; + my %items; + $items{link}=[]; + foreach my $i (split(/ /, $_)) { + my ($item, $val)=split(/=/, $i, 2); + push @{$items{$item}}, $val; + } + + my $page=pagename($items{src}[0]); + $pagesources{$page}=$items{src}[0]; + $oldpagemtime{$page}=$items{mtime}[0]; + $pagectime{$page}=$items{ctime}[0]; + $oldlinks{$page}=[@{$items{link}}]; + $links{$page}=[@{$items{link}}]; + $renderedfiles{$page}=$items{dest}[0]; } close IN; } #}}} @@ -334,9 +342,14 @@ sub saveindex () { #{{{ open (OUT, ">$config{wikistatedir}/index") || error("cannot write to $config{wikistatedir}/index: $!"); foreach my $page (keys %oldpagemtime) { - print OUT "$oldpagemtime{$page} $pagesources{$page} $renderedfiles{$page} ". - join(" ", @{$links{$page}})."\n" - if $oldpagemtime{$page}; + my $line="mtime=$oldpagemtime{$page} ". + "ctime=$pagectime{$page} ". + "src=$pagesources{$page} ". + "dest=$renderedfiles{$page}"; + if ($oldpagemtime{$page}) { + $line.=" link=$_" foreach @{$links{$page}}; + } + print OUT $line."\n"; } close OUT; } #}}}