From ea4967f184bf0a27eaa2dc81da1084780756156a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 6 May 2010 23:20:48 -0400 Subject: inline: Call indexhtml when inlining internal pages, so their text can be indexed for searching. --- IkiWiki/Plugin/inline.pm | 7 +++++++ IkiWiki/Plugin/search.pm | 6 +++--- IkiWiki/Render.pm | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 933e30646..715a3d652 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -476,6 +476,13 @@ sub get_inline_content ($$) { 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) { diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index b1f4747fe..c578b44ab 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -10,7 +10,7 @@ sub import { 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); } @@ -68,7 +68,7 @@ sub pagetemplate (@) { my $scrubber; my $stemmer; -sub index (@) { +sub indexhtml (@) { my %params=@_; setupfiles(); @@ -117,7 +117,7 @@ sub index (@) { 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". diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 30e3d4199..b0bd8dee0 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -63,7 +63,7 @@ sub genpage ($$) { my $content=shift; run_hooks(indexhtml => sub { - shift->(page => $page, content => $content); + shift->(page => $page, destpage => $page, content => $content); }); my $templatefile; -- cgit v1.2.3