JSPWiki Comment Plugin

[2008-11-05 update:] updated the commentplugin, it works now with JSPWiki-2.8.0 and has a slightly different rendering of the comments. The comments are now displayed inline in the wikipage with yellow background and a red font.

new jar:

comment-1.1.jar

sources:

comment 1.1

-----------

There is a CommentPlugin on the JSPWiki page, however this is really functional (cant handle more than one word). So I quickly build my own version of a commentplugin.

Installation:

  1. put comment.jar in WEB-INF/lib in your JSPWiki root directory
  2. put comment.gif in images/ in your JSPWiki root directory (or any other picture you would like to use, just name it comment.gif)
  3. add de.d3web.we.jspwiki.comment to your jspwiki.plugin.searchPath variable in jspwiki.properties
  4. restart your container

usage:

[{Comment this is a comment}]

download:

comment.jar

source:

package de.d3web.we.jspwiki.comment;

import java.util.Map;

import com.ecyrd.jspwiki.WikiContext;
import com.ecyrd.jspwiki.plugin.PluginException;
import com.ecyrd.jspwiki.plugin.WikiPlugin;

/**
* @author kazamatzuri
* Simple plugin for JSPWiki to allow comments in Pages
*
*/
public class Comment implements WikiPlugin{

/* (non-Javadoc)
* @see com.ecyrd.jspwiki.plugin.WikiPlugin#execute(com.ecyrd.jspwiki.WikiContext, java.util.Map)
*/
public String execute(WikiContext context, Map params)
throws PluginException {
final String COMMENT_ICON
= "<img src=\"images/comment.gif\" alt=\"COMMENT\" title=\"COMMENT\"/>";
if( !params.isEmpty()
&& params.values().iterator().next() != null )
{

return COMMENT_ICON.replaceAll("COMMENT",
(String)params.get("_cmdline") );
}
return "";
}

}

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>