X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/15ec55eff58d056704b7911d8ed3975a4f09d65c..9b837fd5ed984f0947bc3e1f4478384b3b1691fd:/IkiWiki/Plugin/comments.pm?ds=inline diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 1eb256da9..83f67869c 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -17,7 +17,7 @@ use constant CANCEL => "Cancel"; my $postcomment; -sub import { #{{{ +sub import { hook(type => "checkconfig", id => 'comments', call => \&checkconfig); hook(type => "getsetup", id => 'comments', call => \&getsetup); hook(type => "preprocess", id => '_comment', call => \&preprocess); @@ -26,9 +26,9 @@ sub import { #{{{ hook(type => "pagetemplate", id => "comments", call => \&pagetemplate); hook(type => "cgi", id => "comments", call => \&linkcgi); IkiWiki::loadplugin("inline"); -} # }}} +} -sub getsetup () { #{{{ +sub getsetup () { return plugin => { safe => 1, @@ -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,22 +76,32 @@ 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 safe => 0, rebuild => 0, }, -} #}}} +} + +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 { # {{{ +sub htmlize { my %params = @_; return $params{content}; -} # }}} +} # FIXME: copied verbatim from meta -sub safeurl ($) { #{{{ +sub safeurl ($) { my $url=shift; if (exists $IkiWiki::Plugin::htmlscrubber::{safe_url_regexp} && defined $IkiWiki::Plugin::htmlscrubber::safe_url_regexp) { @@ -105,9 +110,9 @@ sub safeurl ($) { #{{{ else { return 1; } -} #}}} +} -sub preprocess { # {{{ +sub preprocess { my %params = @_; my $page = $params{page}; @@ -206,16 +211,10 @@ sub preprocess { # {{{ # FIXME: hard-coded HTML (although it's just to set an ID) return "