summaryrefslogtreecommitdiff
path: root/ikiwiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-05-02 02:34:33 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-05-02 02:34:33 +0000
commit54d5308cd83c67e7e9c32450c776ef0dac63549f (patch)
tree0352882349bca8952a59fd322099470b7952e0c8 /ikiwiki
parent457d6bbbbfbb0474749a0d68e959613c86facf72 (diff)
* Added plugin system, currently only supporting for PreProcessorDirectives.
* Added a pagecount plugin, enabled by default. * Support PreProcessorDirectives with no parameters, ie "[[pagecount ]]". * Fixed/optimised backlinks code, to avoid rebuilding pages to update backlinks when the backlinks hadn't really changed. * Moved inline page support, rss generation etc into the inline plugin, enabled by default. * Added brokenlinks plugin, not enabled by default, but rather handy. * Fix several broken links in the doc wiki.
Diffstat (limited to 'ikiwiki')
-rwxr-xr-xikiwiki24
1 files changed, 22 insertions, 2 deletions
diff --git a/ikiwiki b/ikiwiki
index dfb484f64..6c42a7e5d 100755
--- a/ikiwiki
+++ b/ikiwiki
@@ -9,7 +9,7 @@ use HTML::Template;
use lib '.'; # For use without installation, removed by Makefile.
use vars qw{%config %links %oldlinks %oldpagemtime %pagectime
- %renderedfiles %pagesources %depends};
+ %renderedfiles %pagesources %depends %plugins};
sub usage () { #{{{
die "usage: ikiwiki [options] source dest\n";
@@ -20,7 +20,7 @@ sub getconfig () { #{{{
%config=(
wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.html?$|\.rss$)},
wiki_link_regexp => qr/\[\[(?:([^\s\]\|]+)\|)?([^\s\]]+)\]\]/,
- wiki_processor_regexp => qr/\[\[(\w+)\s+([^\]]+)\]\]/,
+ wiki_processor_regexp => qr/\[\[(\w+)\s+([^\]]*)\]\]/,
wiki_file_regexp => qr/(^[-[:alnum:]_.:\/+]+$)/,
verbose => 0,
wikiname => "wiki",
@@ -50,6 +50,7 @@ sub getconfig () { #{{{
setup => undef,
adminuser => undef,
adminemail => undef,
+ plugin => [qw{inline}],
);
eval q{use Getopt::Long};
@@ -90,6 +91,9 @@ sub getconfig () { #{{{
"wrapper:s" => sub {
$config{wrapper}=$_[1] ? $_[1] : "ikiwiki-wrap"
},
+ "plugin=s@" => sub {
+ push @{$config{plugin}}, $_[1];
+ }
) || usage();
if (! $config{setup}) {
@@ -129,6 +133,14 @@ sub checkconfig () { #{{{
require IkiWiki::Rcs::Stub;
$config{rcs}=0;
}
+
+ foreach my $plugin (@{$config{plugin}}) {
+ $plugin="IkiWiki::Plugin::".possibly_foolish_untaint($plugin);
+ eval qq{use $plugin};
+ if ($@) {
+ error("Failed to load plugin $plugin: $@");
+ }
+ }
} #}}}
sub error ($) { #{{{
@@ -476,6 +488,14 @@ sub globlist_match ($$) { #{{{
return 0;
} #}}}
+sub register_plugin ($$$) { # {{{
+ my $type=shift;
+ my $command=shift;
+ my $function=shift;
+
+ $plugins{$type}{$command}=$function;
+} # }}}
+
sub main () { #{{{
getconfig();