inline: Call indexhtml when inlining internal pages, so their text can be indexed for searching.
parent
121e2ffc2f
commit
ea4967f184
|
@ -476,6 +476,13 @@ sub get_inline_content ($$) {
|
||||||
filter($page, $destpage,
|
filter($page, $destpage,
|
||||||
readfile(srcfile($file))))));
|
readfile(srcfile($file))))));
|
||||||
$nested--;
|
$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) {
|
if ($cached_destpage ne $destpage) {
|
||||||
|
|
|
@ -10,7 +10,7 @@ sub import {
|
||||||
hook(type => "getsetup", id => "search", call => \&getsetup);
|
hook(type => "getsetup", id => "search", call => \&getsetup);
|
||||||
hook(type => "checkconfig", id => "search", call => \&checkconfig);
|
hook(type => "checkconfig", id => "search", call => \&checkconfig);
|
||||||
hook(type => "pagetemplate", id => "search", call => \&pagetemplate);
|
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 => "delete", id => "search", call => \&delete);
|
||||||
hook(type => "cgi", id => "search", call => \&cgi);
|
hook(type => "cgi", id => "search", call => \&cgi);
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ sub pagetemplate (@) {
|
||||||
|
|
||||||
my $scrubber;
|
my $scrubber;
|
||||||
my $stemmer;
|
my $stemmer;
|
||||||
sub index (@) {
|
sub indexhtml (@) {
|
||||||
my %params=@_;
|
my %params=@_;
|
||||||
|
|
||||||
setupfiles();
|
setupfiles();
|
||||||
|
@ -117,7 +117,7 @@ sub index (@) {
|
||||||
eval q{use HTML::Entities};
|
eval q{use HTML::Entities};
|
||||||
error $@ if $@;
|
error $@ if $@;
|
||||||
$doc->set_data(
|
$doc->set_data(
|
||||||
"url=".urlto($params{page}, "")."\n".
|
"url=".urlto($params{destpage}, "")."\n".
|
||||||
"sample=".decode_entities($sample)."\n".
|
"sample=".decode_entities($sample)."\n".
|
||||||
"caption=".decode_entities($caption)."\n".
|
"caption=".decode_entities($caption)."\n".
|
||||||
"modtime=$IkiWiki::pagemtime{$params{page}}\n".
|
"modtime=$IkiWiki::pagemtime{$params{page}}\n".
|
||||||
|
|
|
@ -63,7 +63,7 @@ sub genpage ($$) {
|
||||||
my $content=shift;
|
my $content=shift;
|
||||||
|
|
||||||
run_hooks(indexhtml => sub {
|
run_hooks(indexhtml => sub {
|
||||||
shift->(page => $page, content => $content);
|
shift->(page => $page, destpage => $page, content => $content);
|
||||||
});
|
});
|
||||||
|
|
||||||
my $templatefile;
|
my $templatefile;
|
||||||
|
|
|
@ -7,6 +7,8 @@ ikiwiki (3.20100505) UNRELEASED; urgency=low
|
||||||
* Gave comment and page editing forms some CSS and accessability love.
|
* Gave comment and page editing forms some CSS and accessability love.
|
||||||
* Renamed postscan hook to indexhtml, to reflect its changed position,
|
* Renamed postscan hook to indexhtml, to reflect its changed position,
|
||||||
and typical use.
|
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
|
-- Joey Hess <joeyh@debian.org> Wed, 05 May 2010 18:07:29 -0400
|
||||||
|
|
||||||
|
|
|
@ -290,8 +290,8 @@ This hook is called once the page has been converted to html (but before
|
||||||
the generated html is put in a template). The most common use is to
|
the generated html is put in a template). The most common use is to
|
||||||
update search indexes. Added in ikiwiki 2.54.
|
update search indexes. Added in ikiwiki 2.54.
|
||||||
|
|
||||||
The function is passed named parameters "page" and "content". Its return
|
The function is passed named parameters "page", "destpage", and "content".
|
||||||
value is ignored.
|
Its return value is ignored.
|
||||||
|
|
||||||
### pagetemplate
|
### pagetemplate
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue