ikiwiki/doc/todo/supporting_comments_via_dis...

127 lines
4.6 KiB
Plaintext
Raw Normal View History

2007-04-23 01:59:05 +02:00
I would love to see more traditional support for comments in ikiwiki. One
way would be to structure data on the discussion page in such a way that a
"comment" plugin could parse it and yet the discussion page would still be
a valid and usable wiki page.
2007-04-14 12:45:23 +02:00
For example if the discussion page looked like this:
# Subject of First Comment
Posted by [Adam Shand](http://adam.shand.net/) at 10:34PM on 14/04/2007
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi consectetuer nunc quis
magna. Etiam non est eget sapien vulputate varius. Vivamus magna. Sed justo. Donec
pellentesque ultrices urna.
# Subject of the Second Comment
Posted by [Foo Bar](http://foobar.net/) at 11:41PM on 14/04/2007
Quisque lacinia, lorem eget ornare facilisis, enim eros iaculis felis, id volutpat nibh
mauris ut felis. Vestibulum risus nibh, adipiscing volutpat, volutpat et, lacinia ut,
pede. Maecenas dolor. Vivamus feugiat volutpat ligula.
2007-04-23 01:59:05 +02:00
Each header marks the start of a new comment and the line immediately
following is the comments meta data (author, email/url, datestamp).
Hopefully you could structure it in such a way that the scope
2007-04-14 12:45:23 +02:00
This would allow:
* A comment plugin to render the comments in "traditional blog" format .
* Possibly even support nesting comments by the header level?
* A comment plugin to create a form at the bottom of the page for people to add comments in the appropriate format to the discussion page
* Still remain usable and readable by people who work via svn.
* When there is ACL support you could mark the discussion page as read only so it could only be updated by the comment plugin (if that's what you wanted)
Is this simple enough to be sensible?
-- [[AdamShand]]
2007-04-23 01:59:05 +02:00
> Well, if it's going to look like a blog, why not store the data the same
> way ikiwiki stores blogs, with a separate page per comment? As already
> suggested in [[discussion_page_as_blog]] though there are some things to
> be worked out also discussed there.
> --[[Joey]]
2007-04-26 00:13:33 +02:00
>> I certainly won't be fussy about how it gets implemented, I was just trying to think of the lightest weight most "wiki" solution. :-) -- Adam.
2007-04-26 14:26:09 +02:00
>>> As a side note, the feature described above (having a form not to add a page but to expand it in a formated way) would be useful for other things when the content is short (timetracking, sub-todo list items, etc..) --[[hb]]
2007-04-26 10:34:27 +02:00
2007-04-23 01:59:05 +02:00
I've been looking into this. I'd like to implement a "blogcomments"
plugin. Looking at the code, I think the way to go is to have a
formbuilder_setup hook that uses a different template instead of the
standard editpage one. That template would not display the editcontent
field. The problem that I'm running into is that I need to append the new
content to the old one.
-- [[MarceloMagallon]]
> Anything I can do to help? --[[Joey]]
>> Figured it out. Can you comment on the code below? Thanks. -- [[MarceloMagallon]]
sub formbuilder_setup (@) { #{{{
my %params=@_;
my $cgi = $params{cgi};
my $form = $params{form};
my $session = $params{session};
# XXX: This needs something to make it blog specific
unless ($cgi->param('page') =~ m{/discussion$} &&
$cgi->param('do') eq 'edit' &&
! defined $form->{title})
{
return;
}
$form->template(IkiWiki::template_file("makeblogcomment.tmpl"));
$form->field(name => "blogcomment", type => "textarea", rows => 20,
cols => 80);
my ($page)=$form->field('page');
my $content="";
if (exists $pagesources{$page}) {
$content=readfile(srcfile($pagesources{$page}));
$content.="\n\n";
}
$content.="----\n\n";
my $name=$session->param('name');
$name||="Anonymous";
$content.=sprintf(gettext("From: %s\n\n"), $name);
$content.=sprintf(gettext("Date: %s\n\n"), scalar(localtime));
if (defined $cgi->param('comments'))
{
$content.=sprintf(gettext("Subject: %s\n\n"),
$cgi->param('comments'));
}
$content.=$cgi->param('blogcomment');
$content=~s/\n/\r\n/g;
$form->field(name => "editcontent", value => $content, force => 1);
} # }}}
The above produces a page that looks like this:
From: Marcelo
Date: Fri Apr 27 21:16:27 2007
Subject: Pi
3.14
----
From: Marcelo
Date: Fri Apr 27 21:20:21 2007
Subject:
A comment...
Questions:
* Notice how this assumes that the page it's writing to is in mdwn format.
* What to do about the bit marked XXX?
* What about special formatting? Is mdwn enough?