comment: Make comment directives no longer use the internal "_comment" form, and document the comment directive syntax.

Rationalle: Comments need to be user-editable so that they can be posted
via git commit etc.

The _comment directive is still supported, for back-compat.
master
Joey Hess 2009-06-02 17:06:46 -04:00
parent bd1aed61e9
commit 5cdee82ef6
5 changed files with 49 additions and 3 deletions

View File

@ -21,6 +21,8 @@ my %commentstate;
sub import {
hook(type => "checkconfig", id => 'comments', call => \&checkconfig);
hook(type => "getsetup", id => 'comments', call => \&getsetup);
hook(type => "preprocess", id => 'comment', call => \&preprocess);
# here for backwards compatability with old comments
hook(type => "preprocess", id => '_comment', call => \&preprocess);
hook(type => "sessioncgi", id => 'comment', call => \&sessioncgi);
hook(type => "htmlize", id => "_comment", call => \&htmlize);
@ -377,7 +379,7 @@ sub editcomment ($$) {
my $location=unique_comment_location($page, $config{srcdir});
my $content = "[[!_comment format=$type\n";
my $content = "[[!comment format=$type\n";
# FIXME: handling of double quotes probably wrong?
if (defined $session->param('name')) {

7
debian/changelog vendored
View File

@ -1,3 +1,10 @@
ikiwiki (3.15) UNRELEASED; urgency=low
* comment: Make comment directives no longer use the internal "_comment"
form, and document the comment directive syntax.
-- Joey Hess <joeyh@debian.org> Tue, 02 Jun 2009 17:03:41 -0400
ikiwiki (3.14) unstable; urgency=low
* highlight: New plugin supporting syntax highlighting of pretty much

View File

@ -0,0 +1,38 @@
The `comment` directive is supplied by the
[[!iki plugins/comment desc=comment]] plugin, and is used to add a comment
to a page. Typically, the directive is the only thing on a comment page,
and is filled out by the comment plugin when a user posts a comment.
Example:
\[[!comment format=mdwn
username="foo"
subject="Bar"
date="2009-06-02T19:05:01Z"
content="""
Blah blah.
"""
]]
## usage
The only required parameter is `content`, the others just add or override
metadata of the comment.
* `content` - Text to display for the comment.
Note that [[directives|ikiwiki/directive]]
may not be allowed, depending on the configuration
of the comment plugin.
* `format` - Specifies the markup used for the content.
* `subject` - Subject for the comment.
* `date` - Date the comment was posted. Can be entered in
nearly any format, since it's parsed by [[!cpan TimeDate]]
* `username` - Used to record the username (or OpenID)
of a logged in commenter.
* `ip` - Can be used to record the IP address of a commenter,
if they posted anonymously.
* `claimedauthor` - Records the name that the user entered,
if anonmous commenters are allowed to enter their (unverified)
name.
[[!meta robots="noindex, follow"]]

View File

@ -19,7 +19,7 @@ users can only post comments.
Individual comments are stored as internal-use pages named something like
`page/comment_1`, `page/comment_2`, etc. These pages internally use a
`\[[!_comment]]` [[ikiwiki/directive]].
[[comment_directive|ikiwiki/directive/comment]].
There are some global options for the setup file:

View File

@ -16,7 +16,6 @@ Website: <TMPL_VAR NAME=FIELD-URL> (optional)<br />
Subject: <TMPL_VAR FIELD-SUBJECT><br />
<TMPL_VAR FIELD-EDITCONTENT><br />
<TMPL_VAR FORM-SUBMIT> <TMPL_VAR FIELD-TYPE> <TMPL_VAR HELPONFORMATTINGLINK><br />
IkiWiki directives ([[!directive]]) are <TMPL_UNLESS NAME="ALLOWDIRECTIVES">not </TMPL_UNLESS>allowed in comments on this wiki.<br />
<TMPL_VAR NAME="FORM-END">
<TMPL_VAR WMD_PREVIEW>