comments: Use a checkconfig hook to get the default value of comments_pagename
authorSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Sun, 23 Nov 2008 17:42:50 +0000 (17:42 +0000)
committerSimon McVittie <smcv@ http://smcv.pseudorandom.co.uk/>
Thu, 11 Dec 2008 21:14:04 +0000 (21:14 +0000)
IkiWiki/Plugin/comments.pm

index 33d8ca8e212aaf4b907c922b6e75cc6897b6b86a..4cd76c5d5934364c4ff60cd596e1d2c1ac5bf42a 100644 (file)
@@ -14,6 +14,7 @@ use constant POST_COMMENT => "Post comment";
 use constant CANCEL => "Cancel";
 
 sub import { #{{{
+       hook(type => "checkconfig", id => 'comments',  call => \&checkconfig);
        hook(type => "getsetup", id => 'comments',  call => \&getsetup);
        hook(type => "preprocess", id => 'comments', call => \&preprocess);
        hook(type => "sessioncgi", id => 'comment', call => \&sessioncgi);
@@ -83,6 +84,12 @@ sub getsetup () { #{{{
                },
 } #}}}
 
+sub checkconfig () { #{{{
+       $config{comments_commit} = 1 unless defined $config{comments_commit};
+       $config{comments_pagename} = 'comment_'
+               unless defined $config{comments_pagename};
+} #}}}
+
 # Somewhat based on IkiWiki::Plugin::inline blog posting support
 sub preprocess (@) { #{{{
        my %params=@_;