X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/dfedb0351d154cd1d58e719012f4b1dda3a07666..e0832eefeaf790bc2bfc2b98c24413c4514557b4:/IkiWiki/Plugin/search.pm diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index 2d8c3d4e1..3cfc301e2 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -7,6 +7,8 @@ use strict; use IkiWiki; sub import { #{{{ + hook(type => "getopt", id => "hyperestraier", + call => \&getopt); hook(type => "checkconfig", id => "hyperestraier", call => \&checkconfig); hook(type => "pagetemplate", id => "hyperestraier", @@ -19,6 +21,13 @@ sub import { #{{{ call => \&cgi); } # }}} +sub getopt () { #{{{ + eval q{use Getopt::Long}; + error($@) if $@; + Getopt::Long::Configure('pass_through'); + GetOptions("estseek=s" => \$config{estseek}); +} #}}} + sub checkconfig () { #{{{ foreach my $required (qw(url cgiurl)) { if (! length $config{$required}) { @@ -55,7 +64,8 @@ sub change (@) { #{{{ debug("updating hyperestraier search index"); estcmd("gather -cm -bc -cl -sd", map { - Encode::encode_utf8($config{destdir}."/".$renderedfiles{pagename($_)}) + Encode::encode_utf8($config{destdir}."/".$_) + foreach @{$renderedfiles{pagename($_)}}; } @_ ); estcfg(); @@ -99,8 +109,9 @@ sub estcfg () { #{{{ close TEMPLATE; $cgi="$estdir/".IkiWiki::basename($config{cgiurl}); unlink($cgi); - symlink("/usr/lib/estraier/estseek.cgi", $cgi) || - error("symlink $cgi: $!"); + my $estseek = defined $config{estseek} ? $config{estseek} : '/usr/lib/estraier/estseek.cgi'; + symlink($estseek, $cgi) || + error("symlink $estseek $cgi: $!"); } # }}} sub estcmd ($;@) { #{{{