roller-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thinkboy <manchi.leung+n...@gmail.com>
Subject I created a plugin for new textile-j library .
Date Sat, 24 Nov 2007 19:01:45 GMT
hi,

textile4j has been inactive for a very long time, moreover many major 
features are not supported . (e.g Table)

I found out another new open source java project called textile-J  in 
java.net  : https://textile-j.dev.java.net/

it is really great!. it supports , almost, all of the textile syntax. 
very much the same as what I mostly do in Confluence wiki in my daily 
work !!!

now, I can easily sync or copy working notes from confluece wiki to my 
personal Roller blog :-D
	
so, I created a new Roller Plugin for textile-J to replace the old 
Textile4J altogether in Roller.

------------------------------------------------------------
Here is my notes to share:
------------------------------------------------------------
* svn checkout source from https://textile-j.dev.java.net/   (DO not 
download the jar from "Build Download Area", it does not work !)
* cd textile-j/java/net.java.textilej
* $ant all
* net.java.textilej_1.0.0.jar will in generated in dist
* I rename "net.java.textilej_1.0.0.jar"   as "textilej_1.0.0.jar"
* copy textilej_1.0.0.jar to apache-roller-src-3.1/contrib/lib
* create the following plugin file in 
/apache-roller-src-3.1/contrib/plugins/src/org/apache/roller/ui/rendering/plugins
* 

cd to apache-roller-src-3.1
* /apache-roller-src-3.1$ant all
* /apache-roller-src-3.1/contrib$ant build-contrib
* a roller-contrib.jar will be generated at: 
/apache-roller-src-3.1/build/lib/roller-contrib.jar
* copy this roller-contrib.jar to 
./apache-roller-3.1/webapp/roller/WEB-INF/lib/roller-contrib.jar
* configure your $TOMCAT_HOME/common/classes/roller-custom.properties

----------------------------------------
roller-custom.properties
----------------------------------------
# Weblog entry plugins
plugins.page=\
org.apache.roller.ui.rendering.plugins.ConvertLineBreaksPlugin \
,org.apache.roller.ui.rendering.plugins.TopicTagPlugin \
,org.apache.roller.ui.rendering.plugins.ObfuscateEmailPlugin \
,org.apache.roller.ui.rendering.plugins.SmileysPlugin \
,org.apache.roller.ui.rendering.plugins.TextileJPlugin


------------------------------------------------------------
source code for TextileJPlugin.java
------------------------------------------------------------
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  The ASF licenses this file to You
 * under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.  For additional information regarding
 * copyright in this work, please see the NOTICE file in the top level
 * directory of this distribution.
 */

package org.apache.roller.ui.rendering.plugins;

import java.util.Map;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.pojos.WeblogEntryData;
import org.apache.roller.pojos.WebsiteData;
import org.apache.roller.business.WeblogEntryPlugin;
import net.java.textilej.parser.*;

/**
 * Render text using textile engine.
 */
public class TextileJPlugin implements WeblogEntryPlugin {

    private static Log mLogger = LogFactory.getLog(TextileJPlugin.class);

    public String name = "TextileJ Formatter";
    public String description = "Allows use of TextileJ formatting to easily ";
    private TextileParser parser = new TextileParser();

    public TextileJPlugin() {
        mLogger.debug("Textile Plugin instantiated.");
    }

    public String getName() {
        return name;
    }


    public String getDescription() {
        return StringEscapeUtils.escapeJavaScript(description);
    }


    /**
     * Init.
     */
    public void init(WebsiteData website) {
        // no-op
    }


    /**
     * Convert an input string that contains text that uses the Textile
     * syntax to an output string in HTML format.
     *
     * @param src Input string that uses Textile syntax
     * @return Output string in HTML format.
     */
    public String render(WeblogEntryData entry, String src ) {

        String result = parser.parseToHtml(src);
        return result;
    }

}



Mime
View raw message