* Add --render mode, which can be used to preview an edit at the command
[ikiwiki.git] / ikiwiki.pl
index 1342ec543f3e54c216e16cb615e9493c67484e8a..b4cf0e64a959e57e88b862a00f85c5625e4b24d9 100755 (executable)
@@ -3,6 +3,8 @@ $ENV{PATH}="/usr/local/bin:/usr/bin:/bin";
 delete @ENV{qw{IFS CDPATH ENV BASH_ENV}};
 
 package IkiWiki;
+our $version='unknown'; # VERSION_AUTOREPLACE done by Makefile, DNE
+
 use warnings;
 use strict;
 use lib '.'; # For use without installation, removed by Makefile.
@@ -21,8 +23,10 @@ sub getconfig () { #{{{
                        "setup|s=s" => \$config{setup},
                        "wikiname=s" => \$config{wikiname},
                        "verbose|v!" => \$config{verbose},
+                       "syslog!" => \$config{syslog},
                        "rebuild!" => \$config{rebuild},
                        "refresh!" => \$config{refresh},
+                       "render=s" => \$config{render},
                        "wrappers!" => \$config{wrappers},
                        "getctime" => \$config{getctime},
                        "wrappermode=i" => \$config{wrappermode},
@@ -42,6 +46,7 @@ sub getconfig () { #{{{
                        "svnpath" => \$config{svnpath},
                        "adminemail=s" => \$config{adminemail},
                        "timeformat=s" => \$config{timeformat},
+                       "sslcookie!" => \$config{sslcookie},
                        "exclude=s@" => sub {
                                $config{wiki_file_prune_regexp}=qr/$config{wiki_file_prune_regexp}|$_[1]/;
                        },
@@ -65,10 +70,14 @@ sub getconfig () { #{{{
                        },
                        "pingurl" => sub {
                                push @{$config{pingurl}}, $_[1];
-                       }
+                       },
+                       "version" => sub {
+                               print "ikiwiki version $version\n";
+                               exit;
+                       },
                ) || usage();
 
-               if (! $config{setup}) {
+               if (! $config{setup} && ! $config{render}) {
                        loadplugins();
                        usage() unless @ARGV == 2;
                        $config{srcdir} = possibly_foolish_untaint(shift @ARGV);
@@ -106,6 +115,10 @@ sub main () { #{{{
                require IkiWiki::Wrapper;
                gen_wrapper();
        }
+       elsif ($config{render}) {
+               require IkiWiki::Render;
+               commandline_render();
+       }
        else {
                lockwiki();
                loadindex();