]> sipb.mit.edu Git - ikiwiki.git/commitdiff
comments: add a stub pagetemplate hook to show the comments
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Sun, 23 Nov 2008 12:04:00 +0000 (12:04 +0000)
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Thu, 11 Dec 2008 21:14:03 +0000 (21:14 +0000)
IkiWiki/Plugin/comments.pm

index a68026ebc9ec09359015366d5a90d06de5c4044c..ea106a90fda800c686cb6a1379408ec2b0853a81 100644 (file)
@@ -18,6 +18,7 @@ sub import { #{{{
        hook(type => "preprocess", id => 'comments', call => \&preprocess);
        hook(type => "sessioncgi", id => 'comment', call => \&sessioncgi);
        hook(type => "htmlize", id => "_comment", call => \&htmlize);
+       hook(type => "pagetemplate", id => "comments", call => \&pagetemplate);
        IkiWiki::loadplugin("inline");
        IkiWiki::loadplugin("mdwn");
 } # }}}
@@ -344,6 +345,21 @@ sub sessioncgi ($$) { #{{{
        exit;
 } #}}}
 
+sub pagetemplate (@) { #{{{
+       my %params = @_;
+
+       my $page = $params{page};
+       my $template = $params{template};
+
+       if ($template->query(name => 'comments')) {
+               my $comments = undef;
+
+               if (defined $comments && length $comments) {
+                       $template->param(name => $comments);
+               }
+       }
+} # }}}
+
 package IkiWiki::PageSpec;
 
 sub match_postcomment ($$;@) {