From 525825dab19e80424d3069ff32869c7992459312 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 14 Sep 2008 16:23:39 -0300 Subject: [PATCH] add support for about_comments page --- IkiWiki/Plugin/postal.pm | 13 ++++++++++--- examples/page.tmpl | 3 +++ test-wiki/in/about_comments.mdwn | 5 +++++ 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 test-wiki/in/about_comments.mdwn diff --git a/IkiWiki/Plugin/postal.pm b/IkiWiki/Plugin/postal.pm index e1e00d72e..125d35111 100644 --- a/IkiWiki/Plugin/postal.pm +++ b/IkiWiki/Plugin/postal.pm @@ -49,21 +49,28 @@ sub pagetemplate (@) my $subpage_name=$config{postal_pagename} || "comments"; my $comment_page=$destpage . "/" . $subpage_name; - add_depends($params{page},$comment_page); + + my $about_link=undef; + my $about_page=bestlink($page,"about_comments"); + + if ($about_page){ + $about_link=htmllink($page,$destpage,$about_page, + linktext=>gettext("About Comments")); + } + my $comment_link=undef; if (exists $pagesources{$comment_page}){ $comment_link=htmllink($page,$destpage,$comment_page, linktext=>gettext("Read Comments")); } - debug("comment_link=".$comment_link) if (defined($comment_link)); - $template->param(POSTAL_DIV=>1, POSTAL_PREFIX=>$config{postal_prefix}, POSTAL_KEY=>$key, POSTAL_HOST=>$config{postal_host}, + defined($about_link) ? (POSTAL_ABOUT_LINK=>$about_link):(), defined($comment_link) ? (POSTAL_COMMENT_LINK=>$comment_link) :()); } diff --git a/examples/page.tmpl b/examples/page.tmpl index 805f6ca4a..246a8778a 100644 --- a/examples/page.tmpl +++ b/examples/page.tmpl @@ -89,6 +89,9 @@ Links:
+ + + @">Send Comment diff --git a/test-wiki/in/about_comments.mdwn b/test-wiki/in/about_comments.mdwn new file mode 100644 index 000000000..eb1e07d94 --- /dev/null +++ b/test-wiki/in/about_comments.mdwn @@ -0,0 +1,5 @@ + +Comments on this wiki are sent by email, and will be read by a human +before posting. Your email address will not be displayed on the +wiki. If you don't want your real name to be displayed either, don't +put it in the From: header. -- 2.26.2