From 121e2ffc2f25bf264a68d35e80a9386995fa9e5a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 6 May 2010 23:07:08 -0400 Subject: Renamed postscan hook to indexhtml, to reflect its changed position. Probably only the search plugin uses it, so this seemed safe. --- doc/plugins/po/discussion.mdwn | 2 +- doc/plugins/write.mdwn | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'doc/plugins') diff --git a/doc/plugins/po/discussion.mdwn b/doc/plugins/po/discussion.mdwn index ab822e76c..27683f1ea 100644 --- a/doc/plugins/po/discussion.mdwn +++ b/doc/plugins/po/discussion.mdwn @@ -513,7 +513,7 @@ finish it at some point in the first quarter of 2009. --[[intrigeri]] >>>> >>>>> Done. --[[intrigeri]] >>> -> * I'm very fearful of the `add_depends` in `postscan`. +> * I'm very fearful of the `add_depends` in `indexhtml`. > Does this make every page depend on every page that links > to it? Won't this absurdly bloat the dependency pagespecs > and slow everything down? And since nicepagetitle is given diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 3b1d770eb..7180237a4 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -39,7 +39,7 @@ built. Now that it knows what pages it needs to build, ikiwiki runs two compile passes. First, it runs `scan` hooks, which collect metadata about the pages. Then it runs a page rendering pipeline, by calling in turn these -hooks: `filter`, `preprocess`, `linkify`, `htmlize`, `postscan`, +hooks: `filter`, `preprocess`, `linkify`, `htmlize`, `indexhtml`, `pagetemplate`, `sanitize`, `format`. After all necessary pages are built, it calls the `change` hook. Finally, @@ -282,9 +282,9 @@ like `Makefile` that have no extension. If `hook` is passed an optional "longname" parameter, this value is used when prompting a user to choose a page type on the edit page form. -### postscan +### indexhtml - hook(type => "postscan", id => "foo", call => \&postscan); + hook(type => "indexhtml", id => "foo", call => \&indexhtml); 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 -- cgit v1.2.3 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 +- debian/changelog | 2 ++ doc/plugins/write.mdwn | 4 ++-- 5 files changed, 15 insertions(+), 6 deletions(-) (limited to 'doc/plugins') 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; diff --git a/debian/changelog b/debian/changelog index eb67c2bde..10a4912af 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,8 @@ ikiwiki (3.20100505) UNRELEASED; urgency=low * 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 Wed, 05 May 2010 18:07:29 -0400 diff --git a/doc/plugins/write.mdwn b/doc/plugins/write.mdwn index 7180237a4..193005565 100644 --- a/doc/plugins/write.mdwn +++ b/doc/plugins/write.mdwn @@ -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 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 -- cgit v1.2.3