X-Git-Url: https://sipb.mit.edu/gitweb.cgi/ikiwiki.git/blobdiff_plain/4ea3cd880abb0b60f95585ba7ea238ae0d4f7e36..edab887e8ad1bb9b59455a020d75408417b7efb7:/doc/todo/supporting_comments_via_disussion_pages.mdwn?ds=sidebyside diff --git a/doc/todo/supporting_comments_via_disussion_pages.mdwn b/doc/todo/supporting_comments_via_disussion_pages.mdwn index 95243d605..80b375db3 100644 --- a/doc/todo/supporting_comments_via_disussion_pages.mdwn +++ b/doc/todo/supporting_comments_via_disussion_pages.mdwn @@ -45,6 +45,8 @@ Is this simple enough to be sensible? >>> 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]] +# [[MarceloMagallon]]'s implementation + 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 @@ -62,13 +64,25 @@ So, I have some code, included below. For some reason that I don't quite get it What I ended up doing is write something like this to the page: - [[blogcomment from="""Username""" timestamp="""12345""" subject="""Some text""" text="""the text of the comment"""]] + [[!blogcomment from="""Username""" timestamp="""12345""" subject="""Some text""" text="""the text of the comment"""]] + +Each comment is processed to something like this: + +
+
+
From
Username
+
Date
Date (needs fixing)
+
Subject
Subject text
+
+ +

Text of the comment...

+
-Each comment is processed to a
with a
and the text inside it. In this way the comments can be styled using CSS. +. In this way the comments can be styled using CSS. -- [[MarceloMagallon]] -# Code +## Code #!/usr/bin/perl package IkiWiki::Plugin::comments; @@ -121,7 +135,7 @@ Each comment is processed to a
with a
and the text inside it. In thi $cgi->param('comments') : ''; my $comment=$cgi->param('blogcomment'); - $content.=qq{[[blogcomment from="""$name""" timestamp="""$timestamp""" subject="""$subject""" text="""$comment"""]]\n\n}; + $content.=qq{[[!blogcomment from="""$name""" timestamp="""$timestamp""" subject="""$subject""" text="""$comment"""]]\n\n}; $content=~s/\n/\r\n/g; $form->field(name => "editcontent", value => $content, force => 1); } # }}} @@ -147,4 +161,24 @@ Each comment is processed to a
with a
and the text inside it. In thi return $r; } # }}} - 1; \ No newline at end of file + 1; + +# [[smcv]]'s implementation + +I've started a smcvpostcomment plugin (to be renamed to postcomment if people like it, but I'm namespacing it while it's still experimental) which I think more closely resembles what Joey was after. The code is cargo-culted from a mixture of editpage and inline's "make a blog post" support - it has to use a lot of semi-internal IkiWiki:: functions (both of those plugins do too). It doesn't fully work yet, but I'll try to get it into a state where it basically works and can be published in the next week or two. + +My approach is: + +* Comments are intended to be immutable after posting (so, only editable by direct committers), so they go on internal pages (*._comment); these internal pages are checked in to the RCS (although later I might make this optional) + +* ?do=smcvpostcomment (in the CGI script) gives a form that lets logged-in users (later, optionally also anonymous users) create a new comment + +* \[[!smcvpostcomment]] just inserts a "Post comment" button into the current page, which goes to ?do=smcvpostcomment - it's intended to be used in conjunction with an \[[!inline]] that will display the comments + +* The title (subject line), author and authorurl are set with \[[!meta]] directives, just like the way aggregate does it (which means I'll probably have to disallow the use of those \[[!meta]] directives in the body of the comment, to avoid spoofing - obviously, spoofing can be detected by looking at RecentChanges or gitweb, but the expectation for blog-style comments is that the metadata seen in the comment can be trusted) + +* The initial plan is to have comments hard-coded to be in Markdown, with further directives not allowed - I'll relax this when I've worked out what ought to be allowed! + +I've also updated Marcelo's code (above) to current ikiwiki, and moved it to a "marceloblogcomment" namespace - it's in the "marcelocomments" branch of my repository (see ). I had to reconstitute the .tmpl file, which Marcelo didn't post here. + +--[[smcv]]