[MKDoc-commit] [1.8] Comment plugin/component forward-ported from 1.6.

Bruno Postle bruno at mkdoc.com
Fri Aug 26 17:09:46 BST 2005


activitymail patch was missing these two files:

> Added Files:
> -----------
>     mkd/flo/editor:
>         Comment.pm
>     mkd/flo/plugin:
>         Comment.pm

Full patch attached.

-- 
Bruno
-------------- next part --------------
diff -Nbaur -x CVS mkd.orig/conf/www.conf mkd/conf/www.conf
--- mkd.orig/conf/www.conf	2005-08-26 17:03:01.000000000 +0100
+++ mkd/conf/www.conf	2005-08-25 14:16:08.000000000 +0100
@@ -14,6 +14,7 @@
 flo::plugin::Print
 flo::plugin::Poll
 flo::plugin::Photo
+flo::plugin::Comment
 
 # headlines
 flo::plugin::DC
diff -Nbaur -x CVS mkd.orig/flo/editor/Comment.pm mkd/flo/editor/Comment.pm
--- mkd.orig/flo/editor/Comment.pm	1970-01-01 01:00:00.000000000 +0100
+++ mkd/flo/editor/Comment.pm	2005-08-24 17:51:49.000000000 +0100
@@ -0,0 +1,100 @@
+# -------------------------------------------------------------------------------------
+# flo::editor::Comment
+# -------------------------------------------------------------------------------------
+# Author : Bruno Postle
+# Copyright : (c) MKDoc Ltd, 2005
+#
+# This file is part of MKDoc. 
+# 
+# MKDoc is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# MKDoc is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with MKDoc; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+# -------------------------------------------------------------------------------------
+package flo::editor::Comment;
+
+=head1 NAME
+
+flo::editor::Comment - an editor for comments
+
+=head1 DESCRIPTION
+
+The module provides an editor for Comment components.  A Comment component has
+information about the time and the poster as well as the comment text itself.
+
+By default, only a valid editor for a particular document can add, delete or
+modify Comment components, enable the L<flo::plugin::Comment> plugin to allow
+any user to append Comment components.
+
+=head1 INTERFACE
+
+=over 4
+
+This module is a simple subclass of the L<flo::editor::Text> module.
+
+=cut
+
+use strict;
+
+use flo::editor::Text;
+use base qw /flo::editor::Text/;
+
+=item C<< $self->as_xhtml() >>
+
+Renders the comment via petal.  Essentially the same as the Text component
+except that external links are given an 'untrusted' rel="nofollow" attribute
+and the comment, date_posted, poster, email & login fields are available for
+the template designer.
+
+=cut
+
+sub as_xhtml
+{
+    my $self = shift;
+    my $data = $self->{'data'};
+    local $MKDoc::Text::Structured::Inline::NoFollow = 1;
+    $data = MKDoc::Text::Structured::process ($data);
+    
+    my @newl = $self->links_for_tagger();
+    $self->{'comment'} = MKDoc::XML::Tagger::Preserve->process_data (['a'], $data, @newl);
+
+    my $type = $self->type();
+    my $template = new Petal (
+        file   => "component/$type",
+        lang   => $self->language(),
+        input  => 'XML',
+        output => 'XHTML'
+       );
+
+    my $res = $template->process (self => $self);
+    Encode::_utf8_on ($res);
+
+    return $res;
+}
+
+sub _initialize
+{
+    my $self = shift;
+    my $cgi = $self->{cgi};
+    my $param_name = $self->{param_name};
+
+    if (defined $cgi)
+    {
+        $self->{date_posted} = $cgi->param ($param_name . "_date_posted") || flo::Standard::current_document()->now_iso();
+        $self->{poster}      = $cgi->param ($param_name . "_poster")      || flo::Standard::current_user()->real_name();
+        $self->{email}       = $cgi->param ($param_name . "_email")       || flo::Standard::current_user()->email();
+        $self->{login}       = $cgi->param ($param_name . "_login")       || flo::Standard::current_user()->login();
+    }
+}
+
+1;
diff -Nbaur -x CVS mkd.orig/flo/plugin/Comment.pm mkd/flo/plugin/Comment.pm
--- mkd.orig/flo/plugin/Comment.pm	1970-01-01 01:00:00.000000000 +0100
+++ mkd/flo/plugin/Comment.pm	2005-08-26 16:03:28.000000000 +0100
@@ -0,0 +1,147 @@
+# ------------------------------------------------------------------------
+# flo::plugin::Comment
+# ------------------------------------------------------------------------
+# Author : Bruno Postle.
+# Copyright : (c) MKDoc Ltd, 2005.
+#
+# This file is part of MKDoc. 
+# 
+# MKDoc is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+# 
+# MKDoc is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with MKDoc; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+# ------------------------------------------------------------------------
+package flo::plugin::Comment;
+use flo::Standard;
+use flo::Plugin;
+use flo::editor::Comment;
+use Petal::Mail;
+use strict;
+use warnings;
+use 5.008_000;
+use utf8;
+
+use vars qw /@ISA/;
+ at ISA = qw /flo::Plugin/;
+
+=head1 NAME
+
+flo::plugin::Comment - ability for any authenticated user to add comments
+
+=head1 SYNOPSIS
+
+Access this plugin like this:
+
+  http://www.example.com/.comment.html
+  http://www.example.com/foo/.comment.html
+
+=head1 DESCRIPTION
+
+This plugin implements a simple form that accepts plain text.  When submitted,
+and so long as it isn't empty, this text gets appended to to the end of the
+document as the content of a L<flo::editor::Comment> component.
+
+This plugin doesn't control the later display or any other usage that the
+component may be put to.
+
+Once the form is POSTed, the user is redirected back to the parent document
+(which may or may not display the commment itself).
+
+=cut
+
+sub template_path { return '/comment' };
+
+sub _name_default { '.comment.html' }
+
+sub http_get
+{
+    my $self = shift;
+    my $cgi = flo::Standard::cgi();
+    $self->render_http (
+	self       => $self,
+	object     => $self->parent,
+	__input__  => 'XML',
+	__output__ => 'XHTML',
+       );
+    return 'TERMINATE';
+}
+
+sub http_post
+{
+    my $self  = shift;
+    my $cgi   = $self->cgi();
+
+    $self->_update_document_from_cgi();
+    $self->{comment} = $self->cgi->param ('comment');
+    $self->_send_mail();
+
+    print $cgi->redirect ($self->parent->uri);
+    return 'TERMINATE';
+}
+
+sub _update_document_from_cgi
+{
+    my $self   = shift;
+    my $user   = $self->user;
+    my $cgi    = $self->cgi;
+
+    return unless ($cgi->param ('comment') =~ /[[:alnum:]]/);
+
+    my $text_obj = new flo::editor::Comment (
+        param_name => 'comment',
+        cgi        => $cgi
+    );
+
+    my $document = $self->parent;
+    $document->add_component ($text_obj);
+    $document->save();
+}
+
+=pod
+
+The plugin only activates if enabled in the plugin list and if the user is
+authenticated.
+
+=cut
+
+sub activate
+{
+    my $self = shift;
+    return 0 unless ($self->SUPER::activate(@_));
+    return 0 unless ($self->user);
+    return $self;
+}
+
+
+sub _send_mail
+{
+    my $self   = shift;
+    
+    my $xml_mail = eval {
+        my $mail = new Petal::Mail (
+            file     => '/comment/email',
+            language => $self->language(),
+        );
+
+	$mail->send (
+	    self       => $self,
+	    object     => $self->parent(),
+	    __input__  => 'XML',
+	    __output__ => 'XML',
+	);
+    };
+}
+
+1;
+
+__END__
diff -Nbaur -x CVS mkd.orig/resources/css/admin.css mkd/resources/css/admin.css
--- mkd.orig/resources/css/admin.css	2005-08-26 17:03:01.000000000 +0100
+++ mkd/resources/css/admin.css	2005-08-25 12:30:18.000000000 +0100
@@ -276,6 +276,10 @@
   color: #000;
   background-color: #9C6;
 }
