From 7ea8df24b32a36687cfea94e2b84272777562325 Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 3 Jul 2006 21:29:56 +0000 Subject: [PATCH] * Introduce add_plugins and disable_plugins config options in setup files. This allows adding or removing plugins w/o overriding the whole list of default plugins, which makes it easier to upgrade when new default plugins are added. --- IkiWiki/Render.pm | 5 +---- IkiWiki/Setup/Standard.pm | 12 ++++++++++++ debian/NEWS | 19 +++++++++++++++++++ debian/changelog | 6 +++++- doc/ikiwiki.setup | 12 +++++++----- doc/plugins.mdwn | 2 +- ikiwiki | 2 +- 7 files changed, 46 insertions(+), 12 deletions(-) diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 960d1da1e..ac8f03937 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -226,10 +226,7 @@ sub check_overwrite ($$) { #{{{ my $src=shift; if (! exists $renderedfiles{$src} && -e $dest && ! $config{rebuild}) { - error("$dest already exists and was rendered from ". - join(" ",(grep { $renderedfiles{$_} eq $dest } keys - %renderedfiles)). - ", before, so not rendering from $src"); + error("$dest already exists and was not rendered from $src before"); } } #}}} diff --git a/IkiWiki/Setup/Standard.pm b/IkiWiki/Setup/Standard.pm index 786ba70ac..d42ceffa0 100644 --- a/IkiWiki/Setup/Standard.pm +++ b/IkiWiki/Setup/Standard.pm @@ -19,6 +19,18 @@ package IkiWiki; sub setup_standard { my %setup=%{$_[1]}; + $setup{plugin}=$config{plugin}; + if (exists $setup{add_plugins}) { + push @{$setup{plugin}}, @{$setup{add_plugins}}; + delete $setup{add_plugins}; + } + if (exists $setup{disable_plugins}) { + foreach my $plugin (@{$setup{disable_plugins}}) { + $setup{plugin}=[grep { $_ ne $plugin } @{$setup{plugin}}]; + } + delete $setup{disable_plugins}; + } + if (! $config{refresh}) { debug("generating wrappers.."); my @wrappers=@{$setup{wrappers}}; diff --git a/debian/NEWS b/debian/NEWS index 177fbc9ad..858894e05 100644 --- a/debian/NEWS +++ b/debian/NEWS @@ -1,3 +1,22 @@ +ikiwiki (1.8) unstable; urgency=low + + If your wiki is configured with a setup file, you should modify it to + stop setting the "plugin" list directly, and instead add or remove plugins + via the add_plugins and disable_plugins lines. For example, if you had: + + plugin => [qw{inline smiley search}], + + Change it to these lines, which disables the default htmlscrubber plugin + and adds the two additional plugins: + + add_plugins => [qw{smiley search}], + disable_plugins => [qw{htmlscrubber}], + + Making this change makes your ikiwiki setup file more future-proof since + new default plugins will be automatically used. + + -- Joey Hess Mon, 3 Jul 2006 16:59:29 -0400 + ikiwiki (1.1) unstable; urgency=low There have been several configuration changes in this release of ikiwiki: diff --git a/debian/changelog b/debian/changelog index eefa9e19c..082ab418f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -23,8 +23,12 @@ ikiwiki (1.8) UNRELEASED; urgency=low * Centralised all calls to HTML::Template and force all the templates to be read as utf8. * Support pages with utf8 filenames. Patch by Faidon Liambotis. + * Introduce add_plugins and disable_plugins config options in setup files. + This allows adding or removing plugins w/o overriding the whole list of + default plugins, which makes it easier to upgrade when new default plugins + are added. - -- Joey Hess Mon, 3 Jul 2006 16:17:20 -0400 + -- Joey Hess Mon, 3 Jul 2006 16:57:37 -0400 ikiwiki (1.7) unstable; urgency=low diff --git a/doc/ikiwiki.setup b/doc/ikiwiki.setup index f8d37ca21..c516da1b9 100644 --- a/doc/ikiwiki.setup +++ b/doc/ikiwiki.setup @@ -1,7 +1,7 @@ #!/usr/bin/perl # Configuration file for ikiwiki. -# Passing this to ikiwiki --setup will make ikiwiki generate two -# wrapper programs, one for cgi and one for a subversion post-commit hook. +# Passing this to ikiwiki --setup will make ikiwiki generate wrappers and +# build the wiki. # # Remember to re-run ikiwiki --setup any time you edit this file. @@ -69,7 +69,9 @@ use IkiWiki::Setup::Standard { discussion => 1, # Time format (for strftime) #timeformat => '%c', - # To change the enabled plugins, edit this list - #plugin => [qw{pagecount inline brokenlinks search smiley - # htmlscrubber}], + + # To add plugins, list them here. + #add_plugins => [qw{pagecount brokenlinks search smiley}], + # If you want to disable any of the default plugins, list them here. + #disable_plugins => [qw{inline htmlscrubber}], } diff --git a/doc/plugins.mdwn b/doc/plugins.mdwn index 2c184900c..05b661f2b 100644 --- a/doc/plugins.mdwn +++ b/doc/plugins.mdwn @@ -4,7 +4,7 @@ install and use plugins contributed by others. The [[inline]] and [[htmlscrubber]] plugins are enabled by default. To enable other plugins, use the `--plugin` switch described in [[usage]], -or the equivalent line in [[ikiwiki.setup]]. +or the equivalent `add_plugins` line in [[ikiwiki.setup]]. # Plugin directory diff --git a/ikiwiki b/ikiwiki index f32eb4879..099a821b7 100755 --- a/ikiwiki +++ b/ikiwiki @@ -57,7 +57,7 @@ sub getconfig () { #{{{ push @{$config{plugin}}, $_[1]; }, "disable-plugin=s@" => sub { - $config{plugin}=[grep { $_ ne $_[1] } @{$config{plugin}} ]; + $config{plugin}=[grep { $_ ne $_[1] } @{$config{plugin}}]; }, "pingurl" => sub { push @{$config{pingurl}}, $_[1]; -- 2.45.0