X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/af9566ff1ae55d273ff96c7ca39e34265623a55d..c20c4066311341e332dc425023f856b6414de9ae:/IkiWiki/Plugin/search.pm diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index c71fef76e..c94974ac4 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -9,10 +9,12 @@ use IkiWiki; sub import { #{{{ IkiWiki::hook(type => "checkconfig", id => "hyperestraier", call => \&checkconfig); + IkiWiki::hook(type => "pagetemplate", id => "hyperestraier", + call => \&pagetemplate); IkiWiki::hook(type => "delete", id => "hyperestraier", call => \&delete); - IkiWiki::hook(type => "render", id => "hyperestraier", - call => \&render); + IkiWiki::hook(type => "change", id => "hyperestraier", + call => \&change); IkiWiki::hook(type => "cgi", id => "hyperestraier", call => \&cgi); } # }}} @@ -23,8 +25,14 @@ sub checkconfig () { #{{{ IkiWiki::error("Must specify $required when using the search plugin\n"); } } +} #}}} + +sub pagetemplate ($$) { #{{{ + my $page=shift; + my $template=shift; - $IkiWiki::config{headercontent}.=qq{ + # Add search box to page header. + $template->param(searchform => qq{
@@ -32,7 +40,7 @@ sub checkconfig () { #{{{
-}; +}); } #}}} sub delete (@) { #{{{ @@ -41,7 +49,7 @@ sub delete (@) { #{{{ IkiWiki::estcfg(); } #}}} -sub render (@) { #{{{ +sub change (@) { #{{{ IkiWiki::debug("updating hyperestraier search index"); IkiWiki::estcmd("gather -cm -bc -cl -sd", map {