From 7e3fb8b8a230a725df7814c15745c6fee9ddd5b1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 5 Jul 2010 20:19:31 -0400 Subject: [PATCH] comments: Added commentmoderation directive for easy linking to the comment moderation queue. --- IkiWiki/Plugin/comments.pm | 17 +++++++++++++++++ debian/changelog | 2 ++ doc/examples/blog/comments.mdwn | 2 +- doc/ikiwiki/directive/commentmoderation.mdwn | 9 +++++++++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 doc/ikiwiki/directive/commentmoderation.mdwn diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 30ade5634..f0eec9ace 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -22,6 +22,7 @@ sub import { hook(type => "checkconfig", id => 'comments', call => \&checkconfig); hook(type => "getsetup", id => 'comments', call => \&getsetup); hook(type => "preprocess", id => 'comment', call => \&preprocess); + hook(type => "preprocess", id => 'commentmoderation', call => \&preprocess_moderation); # here for backwards compatability with old comments hook(type => "preprocess", id => '_comment', call => \&preprocess); hook(type => "sessioncgi", id => 'comment', call => \&sessioncgi); @@ -251,6 +252,22 @@ sub preprocess { return $content; } +sub preprocess_moderation { + my %params = @_; + + $params{desc}=gettext("Comment Moderation") + unless defined $params{desc}; + + if (length $config{cgiurl}) { + return ''.$params{desc}.''; + } + else { + return $params{desc}; + } +} + sub sessioncgi ($$) { my $cgi=shift; my $session=shift; diff --git a/debian/changelog b/debian/changelog index d426be019..18db7c0c2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ ikiwiki (3.20100705) UNRELEASED; urgency=low * img: Add a margin around images displayed by this directive. + * comments: Added commentmoderation directive for easy linking to the + comment moderation queue. -- Joey Hess Mon, 05 Jul 2010 13:59:42 -0400 diff --git a/doc/examples/blog/comments.mdwn b/doc/examples/blog/comments.mdwn index 52c7d3132..e22b50a34 100644 --- a/doc/examples/blog/comments.mdwn +++ b/doc/examples/blog/comments.mdwn @@ -1,7 +1,7 @@ [[!sidebar content=""" [[!inline pages="comment_pending(./posts/*)" feedfile=pendingmoderation description="comments pending moderation" show=-1]] -Comments in the moderation queue: +Comments in the [[!commentmoderation desc="moderation queue"]]: [[!pagecount pages="comment_pending(./posts/*)"]] """]] diff --git a/doc/ikiwiki/directive/commentmoderation.mdwn b/doc/ikiwiki/directive/commentmoderation.mdwn new file mode 100644 index 000000000..8553b5b17 --- /dev/null +++ b/doc/ikiwiki/directive/commentmoderation.mdwn @@ -0,0 +1,9 @@ +The `commentmoderation` directive is supplied by the +[[!iki plugins/comments desc=comments]] plugin, and is used to link +to the comment moderation queue. + +Example: + + \[[!commentmoderation desc="here is the comment moderation queue"]] + +[[!meta robots="noindex, follow"]] -- 2.44.0