+.comment-component {
+  color: #000;
+  background-color: #9CC;
+}
 .image-component {
   color: #000;
   background-color: #69C;
diff -Nbaur -x CVS mkd.orig/resources/css/admin.ltr.css mkd/resources/css/admin.ltr.css
--- mkd.orig/resources/css/admin.ltr.css	2005-08-26 17:03:01.000000000 +0100
+++ mkd/resources/css/admin.ltr.css	2005-08-25 12:36:03.000000000 +0100
@@ -76,13 +76,13 @@
 }
 
 /* this is for text and html components */
-fieldset.html-component em.help, fieldset.text-component em.help {
+fieldset.html-component em.help, fieldset.text-component em.help, fieldset.comment-component em.help {
   float: right;
   width: 10%;
 }
 
 /* this is for text and html components */
-fieldset.html-component textarea.adminform, fieldset.text-component textarea.adminform {
+fieldset.html-component textarea.adminform, fieldset.text-component textarea.adminform, fieldset.comment-component textarea.adminform {
   float: left;
   width: 85%;
 }
diff -Nbaur -x CVS mkd.orig/resources/css/admin.rtl.css mkd/resources/css/admin.rtl.css
--- mkd.orig/resources/css/admin.rtl.css	2005-08-26 17:03:01.000000000 +0100
+++ mkd/resources/css/admin.rtl.css	2005-08-25 12:33:47.000000000 +0100
@@ -34,12 +34,12 @@
 }
 
 /* this is for text and html components */
-fieldset.html-component em.help, fieldset.text-component em.help {
+fieldset.html-component em.help, fieldset.text-component em.help, fieldset.comment-component em.help {
   float: left;
   width: 10%;
 }
 
-fieldset.html-component textarea.adminform, fieldset.text-component textarea.adminform {
+fieldset.html-component textarea.adminform, fieldset.text-component textarea.adminform, fieldset.comment-component textarea.adminform {
   float: right;
   width: 85%;
 }
diff -Nbaur -x CVS mkd.orig/resources/css/colours.css mkd/resources/css/colours.css
--- mkd.orig/resources/css/colours.css	2005-08-26 17:03:01.000000000 +0100
+++ mkd/resources/css/colours.css	2005-08-25 12:29:34.000000000 +0100
@@ -25,6 +25,14 @@
   border: solid #008 1px;
 }
 
+div.comment {
+  background: #EEF;
+}
+
+div.comment-header {
+  background: #DDE;
+}
+
 /* IE 6 on XP need the legend text colour setting */
 legend {
   background: transparent;
diff -Nbaur -x CVS mkd.orig/resources/css/public.css mkd/resources/css/public.css
--- mkd.orig/resources/css/public.css	2005-08-26 17:03:01.000000000 +0100
+++ mkd/resources/css/public.css	2005-08-25 12:32:41.000000000 +0100
@@ -121,6 +121,19 @@
   display: inline;
 }
 
+div.comment {
+  margin-top: 0.5em;
+  margin-bottom: 0.5em;
+}
+
+div.comment-header, div.comment-body {
+  padding-left: 0.5em;
+  padding-right: 0.5em;
+  font-size: smaller;
+  overflow: hidden;
+}
+
+
 /* The following CSS is for the divs within the sidebar. 
    If it's needed to have different settings for different 
    boxes then the unique class bames that each div has can 
diff -Nbaur -x CVS mkd.orig/resources/templates/comment/email/en.xml mkd/resources/templates/comment/email/en.xml
--- mkd.orig/resources/templates/comment/email/en.xml	1970-01-01 01:00:00.000000000 +0100
+++ mkd/resources/templates/comment/email/en.xml	2005-08-25 15:14:30.000000000 +0100
@@ -0,0 +1,30 @@
+<Message
+  xmlns="http://www.openhealth.org/xmtp#"
+  petal:define="root_user user_root:">
+
+  <Content-Type>text/plain; charset=utf-8; format=flowed</Content-Type>
+  <Content-Disposition>inline</Content-Disposition>
+  <Content-Transfer-Encoding>8bit</Content-Transfer-Encoding>
+  <Content-Language>en</Content-Language>
+  <MIME-Version>1.0</MIME-Version>
+
+  <From petal:content="string:${root_user/real_name} &lt;${root_user/email}&gt;">MKDoc &lt;info at mkdoc.com&gt;</From>
+  <To petal:content="string:${root_user/real_name} &lt;${root_user/email}&gt;">MKDoc &lt;info at mkdoc.com&gt;</To>
+  <Subject petal:content="string: ${object/root/title} : ${object/title} - comment added by ${self/user/real_name}">MKDoc : Feedback - comment added by Fred Flintstone</Subject>
+  <User-Agent>MKDoc Mailer v1.8</User-Agent>
+  <Organization petal:content="object/root/title">MKDoc</Organization>
+ 
+  <body xmlns="http://www.w3.org/1999/xhtml">
+<p>
+  <span petal:replace="self/user/real_name">Fred Flintstone</span> &lt;<span petal:replace="self/user/email">fred at example.com</span>&gt; has posted this comment to <span petal:replace="object/uri">http://www.example.com/feedback/</span>:
+</p>
+
+<pre petal:content="self/comment">
+   Blah blah, I am so clever.
+</pre>
+
+<pre>-- 
+Best Regards,
+<span petal:replace="root_user/real_name">MKDoc</span> &lt;<span petal:replace="root_user/email">example at example.com</span>&gt;</pre>
+  </body>
+</Message>
diff -Nbaur -x CVS mkd.orig/resources/templates/comment/en.html mkd/resources/templates/comment/en.html
--- mkd.orig/resources/templates/comment/en.html	1970-01-01 01:00:00.000000000 +0100
+++ mkd/resources/templates/comment/en.html	2005-08-24 17:51:30.000000000 +0100
@@ -0,0 +1,168 @@
+<!DOCTYPE html PUBLIC 
+  "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
+>
+<!--?
+
+This template lets the user post a comment
+
+?-->
+<html
+  lang="en"
+  xml:lang="en"
+  dir="ltr"
+  petal:set="
+    uri                   self/uri;
+    title                 string:Comment on ${self/parent/title};
+    user                  self/user;
+    lang                  self/lang;
+    dir                   self/direction;
+    align                 self/align;
+    align_opposite        self/align_opposite;
+    sitemap               plugin: flo::plugin::Sitemap;
+    sitemap_uri           sitemap/uri;
+    search                plugin: flo::plugin::Search;
+    search_uri            search/uri;
+            "
+  petal:attributes="lang lang; xml:lang lang; dir dir;"
+  xmlns="http://www.w3.org/1999/xhtml"
+  xmlns:petal="http://purl.org/petal/1.0/"
+  xmlns:xi="http://www.w3.org/2001/XInclude"
+>
+
+<!--? This is the <head> for public documents ?-->
+<?include file="/fragments/head_public/"?>
+
+  <body 
+    lang="en"
+    xml:lang="en"
+    dir="ltr"
+    petal:attributes="lang lang; xml:lang lang; dir dir;"
+  >
+
+<!--? This is the header it contains the navigational elements at the top of the page. ?-->
+<?include file="/fragments/header/"?>
+
+    <div class="content">
+
+      <h1 
+        lang="en"
+        xml:lang="en"
+        dir="ltr"
+        align="left"
+        petal:attributes="align align"
+      >
+        <a
+          id="page_content"
+          name="page_content"
+          petal:content="title"
+        >
+         Title of this page
+        </a>
+      </h1>
+
+      <xi:include href="/error/" />
+
+          <p
+            lang="en"
+            xml:lang="en"
+            dir="ltr"
+            align="left"
+            petal:attributes="align align"
+          >
+          
+            The editors of this site are encouraged to trim or remove duplicate
+            and off-topic material, so anything you contribute to this document
+            may be edited to improve readability.  Your name and the date (but
+            <em>not</em> your email address) will appear alongside.
+            
+          </p>
+
+          <form 
+            action="#"
+            method="post" 
+            accept-charset="UTF-8"
+            enctype="application/x-www-form-urlencoded"
+            petal:attributes="action uri"
+          >
+          
+            <fieldset
+              class="login-details"
+            >
+              
+	      <legend
+                lang="en"
+                xml:lang="en"
+                dir="ltr"
+              >
+                <a 
+                  id="login-details"
+                  name="login-details"
+                >Your comment</a>
+              </legend>
+
+              <p
+                lang="en"
+                xml:lang="en"
+                dir="ltr"
+                align="left"
+                class="help"
+                petal:attributes="align align"
+              >
+
+                Use plain text, start a new paragraph with two carriage
+                returns.  Links like <em>http://example.com/</em> or
+                <em>mailto:info at example.com</em> will be made clickable.
+                </p>
+
+              <p
+                lang="en"
+                xml:lang="en"
+                dir="ltr"
+                align="left"
+                petal:attributes="align align"
+              >
+                <label
+                  for="comment"
+                >Type Comment</label>
+                <br />
+                <textarea
+                  name="comment"
+                  id="comment"
+                  rows="12"
+                  cols="45"
+                  title="Enter Comment here."
+                  class="adminform"
+                ></textarea>
+              </p>
+
+            </fieldset>
+ 
+            <p
+              lang="en"
+              xml:lang="en"
+              dir="ltr"
+              align="left"
+              petal:attributes="align align"
+            >
+              <input 
+                type="submit"
+                name="submit"
+                value="Add Comment"
+                class="input-submit"
+                title="Add this comment to this page"
+              />
+            </p>
+
+      </form>
+
+    </div>
+
+    <div class="sidebar">
+
+        <!--? This is the list of link components. ?-->
+        <?include file="/fragments/menu_quick_links/"?>
+
+    </div>
+  </body>
+</html>
diff -Nbaur -x CVS mkd.orig/resources/templates/component/comment/en.html mkd/resources/templates/component/comment/en.html
--- mkd.orig/resources/templates/component/comment/en.html	1970-01-01 01:00:00.000000000 +0100
+++ mkd/resources/templates/component/comment/en.html	2005-08-24 17:51:30.000000000 +0100
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<!--?
+
+This template is used for rendering the comment component in documents. 
+
+?-->
+
+<div
+  class="comment"
+  xmlns:petal="http://purl.org/petal/1.0/"
+>
+            <div class="comment-header">
+              <span
+                class="comment-poster"
+                petal:content="self/poster"
+              >John Milton</span>
+              <span
+                class="comment-date"
+                petal:content="self/date_posted"
+              >1652-05-05 17:37:21</span>
+            </div>
+            <div
+              class="comment-body"
+              petal:content="structure self/comment"
+            >
+              <p>This comment component is <strong>super cool</strong>.</p>
+            </div>
+          </div>
diff -Nbaur -x CVS mkd.orig/resources/templates/document/default/en.html mkd/resources/templates/document/default/en.html
--- mkd.orig/resources/templates/document/default/en.html	2005-08-26 17:03:02.000000000 +0100
+++ mkd/resources/templates/document/default/en.html	2005-08-25 15:24:17.000000000 +0100
@@ -490,6 +490,10 @@
             </div>
           </div>
         </div>
+        <div
+          metal:use-macro="/macros/comments/#comments"
+        >
+        </div>
       </div>
 
       <!--? Next and Previous Fragment ?-->
diff -Nbaur -x CVS mkd.orig/resources/templates/editor/comment/en.html mkd/resources/templates/editor/comment/en.html
--- mkd.orig/resources/templates/editor/comment/en.html	1970-01-01 01:00:00.000000000 +0100
+++ mkd/resources/templates/editor/comment/en.html	2005-08-25 12:54:19.000000000 +0100
@@ -0,0 +1,131 @@
+<!--?
+
+
+This template is used for the editor interface of a 
+comment component. 
+  
+?-->
+<fieldset
+  class="comment-component"
+  xmlns:petal="http://purl.org/petal/1.0/"
+  petal:define="align               self/align;
+                align_opposite      self/align_opposite;
+                dir                 self/direction;
+                name_delete         string:${self/block_name}_delete;
+                name_poster         string:${self/block_name}_poster;
+                name_login          string:${self/block_name}_login;
+                name_email          string:${self/block_name}_email;
+                name_date_posted    string:${self/block_name}_date_posted"
+>
+
+  <legend
+    xml:lang="en"
+    lang="en"
+    dir="ltr"
+  >Comment component</legend>
+
+  <?include file="/fragments/move_control/"?>
+
+    <p>
+      <a
+        petal:attributes="href string:mailto:${self/email}"
+        href="mailto:fred at example.com"
+      ><span petal:content="self/poster">Fred Flintstone</span></a>
+      (<span petal:content="self/login">fred</span>)
+      <span petal:content="self/date_posted">2005-08-02 12:23:45</span>
+    </p>
+    <p>
+      <em
+        class="help"
+        xml:lang="en"
+        lang="en"
+        dir="ltr"
+      >
+        You can enter plain text into this form, a blank line will result in a paragraph 
+        break. See also the  
+        <a href="http://www.mkdoc.org/docs/specs/structured-txt/">text formatting rules</a>. 
+        Please use link components for hyperlinks. 
+      </em>
+      <label
+        for="comment_id"
+        lang="en"
+        xml:lang="en"
+        dir="ltr"
+        petal:attributes="for self/block_name"
+      >Comment</label>
+      <br />
+      <textarea
+        name="comment"
+        id="comment"
+        rows="12"
+        cols="45"
+        title="Edit Comment here."
+        class="adminform"
+        petal:attributes="name self/block_name; id self/block_name"
+        petal:content="self/data" 
+      >Plain text.</textarea>
+
+  <input
+    type="hidden"
+    name="date_posted"
+    id="date_posted"
+    value="2005-08-05 12:34:56"
+    petal:attributes="name name_date_posted; id name_date_posted; value self/date_posted"
+  />
+  <input
+    type="hidden"
+    name="poster"
+    id="poster"
+    value="Fred Flintstone"
+    petal:attributes="name name_poster; id name_poster; value self/poster"
+  />
+  <input
+    type="hidden"
+    name="login"
+    id="login"
+    value="fred"
+    petal:attributes="name name_login; id name_login; value self/login"
+  />
+  <input
+    type="hidden"
+    name="email"
+    id="email"
+    value="fred at example.com"
+    petal:attributes="name name_email; id name_email; value self/email"
+  />
+
+    </p>
+    
+    <p>
+
+      <input
+        type="submit"
+        name="comment_delete"
+        id="comment_delete"
+        value="Delete Component"
+        xml:lang="en"
+        lang="en"
+        dir="ltr"
+        title="Delete this component."
+        petal:attributes="name name_delete; id name_delete"
+      />
+      |
+      <a 
+        href="#" 
+        xml:lang="en"
+        lang="en"
+        dir="ltr"
+        petal:attributes="href string:${self/mkdoc_uri},copy" 
+      >Copy to another document</a>
+      |
+      <a 
+        href="#" 
+        xml:lang="en"
+        lang="en"
+        dir="ltr"
+        petal:attributes="href string:${self/mkdoc_uri},move"
+      >Move to another document</a>
+    </p>
+
+</fieldset>
+
diff -Nbaur -x CVS mkd.orig/resources/templates/macros/comments/en.html mkd/resources/templates/macros/comments/en.html
--- mkd.orig/resources/templates/macros/comments/en.html	1970-01-01 01:00:00.000000000 +0100
+++ mkd/resources/templates/macros/comments/en.html	2005-08-25 15:24:34.000000000 +0100
@@ -0,0 +1,59 @@
+<?xml version="1.0"?>
+<!DOCTYPE html PUBLIC 
+  "-//W3C//DTD XHTML 1.0 Transitional//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!--?
+
+This template is used for rendering a list of comments in documents. 
+
+?-->
+<html>
+<head><title>Macros for displaying comment list</title></head>
+<body>
+
+<div
+  petal:condition="false: self/is_root"
+  petal:omit-tag=""
+  xmlns:petal="http://purl.org/petal/1.0/"
+  xmlns:metal="http://xml.zope.org/namespaces/metal"
+  xmlns:i18n="http://xml.zope.org/namespaces/i18n"
+  metal:define-macro="comments"
+  i18n:domain="mkdoc"
+  petal:define="
+    comment               plugin: flo::plugin::Comment;
+    comment_uri           comment/uri;
+    Comment_Loop          self/components_list --comment;
+              "
+>
+        <div
+          class="comments"
+          petal:condition="true: Comment_Loop"
+        >
+        <h2
+          xml:lang="en"
+          lang="en"
+          dir="ltr"
+          i18n:attributes="lang     two-letter-language-code;
+                           xml:lang two-letter-language-code;
+                           dir      text-direction;"
+          i18n:translate="comments"
+        >Comments</h2>
+        <div 
+          petal:repeat="component Comment_Loop"
+          petal:omit-tag=""
+        >
+          <div 
+            petal:replace="structure component/as_xhtml"
+          >
+            Comments Go Here
+          </div>
+        </div>
+        </div>
+        <p
+          class="add-a-comment"
+          petal:condition="true: comment/would_activate"
+        >You may <a petal:attributes="href comment/uri" href="../../comment/en.html">add a comment</a> to this document.</p>
+</div>
+
+</body>
+</html>


More information about the MKDoc-commit mailing list