]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/search.pm
* Add -refresh option to ikiwiki-mass-rebuild and use that on upgrades that
[ikiwiki.git] / IkiWiki / Plugin / search.pm
index c71fef76e7fa65e810d27699f818f4a7caeb3a22..c94974ac4b608bfbf122f4455a0fe3fc0fcc71a6 100644 (file)
@@ -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{
 <form method="get" action="$IkiWiki::config{cgiurl}" id="searchform">
 <div>
 <input type="text" name="phrase" value="" size="16" />
@@ -32,7 +40,7 @@ sub checkconfig () { #{{{
 <input type="hidden" name="do" value="hyperestraier" />
 </div>
 </form>
-};
+});
 } #}}}
 
 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 {