comments: add a stub pagetemplate hook to show the comments

master
Simon McVittie 2008-11-23 12:04:00 +00:00
parent 3abfc1d71c
commit 404792c618
1 changed files with 16 additions and 0 deletions

View 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 ($$;@) {