From: Joey Hess Date: Sat, 26 Jul 2008 04:38:13 +0000 (-0400) Subject: finish adding getsetup hooks to plugins X-Git-Tag: 2.60~223 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=84c905ec2011ec846d3d8b27f21f5ffd53c73840;p=ikiwiki.git finish adding getsetup hooks to plugins --- diff --git a/IkiWiki/Plugin/prettydate.pm b/IkiWiki/Plugin/prettydate.pm index be7e2c761..29330f29f 100644 --- a/IkiWiki/Plugin/prettydate.pm +++ b/IkiWiki/Plugin/prettydate.pm @@ -40,7 +40,7 @@ sub default_timetable { } sub import { #{{{ - hook(type => "getsetup", id => "getsetup", call => \&getsetup); + hook(type => "getsetup", id => "prettydate", call => \&getsetup); hook(type => "checkconfig", id => "prettydate", call => \&checkconfig); } # }}} diff --git a/IkiWiki/Plugin/recentchanges.pm b/IkiWiki/Plugin/recentchanges.pm index 8383fb72a..04a878b20 100644 --- a/IkiWiki/Plugin/recentchanges.pm +++ b/IkiWiki/Plugin/recentchanges.pm @@ -6,6 +6,7 @@ use strict; use IkiWiki 2.00; sub import { #{{{ + hook(type => "getsetup", id => "recentchanges", call => \&getsetup); hook(type => "checkconfig", id => "recentchanges", call => \&checkconfig); hook(type => "refresh", id => "recentchanges", call => \&refresh); hook(type => "pagetemplate", id => "recentchanges", call => \&pagetemplate); @@ -13,6 +14,24 @@ sub import { #{{{ hook(type => "cgi", id => "recentchanges", call => \&cgi); } #}}} +sub getsetup () { #{{{ + return + recentchangespage => { + type => "string", + default => "recentchanges", + description => "name of the recentchanges page", + safe => 1, + rebuild => 1, + }, + recentchangesnum => { + type => "int", + default => 100, + description => "number of changes to track", + safe => 1, + rebuild => 0, + }, +} #}}} + sub checkconfig () { #{{{ $config{recentchangespage}='recentchanges' unless defined $config{recentchangespage}; $config{recentchangesnum}=100 unless defined $config{recentchangesnum}; diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index eedfa6924..ff18e1faf 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -7,6 +7,7 @@ use strict; use IkiWiki 2.00; sub import { #{{{ + hook(type => "getsetup", id => "search", call => \&getsetup); hook(type => "checkconfig", id => "search", call => \&checkconfig); hook(type => "pagetemplate", id => "search", call => \&pagetemplate); hook(type => "postscan", id => "search", call => \&index); @@ -14,6 +15,17 @@ sub import { #{{{ hook(type => "cgi", id => "search", call => \&cgi); } # }}} +sub getsetup () { #{{{ + return + omega_cgi => { + type => "string", + default => "/usr/lib/cgi-bin/omega/omega", + description => "path to the omega cgi program", + safe => 0, # external program + rebuild => 0, + }, +} #}}} + sub checkconfig () { #{{{ foreach my $required (qw(url cgiurl)) { if (! length $config{$required}) { diff --git a/IkiWiki/Plugin/skeleton.pm.example b/IkiWiki/Plugin/skeleton.pm.example index 1af8e4e9d..716ba63dd 100644 --- a/IkiWiki/Plugin/skeleton.pm.example +++ b/IkiWiki/Plugin/skeleton.pm.example @@ -10,6 +10,7 @@ use IkiWiki 2.00; sub import { #{{{ hook(type => "getopt", id => "skeleton", call => \&getopt); + hook(type => "getsetup", id => "skeleton", call => \&getsetup); hook(type => "checkconfig", id => "skeleton", call => \&checkconfig); hook(type => "needsbuild", id => "skeleton", call => \&needsbuild); hook(type => "preprocess", id => "skeleton", call => \&preprocess); @@ -38,6 +39,17 @@ sub getopt () { #{{{ debug("skeleton plugin getopt"); } #}}} +sub getsetup () { #{{{ + return + skeleton => { + type => "boolean", + default => 0, + description => "example option", + safe => 0, + rebuild => 0, + }, +} #}}} + sub checkconfig () { #{{{ debug("skeleton plugin checkconfig"); } #}}} diff --git a/IkiWiki/Plugin/tag.pm b/IkiWiki/Plugin/tag.pm index b0a0e53be..d4cbb6705 100644 --- a/IkiWiki/Plugin/tag.pm +++ b/IkiWiki/Plugin/tag.pm @@ -10,6 +10,7 @@ my %tags; sub import { #{{{ hook(type => "getopt", id => "tag", call => \&getopt); + hook(type => "getsetup", id => "tag", call => \&getsetup); hook(type => "preprocess", id => "tag", call => \&preprocess_tag, scan => 1); hook(type => "preprocess", id => "taglink", call => \&preprocess_taglink, scan => 1); hook(type => "pagetemplate", id => "tag", call => \&pagetemplate); @@ -22,6 +23,18 @@ sub getopt () { #{{{ GetOptions("tagbase=s" => \$config{tagbase}); } #}}} +sub getsetup () { #{{{ + return + tagbase => { + type => "string", + default => "", + example => "tag", + description => "parent page tags are located under", + safe => 1, + rebuild => 1, + }, +} #}}} + sub tagpage ($) { #{{{ my $tag=shift; diff --git a/IkiWiki/Plugin/typography.pm b/IkiWiki/Plugin/typography.pm index fe6996898..8ae1f3445 100644 --- a/IkiWiki/Plugin/typography.pm +++ b/IkiWiki/Plugin/typography.pm @@ -8,6 +8,7 @@ use IkiWiki 2.00; sub import { #{{{ hook(type => "getopt", id => "typography", call => \&getopt); + hook(type => "getsetup", id => "typography", call => \&getsetup); IkiWiki::hook(type => "sanitize", id => "typography", call => \&sanitize); } # }}} @@ -18,6 +19,21 @@ sub getopt () { #{{{ GetOptions("typographyattributes=s" => \$config{typographyattributes}); } #}}} +sub getsetup () { #{{{ + eval q{use Text::Typography}; + error($@) if $@; + + return + typographyattributes => { + type => "string", + default => "3", + example => "tag", + description => "Text::Typography attributes value", + safe => 1, + rebuild => 1, + }, +} #}}} + sub sanitize (@) { #{{{ my %params=@_;