inline: Call indexhtml when inlining internal pages, so their text can be indexed...
authorJoey Hess <joey@kitenet.net>
Fri, 7 May 2010 03:20:48 +0000 (23:20 -0400)
committerJoey Hess <joey@kitenet.net>
Fri, 7 May 2010 03:20:48 +0000 (23:20 -0400)
IkiWiki/Plugin/inline.pm
IkiWiki/Plugin/search.pm
IkiWiki/Render.pm
debian/changelog
doc/plugins/write.mdwn

index 933e30646d51bc22fb377df5d288245008c94b38..715a3d6523cfcee4e57c125425d19cfdab110298 100644 (file)
@@ -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) {
index b1f4747fea804e1d9c5a5796058f844aa9d1ba00..c578b44ab2693326d083a640d18f8c88cf06b042 100644 (file)
@@ -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".
index 30e3d4199cd56b26cbf69529ca8d641d1d6ac7b2..b0bd8dee08f1f605f80526a5c72b71fa08928f27 100644 (file)
@@ -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;
index eb67c2bde2b71c60e8df658abca5eb13cfc42f78..10a4912aff954e7e91e4b9f9718310a23f410bd4 100644 (file)
@@ -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 <joeyh@debian.org>  Wed, 05 May 2010 18:07:29 -0400
 
index 7180237a41112a059c6a60e105d9801c886d0afe..1930055658b93a245cecff2cf5114fe882a065d5 100644 (file)
@@ -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