diff options
author | Joey Hess <joey@gnu.kitenet.net> | 2008-12-17 17:05:49 -0500 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2008-12-17 17:05:49 -0500 |
commit | 9b837fd5ed984f0947bc3e1f4478384b3b1691fd (patch) | |
tree | a2296cf8399f0a53f9a7365ca804387f69316f5c /IkiWiki/Plugin | |
parent | 60142db48ebbd540e5310c5bcaa4762676c8ddce (diff) |
fix default values for config settings
defaults cannot be set in getsetup, do it in checkconfig to avoid
uninitialized value warnings.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r-- | IkiWiki/Plugin/comments.pm | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 6184c6031..83f67869c 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -39,7 +39,6 @@ sub getsetup () { comments_shown_pagespec => { type => 'pagespec', example => 'blog/*', - default => '', description => 'PageSpec for pages where comments will be shown inline', link => 'ikiwiki/PageSpec', safe => 1, @@ -48,7 +47,6 @@ sub getsetup () { comments_open_pagespec => { type => 'pagespec', example => 'blog/* and created_after(close_old_comments)', - default => '', description => 'PageSpec for pages where new comments can be posted', link => 'ikiwiki/PageSpec', safe => 1, @@ -56,7 +54,6 @@ sub getsetup () { }, comments_pagename => { type => 'string', - example => 'comment_', default => 'comment_', description => 'Base name for comments, e.g. "comment_" for pages like "sandbox/comment_12"', safe => 0, # manual page moving required @@ -64,7 +61,6 @@ sub getsetup () { }, comments_allowdirectives => { type => 'boolean', - default => 0, example => 0, description => 'Interpret directives in comments?', safe => 1, @@ -72,7 +68,6 @@ sub getsetup () { }, comments_allowauthor => { type => 'boolean', - default => 0, example => 0, description => 'Allow anonymous commenters to set an author name?', safe => 1, @@ -81,7 +76,6 @@ sub getsetup () { comments_commit => { type => 'boolean', example => 1, - default => 1, description => 'commit comments to the VCS', # old uncommitted comments are likely to cause # confusion if this is changed @@ -90,6 +84,17 @@ sub getsetup () { }, } +sub checkconfig () { + $config{comments_commit} = 1 + unless defined $config{comments_commit}; + $config{comments_shown_pagespec} = '' + unless defined $config{comments_shown_pagespec}; + $config{comments_open_pagespec} = '' + unless defined $config{comments_open_pagespec}; + $config{comments_pagename} = 'comment_' + unless defined $config{comments_pagename}; +} + sub htmlize { my %params = @_; return $params{content}; @@ -208,12 +213,6 @@ sub preprocess { return $content; } -sub checkconfig () { - $config{comments_commit} = 1 unless defined $config{comments_commit}; - $config{comments_pagename} = 'comment_' - unless defined $config{comments_pagename}; -} - # This is exactly the same as recentchanges_link :-( sub linkcgi ($) { my $cgi=shift; |