1 2 package org.roller.presentation.velocity.plugins.textile; 3 4 import org.apache.commons.lang.StringEscapeUtils; 5 import org.apache.commons.logging.Log; 6 import org.apache.commons.logging.LogFactory; 7 import org.apache.velocity.context.Context; 8 import org.roller.pojos.WeblogEntryData; 9 import org.roller.presentation.RollerRequest; 10 import org.roller.presentation.velocity.PagePlugin; 11 12 15 public class TextilePlugin implements PagePlugin 16 { 17 public String name = "Textile Formatter"; 18 public String description = "Allows use of Textile formatting to easily " + 19 "generate HTML. See the <a HREF='http://textism.com/tools/textile' target='textile'>Textile</a> site."; 20 21 public String toString() { return name; } 22 23 private net.sf.textile4j.Textile mTextile = new net.sf.textile4j.Textile(); 24 25 private static Log mLogger = 26 LogFactory.getFactory().getInstance(TextilePlugin.class); 27 28 public TextilePlugin() 29 { 30 mLogger.debug("Textile Plugin instantiated."); 31 } 32 33 36 public void init(RollerRequest rreq, Context ctx) 37 { 38 ctx.put("textileRenderer",this); 39 } 40 41 47 public String render( String src ) 48 { 49 return mTextile.process(src); 50 } 51 52 public String render( WeblogEntryData entry, boolean skipFlag ) 53 { 54 return render( entry.getText() ); 55 } 56 57 public String getName() { return name; } 58 public String getDescription() { return StringEscapeUtils.escapeJavaScript(description); } 59 } 60 | Popular Tags |