add plugin safe/rebuild info (part 1 of 2)

too many plugins.. brain exploding..
master
Joey Hess 2008-08-03 16:40:12 -04:00
parent 9e0cbb73fe
commit 903213e63f
43 changed files with 316 additions and 10 deletions

View File

@ -40,6 +40,10 @@ sub getopt () { #{{{
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
aggregateinternal => {
type => "boolean",
example => 0,

View File

@ -42,6 +42,10 @@ sub getopt () { #{{{
sub getsetup () { #{{{
return
plugin => {
safe => 0,
rebuild => 0,
},
amazon_s3_key_id => {
type => "string",
example => "XXXXXXXXXXXXXXXXXXXX",

View File

@ -12,6 +12,10 @@ sub import { #{{{
sub getsetup () { #{{{
return
plugin => {
safe => 0,
rebuild => 0,
},
anonok_pagespec => {
type => "pagespec",
example => "*/discussion",

View File

@ -14,6 +14,10 @@ sub import { #{{{
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => 0,
},
virus_checker => {
type => "string",
example => "clamdscan -",
@ -23,7 +27,7 @@ sub getsetup () { #{{{
},
allowed_attachments => {
type => "pagespec",
example => "mimetype(image/*) and maxsize(50kb)",
example => "virusfree() and mimetype(image/*) and maxsize(50kb)",
description => "enhanced PageSpec specifying what attachments are allowed",
link => "ikiwiki/PageSpec/attachment",
safe => 1,

View File

@ -7,9 +7,18 @@ use IkiWiki 2.00;
use Encode;
sub import { #{{{
hook(type => "getsetup", id => "autoindex", call => \&getsetup);
hook(type => "refresh", id => "autoindex", call => \&refresh);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => 0,
},
} #}}}
sub genindex ($) { #{{{
my $page=shift;
my $file=$page.".".$config{default_pageext};

View File

@ -7,9 +7,18 @@ use strict;
use IkiWiki 2.00;
sub import { #{{{
hook(type => "getsetup", id => "brokenlinks", call => \&getsetup);
hook(type => "preprocess", id => "brokenlinks", call => \&preprocess);
} # }}}
sub getsetup { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
sub preprocess (@) { #{{{
my %params=@_;
$params{pages}="*" unless defined $params{pages};

View File

@ -33,6 +33,10 @@ sub checkconfig () { #{{{
sub getsetup () { #{{{
return
plugin => {
safe => 0, # rcs plugin
rebuild => undef,
},
bzr_wrapper => {
type => "string",
#example => "", # FIXME add example

View File

@ -37,6 +37,10 @@ sub import { #{{{
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
archivebase => {
type => "string",
example => "archives",

View File

@ -23,10 +23,19 @@ my $link_regexp=qr{
}x;
sub import { #{{{
hook(type => "getsetup", id => "camelcase", call => \&getsetup);
hook(type => "linkify", id => "camelcase", call => \&linkify);
hook(type => "scan", id => "camelcase", call => \&scan);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
};
} #}}}
sub linkify (@) { #{{{
my %params=@_;
my $page=$params{page};

View File

@ -7,9 +7,18 @@ use IkiWiki 2.00;
use UNIVERSAL;
sub import { #{{{
hook(type => "getsetup", id => "conditional", call => \&getsetup);
hook(type => "preprocess", id => "if", call => \&preprocess_if);
} # }}}
sub getsetup { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
sub preprocess_if (@) { #{{{
my %params=@_;

View File

@ -8,9 +8,18 @@ use strict;
use IkiWiki 2.00;
sub import { #{{{
hook(type => "getsetup", id => "creole", call => \&getsetup);
hook(type => "htmlize", id => "creole", call => \&htmlize);
} # }}}
sub getsetup { #{{{
return
plugin => {
safe => 1,
rebuild => 1, # format plugin
},
} #}}}
sub htmlize (@) { #{{{
my %params=@_;
my $content = $params{content};

View File

@ -9,11 +9,20 @@ use UNIVERSAL;
my %savedtext;
sub import { #{{{
hook(type => "getsetup", id => "cutpaste", call => \&getsetup);
hook(type => "preprocess", id => "cut", call => \&preprocess_cut, scan => 1);
hook(type => "preprocess", id => "copy", call => \&preprocess_copy, scan => 1);
hook(type => "preprocess", id => "paste", call => \&preprocess_paste);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
sub preprocess_cut (@) { #{{{
my %params=@_;

View File

@ -6,9 +6,18 @@ use IkiWiki 2.00;
no warnings;
sub import { #{{{
hook(type => "getsetup", id => "ddate", call => \&getsetup);
hook(type => "checkconfig", id => "ddate", call => \&checkconfig);
} # }}}
sub getsetup { #{{{
return
plugin => {
safe => 1,
rebuild => 1,
},
} #}}}
sub checkconfig () { #{{{
if (! defined $config{timeformat} ||
$config{timeformat} eq '%c') {

View File

@ -9,10 +9,19 @@ use HTML::Entities;
use IPC::Open2;
sub import { #{{{
hook(type => "getsetup", id => "editdiff", call => \&getsetup);
hook(type => "formbuilder_setup", id => "editdiff",
call => \&formbuilder_setup);
} #}}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => 0,
},
} #}}}
sub diff ($$) { #{{{
my $orig=shift;
my $content=shift;

View File

@ -8,6 +8,8 @@ use HTML::Template;
use Encode;
sub import { #{{{
hook(type => "getsetup", id => "edittemplate",
call => \&getsetup);
hook(type => "needsbuild", id => "edittemplate",
call => \&needsbuild);
hook(type => "preprocess", id => "edittemplate",
@ -16,6 +18,14 @@ sub import { #{{{
call => \&formbuilder);
} #}}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
sub needsbuild (@) { #{{{
my $needsbuild=shift;

View File

@ -44,9 +44,18 @@ my $safehtml=qr{(
my @embedded;
sub import { #{{{
hook(type => "getsetup", id => "embed", call => \&getsetup);
hook(type => "filter", id => "embed", call => \&filter);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
sub embed ($) { #{{{
hook(type => "format", id => "embed", call => \&format) unless @embedded;
push @embedded, shift;

View File

@ -1,6 +1,6 @@
#!/usr/bin/perl
# Support for external plugins written in other languages.
# Communication via XML RPC a pipe.
# Communication via XML RPC to a pipe.
# See externaldemo for an example of a plugin that uses this.
package IkiWiki::Plugin::external;

View File

@ -8,9 +8,18 @@ use strict;
use IkiWiki 2.00;
sub import { #{{{
hook(type => "getsetup", id => "favicon", call => \&getsetup);
hook(type => "pagetemplate", id => "favicon", call => \&pagetemplate);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => 1,
},
} #}}}
sub pagetemplate (@) { #{{{
my %params=@_;

View File

@ -7,9 +7,18 @@ use strict;
use IkiWiki 2.00;
sub import { #{{{
hook(type => "getsetup", id => "fortune", call => \&getsetup);
hook(type => "preprocess", id => "fortune", call => \&preprocess);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
sub preprocess (@) { #{{{
$ENV{PATH}="$ENV{PATH}:/usr/games:/usr/local/games";
my $f = `fortune 2>/dev/null`;

View File

@ -42,6 +42,10 @@ sub checkconfig () { #{{{
sub getsetup () { #{{{
return
plugin => {
safe => 0, # rcs plugin
rebuild => undef,
},
git_wrapper => {
type => "string",
example => "/git/wiki.git/hooks/post-update",

View File

@ -24,7 +24,16 @@ my @bundle=qw{
};
sub import { #{{{
hook(type => "getsetup", id => "goodstuff", call => \&getsetup);
IkiWiki::loadplugin($_) foreach @bundle;
} # }}}
sub getsetup { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
1

View File

@ -6,12 +6,22 @@ use strict;
use IkiWiki 2.00;
sub import { #{{{
hook(type => "getsetup", id => "googlecalendar",
call => \&getsetup);
hook(type => "preprocess", id => "googlecalendar",
call => \&preprocess);
hook(type => "format", id => "googlecalendar",
call => \&format);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
sub preprocess (@) { #{{{
my %params=@_;

View File

@ -9,9 +9,18 @@ use IkiWiki 2.00;
use IPC::Open2;
sub import { #{{{
hook(type => "getsetup", id => "graphviz", call => \&getsetup);
hook(type => "preprocess", id => "graphviz", call => \&graph);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
my %graphviz_programs = (
"dot" => 1, "neato" => 1, "fdp" => 1, "twopi" => 1, "circo" => 1
);

View File

@ -7,9 +7,18 @@ use strict;
use IkiWiki 2.00;
sub import { #{{{
hook(type => "getsetup", id => "haiku", call => \&getsetup);
hook(type => "preprocess", id => "haiku", call => \&preprocess);
} # }}}
sub getsetup { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
sub preprocess (@) { #{{{
my %params=@_;

View File

@ -13,11 +13,20 @@ use strict;
use IkiWiki 2.00;
use File::Temp qw(:mktemp);
sub import {
sub import { #{{{
hook(type => "getsetup", id => "hnb", call => \&getsetup);
hook(type => "htmlize", id => "hnb", call => \&htmlize);
}
} #}}}
sub htmlize (@) {
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => 1, # format plugin
},
} #}}}
sub htmlize (@) { #{{{
my %params = @_;
# hnb outputs version number etc. every time to STDOUT, so
@ -43,6 +52,6 @@ sub htmlize (@) {
$ret =~ s/<body>.*//si;
return $ret;
}
} #}}}
1;

View File

@ -7,6 +7,7 @@ use strict;
use IkiWiki 2.00;
sub import { #{{{
hook(type => "getsetup", id => "html", call => \&getsetup);
hook(type => "htmlize", id => "html", call => \&htmlize);
hook(type => "htmlize", id => "htm", call => \&htmlize);
@ -15,6 +16,14 @@ sub import { #{{{
$config{wiki_file_prune_regexps} = [ grep { !m/\\\.x\?html\?\$/ } @{$config{wiki_file_prune_regexps}} ];
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => 1, # format plugin
},
} #}}}
sub htmlize (@) { #{{{
my %params=@_;
return $params{content};

View File

@ -10,6 +10,7 @@ use IkiWiki 2.00;
our $safe_url_regexp;
sub import { #{{{
hook(type => "getsetup", id => "htmlscrubber", call => \&getsetup);
hook(type => "sanitize", id => "htmlscrubber", call => \&sanitize);
# Only known uri schemes are allowed to avoid all the ways of
@ -34,6 +35,14 @@ sub import { #{{{
$safe_url_regexp=qr/^(?:(?:$uri_schemes):|data:image\/|[^:]+(?:$|\/))/i;
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
sub sanitize (@) { #{{{
my %params=@_;
return scrubber()->scrub($params{content});

View File

@ -13,9 +13,18 @@ use IkiWiki 2.00;
use IPC::Open2;
sub import { #{{{
hook(type => "getsetup", id => "tidy", call => \&getsetup);
hook(type => "sanitize", id => "tidy", call => \&sanitize);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
sub sanitize (@) { #{{{
my %params=@_;

View File

@ -7,9 +7,18 @@ use strict;
use IkiWiki 2.00;
sub import { #{{{
hook(type => "getsetup", id => "httpauth", call => \&getsetup);
hook(type => "auth", id => "httpauth", call => \&auth);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => 0,
},
} #}}}
sub auth ($$) { #{{{
my $cgi=shift;
my $session=shift;

View File

@ -10,9 +10,18 @@ use IkiWiki 2.00;
my %imgdefaults;
sub import { #{{{
hook(type => "getsetup", id => "img", call => \&getsetup);
hook(type => "preprocess", id => "img", call => \&preprocess, scan => 1);
} #}}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
sub preprocess (@) { #{{{
my ($image) = $_[0] =~ /$config{wiki_file_regexp}/; # untaint
my %params=@_;

View File

@ -47,6 +47,10 @@ sub getopt () { #{{{
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
rss => {
type => "boolean",
example => 0,

View File

@ -8,12 +8,21 @@ use IkiWiki 2.00;
my $link_regexp;
sub import { #{{{
hook(type => "getsetup", id => "link", call => \&getsetup);
hook(type => "checkconfig", id => "link", call => \&checkconfig);
hook(type => "linkify", id => "link", call => \&linkify);
hook(type => "scan", id => "link", call => \&scan);
hook(type => "renamepage", id => "link", call => \&renamepage);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => 1,
},
} #}}}
sub checkconfig () { #{{{
if ($config{prefix_directives}) {
$link_regexp = qr{

View File

@ -7,10 +7,19 @@ use IkiWiki 2.00;
use IPC::Open2;
sub import { #{{{
hook(type => "getsetup", id => "linkmap", call => \&getsetup);
hook(type => "preprocess", id => "linkmap", call => \&preprocess);
hook(type => "format", id => "linkmap", call => \&format);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
my $mapnum=0;
my %maps;

View File

@ -14,6 +14,10 @@ sub import { #{{{
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => 0,
},
locked_pages => {
type => "pagespec",
example => "!*/Discussion",

View File

@ -12,9 +12,18 @@ use strict;
use IkiWiki 2.00;
sub import { #{{{
hook(type => "getsetup", id => "map", call => \&getsetup);
hook(type => "preprocess", id => "map", call => \&preprocess);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
sub preprocess (@) { #{{{
my %params=@_;
$params{pages}="*" unless defined $params{pages};

View File

@ -13,6 +13,10 @@ sub import { #{{{
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => 1, # format plugin
},
multimarkdown => {
type => "boolean",
example => 0,

View File

@ -33,6 +33,10 @@ sub checkconfig () { #{{{
sub getsetup () { #{{{
return
plugin => {
safe => 0, # rcs plugin
rebuild => undef,
},
mercurial_wrapper => {
type => "string",
#example => # FIXME add example

View File

@ -9,11 +9,20 @@ use IkiWiki 2.00;
my %metaheaders;
sub import { #{{{
hook(type => "getsetup", id => "meta", call => \&getsetup);
hook(type => "needsbuild", id => "meta", call => \&needsbuild);
hook(type => "preprocess", id => "meta", call => \&preprocess, scan => 1);
hook(type => "pagetemplate", id => "meta", call => \&pagetemplate);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
sub needsbuild (@) { #{{{
my $needsbuild=shift;
foreach my $page (keys %pagestate) {

View File

@ -12,6 +12,10 @@ sub import { #{{{
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => 1,
},
mirrorlist => {
type => "string",
example => {},

View File

@ -65,6 +65,10 @@ sub checkconfig () { #{{{
sub getsetup () { #{{{
return
plugin => {
safe => 0, # rcs plugin
rebuild => undef,
},
mtn_wrapper => {
type => "string",
example => "/srv/mtn/wiki/_MTN/ikiwiki-netsync-hook",

View File

@ -8,9 +8,18 @@ use IkiWiki 2.00;
my $linktext = gettext("more");
sub import { #{{{
hook(type => "getsetup", id => "more", call => \&getsetup);
hook(type => "preprocess", id => "more", call => \&preprocess);
} # }}}
sub getsetup () { #{{{
return
plugin => {
safe => 1,
rebuild => undef,
},
} #}}}
sub preprocess (@) { #{{{
my %params=@_;

View File

@ -7,6 +7,7 @@ use strict;
use IkiWiki;
sub import { #{{{
hook(type => "getsetup", id => "norcs", call => \&getsetup);
hook(type => "rcs", id => "rcs_update", call => \&rcs_update);
hook(type => "rcs", id => "rcs_prepedit", call => \&rcs_prepedit);
hook(type => "rcs", id => "rcs_commit", call => \&rcs_commit);
@ -19,6 +20,15 @@ sub import { #{{{
hook(type => "rcs", id => "rcs_getctime", call => \&rcs_getctime);
} #}}}
sub getsetup () { #{{{
return
plugin => {
safe => 0, # rcs plugin
rebuild => 0,
},
} #}}}
sub rcs_update () { #{{{
} #}}}

View File

@ -85,8 +85,7 @@ sub showfields ($$$@) { #{{{
my $plugin_forced=defined $plugin && (! $plugininfo{safe} ||
(exists $config{websetup_force_plugins} && grep { $_ eq $plugin } @{$config{websetup_force_plugins}}));
if ($plugin_forced && ! $enabled) {
# plugin is disabled and cannot be turned on,
# so skip its configuration
# plugin is forced disabled, so skip its configuration
return;
}