wiki_file_prune_regexp => qr{((^|/).svn/|\.\.|^\.|\/\.|\.x?html?$|\.rss$|\.atom$|.arch-ids/|{arch}/)},
wiki_link_regexp => qr/\[\[(?:([^\]\|]+)\|)?([^\s\]]+)\]\]/,
wiki_file_regexp => qr/(^[-[:alnum:]_.:\/+]+$)/,
+ web_commit_regexp => qr/^web commit (by (.*?(?=: |$))|from (\d+\.\d+\.\d+\.\d+)):?(.*)/,
verbose => 0,
syslog => 0,
wikiname => "wiki",
setup => undef,
adminuser => undef,
adminemail => undef,
- plugin => [qw{mdwn inline htmlscrubber}],
+ plugin => [qw{mdwn inline htmlscrubber passwordauth}],
timeformat => '%c',
locale => undef,
sslcookie => 0,
}
if (defined $config{locale}) {
eval q{use POSIX};
+ error($@) if $@;
$ENV{LANG} = $config{locale}
if POSIX::setlocale(&POSIX::LC_TIME, $config{locale});
}
if ($config{w3mmode}) {
eval q{use Cwd q{abs_path}};
+ error($@) if $@;
$config{srcdir}=possibly_foolish_untaint(abs_path($config{srcdir}));
$config{destdir}=possibly_foolish_untaint(abs_path($config{destdir}));
$config{cgiurl}="file:///\$LIB/ikiwiki-w3m.cgi/".$config{cgiurl}
} #}}}
sub loadplugins () { #{{{
- foreach my $plugin (@{$config{plugin}}) {
- my $mod="IkiWiki::Plugin::".possibly_foolish_untaint($plugin);
- eval qq{use $mod};
- if ($@) {
- error("Failed to load plugin $mod: $@");
- }
- }
+ loadplugin($_) foreach @{$config{plugin}};
+
run_hooks(getopt => sub { shift->() });
if (grep /^-/, @ARGV) {
print STDERR "Unknown option: $_\n"
}
} #}}}
+sub loadplugin ($) { #{{{
+ my $plugin=shift;
+
+ my $mod="IkiWiki::Plugin::".possibly_foolish_untaint($plugin);
+ eval qq{use $mod};
+ if ($@) {
+ error("Failed to load plugin $mod: $@");
+ }
+} #}}}
+
sub error ($) { #{{{
if ($config{cgi}) {
print "Content-type: text/html\n\n";
my $time=shift;
eval q{use POSIX};
+ error($@) if $@;
# strftime doesn't know about encodings, so make sure
# its output is properly treated as utf8
return decode_utf8(POSIX::strftime(
"ctime=$pagectime{$page} ".
"src=$pagesources{$page}";
$line.=" dest=$_" foreach @{$renderedfiles{$page}};
- $line.=" link=$_" foreach @{$links{$page}};
+ my %count;
+ $line.=" link=$_" foreach grep { ++$count{$_} == 1 } @{$links{$page}};
if (exists $depends{$page}) {
$line.=" depends=".encode_entities($depends{$page}, " \t\n");
}
my $sub=shift;
if (exists $hooks{$type}) {
+ my @deferred;
foreach my $id (keys %{$hooks{$type}}) {
+ if ($hooks{$type}{$id}{last}) {
+ push @deferred, $id;
+ next;
+ }
+ $sub->($hooks{$type}{$id}{call});
+ }
+ foreach my $id (@deferred) {
$sub->($hooks{$type}{$id}{call});
}
}