use lib '.'; # For use without installation, removed by Makefile.
use vars qw{%config %links %oldlinks %oldpagemtime %pagectime
- %renderedfiles %pagesources %inlinepages};
+ %renderedfiles %pagesources %depends %plugins};
sub usage () { #{{{
die "usage: ikiwiki [options] source dest\n";
%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",
setup => undef,
adminuser => undef,
adminemail => undef,
+ plugin => [qw{inline}],
);
eval q{use Getopt::Long};
"wrapper:s" => sub {
$config{wrapper}=$_[1] ? $_[1] : "ikiwiki-wrap"
},
+ "plugin=s@" => sub {
+ push @{$config{plugin}}, $_[1];
+ }
) || usage();
if (! $config{setup}) {
require IkiWiki::Rcs::Stub;
$config{rcs}=0;
}
+
+ foreach my $plugin (@{$config{plugin}}) {
+ my $mod="IkiWiki::Plugin::".possibly_foolish_untaint($plugin);
+ eval qq{use $mod};
+ if ($@) {
+ error("Failed to load plugin $mod: $@");
+ }
+ }
} #}}}
sub error ($) { #{{{
$oldpagemtime{$page}=$items{mtime}[0];
$oldlinks{$page}=[@{$items{link}}];
$links{$page}=[@{$items{link}}];
- $inlinepages{$page}=join(" ", @{$items{inlinepage}})
- if exists $items{inlinepage};
+ $depends{$page}=join(" ", @{$items{depends}})
+ if exists $items{depends};
$renderedfiles{$page}=$items{dest}[0];
}
$pagectime{$page}=$items{ctime}[0];
"src=$pagesources{$page} ".
"dest=$renderedfiles{$page}";
$line.=" link=$_" foreach @{$links{$page}};
- if (exists $inlinepages{$page}) {
- $line.=" inlinepage=$_" foreach split " ", $inlinepages{$page};
+ if (exists $depends{$page}) {
+ $line.=" depends=$_" foreach split " ", $depends{$page};
}
print OUT $line."\n";
}
return 0;
} #}}}
+sub register_plugin ($$$) { # {{{
+ my $type=shift;
+ my $command=shift;
+ my $function=shift;
+
+ $plugins{$type}{$command}=$function;
+} # }}}
+
sub main () { #{{{
getconfig();
loadindex();
require IkiWiki::Render;
rcs_update();
- rcs_notify() if $config{notify};
rcs_getctime() if $config{getctime};
refresh();
+ rcs_notify() if $config{notify};
saveindex();
}
} #}}}