diff options
author | Simon McVittie <smcv@ http://smcv.pseudorandom.co.uk/> | 2008-11-23 12:04:00 +0000 |
---|---|---|
committer | Simon McVittie <smcv@ http://smcv.pseudorandom.co.uk/> | 2008-12-11 21:14:03 +0000 |
commit | 404792c61840c974faca9230ab9005c7b8dd30d1 (patch) | |
tree | cec0e52768d246ee3267ee0ff3430460da42ede0 | |
parent | 3abfc1d71c914035deff75a4373041cb9962a471 (diff) |
comments: add a stub pagetemplate hook to show the comments
-rw-r--r-- | IkiWiki/Plugin/comments.pm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index a68026ebc..ea106a90f 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -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 ($$;@) { |