+
+ # 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 () {
+ 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, $page, $content);
+ $content=preprocess($page, $page, $content);
+ $content=linkify($page, $page, $content);
+ $content=htmlize($page, $page, $type, $content);
+ $pagemtime{$page}=(stat($srcfile))[9];
+ $pagectime{$page}=$pagemtime{$page} if ! exists $pagectime{$page};
+
+ print genpage($page, $content);
+ exit 0;
+}