From ffc0be87d7eca4de4dbc91d740d36b7b40bfa911 Mon Sep 17 00:00:00 2001 From: joey Date: Sun, 26 Mar 2006 05:08:41 +0000 Subject: [PATCH] add --refresh and make it with with --setup --- IkiWiki/CGI.pm | 2 +- IkiWiki/Setup.pm | 1 + IkiWiki/Setup/Standard.pm | 26 ++++++++++++++++---------- doc/bugs.mdwn | 3 +++ doc/usage.mdwn | 17 +++++++++++------ ikiwiki | 2 ++ 6 files changed, 34 insertions(+), 17 deletions(-) diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 560377f0e..f472413b8 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -513,7 +513,7 @@ sub cgi () { #{{{ # is entered my $page=lc($q->param('title')); $page=~y/ /_/; - $page=~s/([^-A-Za-z0-9_:+/])/"__".ord($1)."__"/eg; + $page=~s/([^-A-Za-z0-9_:+\/])/"__".ord($1)."__"/eg; # if the page already exist, munge it to be unique my $from=$q->param('from'); my $add=""; diff --git a/IkiWiki/Setup.pm b/IkiWiki/Setup.pm index 0c8ad9208..40ed78862 100644 --- a/IkiWiki/Setup.pm +++ b/IkiWiki/Setup.pm @@ -19,6 +19,7 @@ sub setup () { # {{{ eval $code; error($@) if $@; + exit; } #}}} diff --git a/IkiWiki/Setup/Standard.pm b/IkiWiki/Setup/Standard.pm index c5a67afdf..b26df006b 100644 --- a/IkiWiki/Setup/Standard.pm +++ b/IkiWiki/Setup/Standard.pm @@ -20,21 +20,27 @@ package IkiWiki; sub setup_standard { my %setup=%{$_[1]}; - debug("generating wrappers.."); - my %startconfig=(%config); - foreach my $wrapper (@{$setup{wrappers}}) { - %config=(%startconfig, verbose => 0, %setup, %{$wrapper}); - checkconfig(); - gen_wrapper(); + if (! $config{refresh}) { + debug("generating wrappers.."); + my %startconfig=(%config); + foreach my $wrapper (@{$setup{wrappers}}) { + %config=(%startconfig, verbose => 0, %setup, %{$wrapper}); + checkconfig(); + gen_wrapper(); + } + %config=(%startconfig); } - %config=(%startconfig); - - debug("rebuilding wiki.."); foreach my $c (keys %setup) { $config{$c}=possibly_foolish_untaint($setup{$c}) if defined $setup{$c} && ! ref $setup{$c}; } - $config{rebuild}=1; + if (! $config{refresh}) { + $config{rebuild}=1; + debug("rebuilding wiki.."); + } + else { + debug("refreshing wiki.."); + } checkconfig(); lockwiki(); diff --git a/doc/bugs.mdwn b/doc/bugs.mdwn index ede1c4837..3d6ea906b 100644 --- a/doc/bugs.mdwn +++ b/doc/bugs.mdwn @@ -25,3 +25,6 @@ will linger around and not be deleted. * Currently only one blog is supported per page. Attempts to add more will make it only update one of the blogs on the page. +* If I edit blog/entry/blog_moved, add a link to code/ikiwiki, and hit + preview, it doesn't get the link right because it makes it relative to + where the page will be saved to, not to where the cgi script is. diff --git a/doc/usage.mdwn b/doc/usage.mdwn index aa4978773..f2f0fba9a 100644 --- a/doc/usage.mdwn +++ b/doc/usage.mdwn @@ -30,6 +30,11 @@ flags such as --verbose can be negated with --no-verbose. Force a rebuild of all pages. +* --refresh + + Refresh the wiki, updating any changes pages. This is the default + behavior so you don't normally need to specify it. + * --fixctime Pull last changed time for all pages out of the revision control system. @@ -117,12 +122,12 @@ flags such as --verbose can be negated with --no-verbose. * --setup configfile In setup mode, ikiwiki reads the config file, which is really a perl - program that can call ikiwiki internal functions. Uses of this are - various; the normal one is to automatically generate wrappers for a - wiki based on data in a config file. - - Note that the wiki will be (re)built as part of the setup process to - ensure that any changes take effect. + program that can call ikiwiki internal functions. + + The default action when --setup is specified is to automatically generate + wrappers for a wiki based on data in a config file, and rebuild the wiki. + If you also pass the --refresh option, ikiwiki will instead just refresh + the wiki described in the setup file. [[ikiwiki.setup]] is an example of such a config file. diff --git a/ikiwiki b/ikiwiki index ab9f3fc2f..c5ac7c0b8 100755 --- a/ikiwiki +++ b/ikiwiki @@ -34,6 +34,7 @@ sub getconfig () { #{{{ anonok => 0, rss => 0, rebuild => 0, + refresh => 0, getctime => 0, wrapper => undef, wrappermode => undef, @@ -50,6 +51,7 @@ sub getconfig () { #{{{ "wikiname=s" => \$config{wikiname}, "verbose|v!" => \$config{verbose}, "rebuild!" => \$config{rebuild}, + "refresh!" => \$config{refresh}, "getctime" => \$config{getctime}, "wrappermode=i" => \$config{wrappermode}, "svn!" => \$config{svn}, -- 2.26.2