]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
initial key construction, example configs
authorDavid Bremner <bremner@unb.ca>
Fri, 20 Jun 2008 20:26:26 +0000 (22:26 +0200)
committerDavid Bremner <bremner@unb.ca>
Fri, 20 Jun 2008 20:26:26 +0000 (22:26 +0200)
IkiWiki/Plugin/postal.pm
examples/comments.mdwn [new file with mode: 0644]
examples/page.tmpl.snippet [new file with mode: 0644]

index e5915afe863e31f6a37e7492b01f240b14467a6e..57f87914841de230c53b1c51b7456848f0db6404 100644 (file)
@@ -31,6 +31,9 @@ package IkiWiki::Plugin::postal;
 use warnings;
 use strict;
 use IkiWiki 2.00;
+use Compress::LZF ;
+use MIME::Base64::URLSafe; 
+
 \f
 sub import
 {
@@ -48,17 +51,23 @@ sub pagetemplate (@)
     if ($template->query (name => "comments") &&
        ! defined $template->param ('comments'))
     {
-       debug('got template');
+       debug("adding comments to ".$page);
+       my $key = urlsafe_b64encode(compress($page));
+       debug("using key ".$key);
+
+
        my $content;
        my $comment_page = bestlink ($page, "comments") || return;
        my $comment_file = $pagesources{$comment_page} || return;
        #my $pagetype = pagetype ($comment_file);
        # Check if ``$pagetype eq 'html'''?
        $content = readfile (srcfile ($comment_file));
-
        if (defined $content && length $content)
        {
-           debug('got comment file');
+           $content =~ s/%%KEY%%/$key/g;
+
+           debug("comment blurb: ". $content);
+
            $template->param (comments =>
              IkiWiki::linkify ($page, $destpage, $content))
        }
diff --git a/examples/comments.mdwn b/examples/comments.mdwn
new file mode 100644 (file)
index 0000000..65435ea
--- /dev/null
@@ -0,0 +1,3 @@
+<a href="mailto:bremner-comment-%%KEY%%@pivot.cs.unb.ca">Send Comment</a>
+
+[[Read Comments|comments/%%KEY%%]]
diff --git a/examples/page.tmpl.snippet b/examples/page.tmpl.snippet
new file mode 100644 (file)
index 0000000..fd410dd
--- /dev/null
@@ -0,0 +1,7 @@
+<TMPL_IF COMMENTS>
+<div class="pagecomments">
+<a name="pagecomments"></a>
+<TMPL_VAR COMMENTS>
+</div>
+</TMPL_IF>
+