]> 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 c79d4046954535ce340169cf9169b89c1e75ba6a..c8e0dd580224a7dc810208c1ac3f294633b1f5ab 100644 (file)
@@ -27,6 +27,7 @@ sub checkconfig () { #{{{
        }
 } #}}}
 
+my $form;
 sub pagetemplate (@) { #{{{
        my %params=@_;
        my $page=$params{page};
@@ -34,15 +35,13 @@ sub pagetemplate (@) { #{{{
 
        # Add search box to page header.
        if ($template->query(name => "searchform")) {
-               $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 (! defined $form) {
+                       my $searchform = IkiWiki::template("searchform.tmpl", blind_cache => 1);
+                       $searchform->param(searchaction => $IkiWiki::config{cgiurl});
+                       $form=$searchform->output;
+               }
+
+               $template->param(searchform => $form);
        }
 } #}}}
 
@@ -56,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();