finish adding getsetup hooks to plugins

master
Joey Hess 2008-07-26 00:38:13 -04:00
parent b74b7ab68b
commit 84c905ec20
6 changed files with 73 additions and 1 deletions

View File

@ -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);
} # }}}

View File

@ -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};

View File

@ -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}) {

View File

@ -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");
} #}}}

View File

@ -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;

View File

@ -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=@_;