From: Joey Hess Date: Sun, 3 Aug 2008 23:35:35 +0000 (-0400) Subject: add plugin safe/rebuild info (part 3 of 3) X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/commitdiff_plain/39056453424dcb7e01f69c502192e45604d1fe84?hp=210b9ba2f3999db21030bb7ca05b9861b763788a add plugin safe/rebuild info (part 3 of 3) --- diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm index 404ca07fa..b81870ffb 100644 --- a/IkiWiki/Plugin/attachment.pm +++ b/IkiWiki/Plugin/attachment.pm @@ -18,13 +18,6 @@ sub getsetup () { #{{{ safe => 1, rebuild => 0, }, - virus_checker => { - type => "string", - example => "clamdscan -", - description => "virus checker program (reads STDIN, returns nonzero if virus found)", - safe => 0, # executed - rebuild => 0, - }, allowed_attachments => { type => "pagespec", example => "virusfree() and mimetype(image/*) and maxsize(50kb)", @@ -33,6 +26,13 @@ sub getsetup () { #{{{ safe => 1, rebuild => 0, }, + virus_checker => { + type => "string", + example => "clamdscan -", + description => "virus checker program (reads STDIN, returns nonzero if virus found)", + safe => 0, # executed + rebuild => 0, + }, } #}}} sub check_canattach ($$;$) { #{{{ diff --git a/IkiWiki/Plugin/shortcut.pm b/IkiWiki/Plugin/shortcut.pm index dfc3cd7c7..7bfce586f 100644 --- a/IkiWiki/Plugin/shortcut.pm +++ b/IkiWiki/Plugin/shortcut.pm @@ -6,10 +6,19 @@ use strict; use IkiWiki 2.00; sub import { #{{{ + hook(type => "getsetup", id => "shortcut", call => \&getsetup); hook(type => "refresh", id => "shortcut", call => \&refresh); hook(type => "preprocess", id => "shortcut", call => \&preprocess_shortcut); } #}}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => undef, + }, +} #}}} + sub refresh () { #{{{ # Preprocess the shortcuts page to get all the available shortcuts # defined before other pages are rendered. diff --git a/IkiWiki/Plugin/sidebar.pm b/IkiWiki/Plugin/sidebar.pm index 7c2e6e1f6..9697e1198 100644 --- a/IkiWiki/Plugin/sidebar.pm +++ b/IkiWiki/Plugin/sidebar.pm @@ -9,9 +9,18 @@ use strict; use IkiWiki 2.00; sub import { #{{{ + hook(type => "getsetup", id => "sidebar", call => \&getsetup); hook(type => "pagetemplate", id => "sidebar", call => \&pagetemplate); } # }}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => 1, + }, +} #}}} + sub sidebar_content ($) { #{{{ my $page=shift; diff --git a/IkiWiki/Plugin/signinedit.pm b/IkiWiki/Plugin/signinedit.pm index 84ab3a4d0..ef7b9b428 100644 --- a/IkiWiki/Plugin/signinedit.pm +++ b/IkiWiki/Plugin/signinedit.pm @@ -6,10 +6,19 @@ use strict; use IkiWiki 2.00; sub import { #{{{ + hook(type => "getsetup", id => "signinedit", call => \&getsetup); hook(type => "canedit", id => "signinedit", call => \&canedit, last => 1); } # }}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => 0, + }, +} #}}} + sub canedit ($$$) { #{{{ my $page=shift; my $cgi=shift; diff --git a/IkiWiki/Plugin/skeleton.pm.example b/IkiWiki/Plugin/skeleton.pm.example index bbf11e603..7878d7c2b 100644 --- a/IkiWiki/Plugin/skeleton.pm.example +++ b/IkiWiki/Plugin/skeleton.pm.example @@ -42,6 +42,10 @@ sub getopt () { #{{{ sub getsetup () { #{{{ return + plugin => { + safe => 1, + rebuild => undef, + }, skeleton => { type => "boolean", example => 0, diff --git a/IkiWiki/Plugin/smiley.pm b/IkiWiki/Plugin/smiley.pm index 50f268627..7a9026025 100644 --- a/IkiWiki/Plugin/smiley.pm +++ b/IkiWiki/Plugin/smiley.pm @@ -10,9 +10,20 @@ my $smiley_regexp; sub import { #{{{ add_underlay("smiley"); + hook(type => "getsetup", id => "smiley", call => \&getsetup); hook(type => "sanitize", id => "smiley", call => \&sanitize); } # }}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + # force a rebuild because turning it off + # removes the smileys, which would break links + rebuild => 1, + }, +} #}}} + sub build_regexp () { #{{{ my $list=readfile(srcfile("smileys.mdwn")); while ($list =~ m/^\s*\*\s+\\\\([^\s]+)\s+\[\[([^]]+)\]\]/mg) { diff --git a/IkiWiki/Plugin/sparkline.pm b/IkiWiki/Plugin/sparkline.pm index bcff46aeb..901c2f683 100644 --- a/IkiWiki/Plugin/sparkline.pm +++ b/IkiWiki/Plugin/sparkline.pm @@ -15,9 +15,18 @@ my %locmap=( ); sub import { #{{{ + hook(type => "getsetup", id => "sparkline", call => \&getsetup); hook(type => "preprocess", id => "sparkline", call => \&preprocess); } # }}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => undef, + }, +} #}}} + sub preprocess (@) { #{{{ my %params=@_; diff --git a/IkiWiki/Plugin/svn.pm b/IkiWiki/Plugin/svn.pm index c51b0f181..d738720be 100644 --- a/IkiWiki/Plugin/svn.pm +++ b/IkiWiki/Plugin/svn.pm @@ -41,6 +41,10 @@ sub checkconfig () { #{{{ sub getsetup () { #{{{ return + plugin => { + safe => 0, # rcs plugin + rebuild => undef, + }, svnrepo => { type => "string", example => "/svn/wiki", diff --git a/IkiWiki/Plugin/table.pm b/IkiWiki/Plugin/table.pm index 892ea182e..1302646b1 100644 --- a/IkiWiki/Plugin/table.pm +++ b/IkiWiki/Plugin/table.pm @@ -7,9 +7,18 @@ use Encode; use IkiWiki 2.00; sub import { #{{{ + hook(type => "getsetup", id => "table", call => \&getsetup); hook(type => "preprocess", id => "table", call => \&preprocess); } # }}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => undef, + }, +} #}}} + sub preprocess (@) { #{{{ my %params =( format => 'auto', diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index 36b434f67..74d187cd2 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -25,6 +25,10 @@ sub getopt () { #{{{ sub getsetup () { #{{{ return + plugin => { + safe => 1, + rebuild => undef, + }, tagbase => { type => "string", example => "tag", diff --git a/IkiWiki/Plugin/template.pm b/IkiWiki/Plugin/template.pm index c33dbbb83..a2859b2a9 100644 --- a/IkiWiki/Plugin/template.pm +++ b/IkiWiki/Plugin/template.pm @@ -9,9 +9,18 @@ use HTML::Template; use Encode; sub import { #{{{ + hook(type => "getsetup", id => "template", call => \&getsetup); hook(type => "preprocess", id => "template", call => \&preprocess); } # }}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => undef, + }, +} #}}} + sub preprocess (@) { #{{{ my %params=@_; diff --git a/IkiWiki/Plugin/testpagespec.pm b/IkiWiki/Plugin/testpagespec.pm index 4faef7be1..9f9b50f01 100644 --- a/IkiWiki/Plugin/testpagespec.pm +++ b/IkiWiki/Plugin/testpagespec.pm @@ -6,9 +6,18 @@ use strict; use IkiWiki 2.00; sub import { #{{{ + hook(type => "getsetup", id => "testpagespec", call => \&getsetup); hook(type => "preprocess", id => "testpagespec", call => \&preprocess); } # }}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => undef, + }, +} #}}} + sub preprocess (@) { #{{{ my %params=@_; diff --git a/IkiWiki/Plugin/teximg.pm b/IkiWiki/Plugin/teximg.pm index 6a6bdd4fa..369c10882 100644 --- a/IkiWiki/Plugin/teximg.pm +++ b/IkiWiki/Plugin/teximg.pm @@ -11,9 +11,18 @@ use HTML::Entities; use IkiWiki 2.00; sub import { #{{{ + hook(type => "getsetup", id => "teximg", call => \&getsetup); hook(type => "preprocess", id => "teximg", call => \&preprocess); } #}}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => undef, + }, +} #}}} + sub preprocess (@) { #{{{ my %params = @_; diff --git a/IkiWiki/Plugin/textile.pm b/IkiWiki/Plugin/textile.pm index 208f295d2..bbd282f0c 100644 --- a/IkiWiki/Plugin/textile.pm +++ b/IkiWiki/Plugin/textile.pm @@ -10,9 +10,18 @@ use IkiWiki 2.00; use Encode; sub import { #{{{ + hook(type => "getsetup", id => "textile", call => \&getsetup); hook(type => "htmlize", id => "txtl", call => \&htmlize); } # }}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => 1, # format plugin + }, +} #}}} + sub htmlize (@) { #{{{ my %params=@_; my $content = decode_utf8(encode_utf8($params{content})); diff --git a/IkiWiki/Plugin/tla.pm b/IkiWiki/Plugin/tla.pm index 1c2763359..0a5c161b2 100644 --- a/IkiWiki/Plugin/tla.pm +++ b/IkiWiki/Plugin/tla.pm @@ -31,6 +31,10 @@ sub checkconfig () { #{{{ sub getsetup () { #{{{ return + plugin => { + safe => 0, # rcs plugin + rebuild => undef, + }, tla_wrapper => { type => "string", #example => "", # TODO example diff --git a/IkiWiki/Plugin/toc.pm b/IkiWiki/Plugin/toc.pm index 639cae4a9..dff9d9aa5 100644 --- a/IkiWiki/Plugin/toc.pm +++ b/IkiWiki/Plugin/toc.pm @@ -8,10 +8,19 @@ use IkiWiki 2.00; use HTML::Parser; sub import { #{{{ + hook(type => "getsetup", id => "toc", call => \&getsetup); hook(type => "preprocess", id => "toc", call => \&preprocess); hook(type => "format", id => "toc", call => \&format); } # }}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => undef, + }, +} #}}} + my %tocpages; sub preprocess (@) { #{{{ diff --git a/IkiWiki/Plugin/toggle.pm b/IkiWiki/Plugin/toggle.pm index e203defb0..610d38e3a 100644 --- a/IkiWiki/Plugin/toggle.pm +++ b/IkiWiki/Plugin/toggle.pm @@ -60,6 +60,7 @@ function getElementsByClass(cls, node, tag) { EOF sub import { #{{{ + hook(type => "getsetup", id => "toggle", call => \&getsetup); hook(type => "preprocess", id => "toggle", call => \&preprocess_toggle); hook(type => "preprocess", id => "toggleable", @@ -67,6 +68,14 @@ sub import { #{{{ hook(type => "format", id => "toggle", call => \&format); } # }}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => undef, + }, +} #}}} + sub genid ($$) { #{{{ my $page=shift; my $id=shift; diff --git a/IkiWiki/Plugin/txt.pm b/IkiWiki/Plugin/txt.pm index 3aad5fa07..e4c9e5d6a 100644 --- a/IkiWiki/Plugin/txt.pm +++ b/IkiWiki/Plugin/txt.pm @@ -14,7 +14,8 @@ use HTML::Entities; my $findurl=0; sub import { - hook(type => "filter", id => "txt", call => \&filter); + hook(type => "getsetup", id => "txt", call => \&getsetup); + hook(type => "filter", id => "txt", call => \&filter); hook(type => "htmlize", id => "txt", call => \&htmlize); eval q{use URI::Find}; @@ -23,6 +24,14 @@ sub import { } } +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => 1, # format plugin + }, +} #}}} + # We use filter to convert raw text to HTML # (htmlize is called after other plugins insert HTML) sub filter (@) { diff --git a/IkiWiki/Plugin/typography.pm b/IkiWiki/Plugin/typography.pm index 3964d266d..27089b390 100644 --- a/IkiWiki/Plugin/typography.pm +++ b/IkiWiki/Plugin/typography.pm @@ -24,6 +24,10 @@ sub getsetup () { #{{{ error($@) if $@; return + plugin => { + safe => 1, + rebuild => 1, + }, typographyattributes => { type => "string", example => "3", diff --git a/IkiWiki/Plugin/version.pm b/IkiWiki/Plugin/version.pm index f96d2df06..18e9613ae 100644 --- a/IkiWiki/Plugin/version.pm +++ b/IkiWiki/Plugin/version.pm @@ -7,10 +7,19 @@ use strict; use IkiWiki 2.00; sub import { #{{{ + hook(type => "getsetup", id => "version", call => \&getsetup); hook(type => "needsbuild", id => "version", call => \&needsbuild); hook(type => "preprocess", id => "version", call => \&preprocess); } # }}} +sub getsetup () { #{{{ + return + plugin => { + safe => 1, + rebuild => undef, + }, +} #}}} + sub needsbuild (@) { #{{{ my $needsbuild=shift; foreach my $page (keys %pagestate) { diff --git a/IkiWiki/Plugin/websetup.pm b/IkiWiki/Plugin/websetup.pm index 47715b859..da2551489 100644 --- a/IkiWiki/Plugin/websetup.pm +++ b/IkiWiki/Plugin/websetup.pm @@ -15,6 +15,10 @@ sub import { #{{{ sub getsetup () { #{{{ return + plugin => { + safe => 1, + rebuild => 0, + }, websetup_force_plugins => { type => "string", example => [], diff --git a/IkiWiki/Plugin/wikitext.pm b/IkiWiki/Plugin/wikitext.pm index e1d346ae6..c47ccb7b1 100644 --- a/IkiWiki/Plugin/wikitext.pm +++ b/IkiWiki/Plugin/wikitext.pm @@ -7,9 +7,19 @@ use strict; use IkiWiki 2.00; sub import { #{{{ + hook(type => "getsetup", id => "wiki", call => \&getsetup); hook(type => "htmlize", id => "wiki", call => \&htmlize); } # }}} +sub getsetup () { #{{{ + return + plugin => { + safe => 0, # format plugin + rebuild => undef, + }, +} #}}} + + sub htmlize (@) { #{{{ my %params=@_; my $content = $params{content};