filter($page, $destpage,
readfile(srcfile($file))))));
$nested--;
+ if (isinternal($page)) {
+ # make inlined text of internal pages searchable
+ run_hooks(indexhtml => sub {
+ shift->(page => $page, destpage => $page,
+ content => $ret);
+ });
+ }
}
if ($cached_destpage ne $destpage) {
hook(type => "getsetup", id => "search", call => \&getsetup);
hook(type => "checkconfig", id => "search", call => \&checkconfig);
hook(type => "pagetemplate", id => "search", call => \&pagetemplate);
- hook(type => "indexhtml", id => "search", call => \&index);
+ hook(type => "indexhtml", id => "search", call => \&indexhtml);
hook(type => "delete", id => "search", call => \&delete);
hook(type => "cgi", id => "search", call => \&cgi);
}
my $scrubber;
my $stemmer;
-sub index (@) {
+sub indexhtml (@) {
my %params=@_;
setupfiles();
eval q{use HTML::Entities};
error $@ if $@;
$doc->set_data(
- "url=".urlto($params{page}, "")."\n".
+ "url=".urlto($params{destpage}, "")."\n".
"sample=".decode_entities($sample)."\n".
"caption=".decode_entities($caption)."\n".
"modtime=$IkiWiki::pagemtime{$params{page}}\n".
my $content=shift;
run_hooks(indexhtml => sub {
- shift->(page => $page, content => $content);
+ shift->(page => $page, destpage => $page, content => $content);
});
my $templatefile;
* Gave comment and page editing forms some CSS and accessability love.
* Renamed postscan hook to indexhtml, to reflect its changed position,
and typical use.
+ * inline: Call indexhtml when inlining internal pages, so their
+ text can be indexed for searching.
-- Joey Hess <joeyh@debian.org> Wed, 05 May 2010 18:07:29 -0400
the generated html is put in a template). The most common use is to
update search indexes. Added in ikiwiki 2.54.
-The function is passed named parameters "page" and "content". Its return
-value is ignored.
+The function is passed named parameters "page", "destpage", and "content".
+Its return value is ignored.
### pagetemplate