diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-07-30 00:20:11 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2006-07-30 00:20:11 +0000 |
commit | ab75c0323bc584203a2b4a507c2a2012523354d0 (patch) | |
tree | ff4f82fd125bb7976b74d88520bd3cb847fc814d /IkiWiki/Plugin | |
parent | 584fe78075793b2b5dc2992125e88188cae0d1c7 (diff) |
* Add a run_hooks function for the common task of running all hooks of a
given type.
* Add a savestate hook.
* Don't put blog post forms on pages if there's no cgiurl set.
* Reformat front page.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/inline.pm | 26 | ||||
-rw-r--r-- | IkiWiki/Plugin/skeleton.pm | 6 |
2 files changed, 15 insertions, 17 deletions
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 427c25a96..7bb71a436 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -58,7 +58,7 @@ sub preprocess_inline (@) { #{{{ my $ret=""; - if (exists $params{rootpage}) { + if (exists $params{rootpage} && $config{cgiurl}) { # Add a blog post form, with a rss link button. my $formtemplate=template("blogpost.tmpl", blind_cache => 1); $formtemplate->param(cgiurl => $config{cgiurl}); @@ -88,15 +88,10 @@ sub preprocess_inline (@) { #{{{ if $params{archive} eq "no"; $template->param(ctime => displaytime($pagectime{$page})); - if (exists $hooks{pagetemplate}) { - foreach my $id (keys %{$hooks{pagetemplate}}) { - $hooks{pagetemplate}{$id}{call}->( - page => $page, - destpage => $params{page}, - template => $template, - ); - } - } + run_hooks(pagetemplate => sub { + shift->(page => $page, destpage => $params{page}, + template => $template,); + }); $ret.=$template->output; $template->clear_params; @@ -181,13 +176,10 @@ sub genrss ($@) { #{{{ items => \@items, ); - foreach my $id (keys %{$hooks{pagetemplate}}) { - $hooks{pagetemplate}{$id}{call}->( - page => $page, - destpage => $page, - template => $template, - ); - } + run_hooks(pagetemplate => sub { + shift->(page => $page, destpage => $page, + template => $template); + }); return $template->output; } #}}} diff --git a/IkiWiki/Plugin/skeleton.pm b/IkiWiki/Plugin/skeleton.pm index 27da50e6f..e63bab6d7 100644 --- a/IkiWiki/Plugin/skeleton.pm +++ b/IkiWiki/Plugin/skeleton.pm @@ -29,6 +29,8 @@ sub import { #{{{ call => \&change); IkiWiki::hook(type => "cgi", id => "skeleton", call => \&cgi); + IkiWiki::hook(type => "cgi", id => "savestate", + call => \&savestate); } # }}} sub getopt () { #{{{ @@ -95,4 +97,8 @@ sub cgi ($) { #{{{ IkiWiki::debug("skeleton plugin running in cgi"); } #}}} +sub savestate () { #{{{ + IkiWiki::debug("skeleton plugin running in savestate"); +} #}}} + 1 |