]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/search.pm
* Change htmlize, format, and sanitize hooks to use named parameters.
[git.ikiwiki.info.git] / IkiWiki / Plugin / search.pm
index 94b37ca06ef034ea93445da6f27a21ef033ef127..c8e0dd580224a7dc810208c1ac3f294633b1f5ab 100644 (file)
@@ -27,20 +27,22 @@ sub checkconfig () { #{{{
        }
 } #}}}
 
-sub pagetemplate ($$) { #{{{
-       my $page=shift;
-       my $template=shift;
+my $form;
+sub pagetemplate (@) { #{{{
+       my %params=@_;
+       my $page=$params{page};
+       my $template=$params{template};
 
        # 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" />
-<input type="hidden" name="enc" value="UTF-8" />
-<input type="hidden" name="do" value="hyperestraier" />
-</div>
-</form>
-});
+       if ($template->query(name => "searchform")) {
+               if (! defined $form) {
+                       my $searchform = IkiWiki::template("searchform.tmpl", blind_cache => 1);
+                       $searchform->param(searchaction => $IkiWiki::config{cgiurl});
+                       $form=$searchform->output;
+               }
+
+               $template->param(searchform => $form);
+       }
 } #}}}
 
 sub delete (@) { #{{{
@@ -53,7 +55,7 @@ sub change (@) { #{{{
        IkiWiki::debug("updating hyperestraier search index");
        IkiWiki::estcmd("gather -cm -bc -cl -sd",
                map {
-                       $IkiWiki::config{destdir}."/".$IkiWiki::renderedfiles{IkiWiki::pagename($_)}
+                       Encode::encode_utf8($IkiWiki::config{destdir}."/".$IkiWiki::renderedfiles{IkiWiki::pagename($_)})
                } @_
        );
        IkiWiki::estcfg();