aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Render.pm
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki/Render.pm')
-rw-r--r--IkiWiki/Render.pm25
1 files changed, 25 insertions, 0 deletions
diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm
index c16877b3d..48a25bef7 100644
--- a/IkiWiki/Render.pm
+++ b/IkiWiki/Render.pm
@@ -374,4 +374,29 @@ FILE: foreach my $file (@files) {
}
} #}}}
+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 "ikiwiki: cannot render $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;
+} #}}}
+
1