+
+ # remove no longer rendered files
+ foreach my $src (keys %rendered) {
+ my $page=pagename($src);
+ foreach my $file (@{$oldrenderedfiles{$page}}) {
+ if (! grep { $_ eq $file } @{$renderedfiles{$page}}) {
+ debug(sprintf(gettext("removing %s, no longer rendered by %s"), $file, $page));
+ prune($config{destdir}."/".$file);
+ }
+ }
+ }
+
+ if (@del) {
+ run_hooks(delete => sub { shift->(@del) });
+ }
+ if (%rendered) {
+ run_hooks(change => sub { shift->(keys %rendered) });
+ }
+} #}}}
+
+sub commandline_render () { #{{{
+ loadplugins();
+ checkconfig();
+ lockwiki();
+ loadindex();
+ unlockwiki();
+
+ my $srcfile=possibly_foolish_untaint($config{render});
+ my $file=$srcfile;
+ $file=~s/\Q$config{srcdir}\E\/?//;
+
+ my $type=pagetype($file);
+ die sprintf(gettext("ikiwiki: cannot render %s"), $srcfile)."\n" unless defined $type;
+ my $content=readfile($srcfile);
+ my $page=pagename($file);
+ $pagesources{$page}=$file;
+ $content=filter($page, $content);
+ $content=preprocess($page, $page, $content);
+ $content=linkify($page, $page, $content);
+ $content=htmlize($page, $type, $content);
+
+ print genpage($page, $content, mtime($srcfile));
+ exit 0;