You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2006/06/16 23:22:13 UTC

svn commit: r414918 - in /incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins: acronyms/ bookmarks/ convertbreaks/ email/ readmore/ smileys/ textile/

Author: agilliland
Date: Fri Jun 16 14:22:13 2006
New Revision: 414918

URL: http://svn.apache.org/viewvc?rev=414918&view=rev
Log:
code reformatting.


Modified:
    incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/acronyms/AcronymsPlugin.java
    incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/bookmarks/BookmarkPlugin.java
    incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/convertbreaks/ConvertLineBreaksPlugin.java
    incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/email/ObfuscateEmailPlugin.java
    incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java
    incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/smileys/SmileysPlugin.java
    incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/textile/TextilePlugin.java

Modified: incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/acronyms/AcronymsPlugin.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/acronyms/AcronymsPlugin.java?rev=414918&r1=414917&r2=414918&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/acronyms/AcronymsPlugin.java (original)
+++ incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/acronyms/AcronymsPlugin.java Fri Jun 16 14:22:13 2006
@@ -1,155 +1,112 @@
 /*
-* 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.
-*/
-/*
- * Filename: AcronymsPlugin.java
- * 
- * Created on 22-Jun-04
+ * 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.presentation.velocity.plugins.acronyms;
 
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.RollerException;
 import org.apache.roller.model.RollerFactory;
 import org.apache.roller.model.UserManager;
-import org.apache.roller.pojos.WeblogTemplate;
+import org.apache.roller.model.WeblogEntryPlugin;
 import org.apache.roller.pojos.WeblogEntryData;
+import org.apache.roller.pojos.WeblogTemplate;
 import org.apache.roller.pojos.WebsiteData;
-import org.apache.roller.model.WeblogEntryPlugin;
 
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 /**
  * Adds full text to pre-defined acronyms.
- * 
- * Example: HTML would become <acronym title="Hyper Text Markup Language">HTML</acronym> 
- * 
+ *
+ * Example: HTML would become <acronym title="Hyper Text Markup Language">HTML</acronym>
+ *
  * @author <a href="mailto:molen@mail.com">Jaap van der Molen</a>
  * @version $Revision: 1.3 $
  */
-public class AcronymsPlugin implements WeblogEntryPlugin
-{
-	/**
-	 * Logger
-	 */
-	private static final Log mLogger = LogFactory.getLog(AcronymsPlugin.class);
-
-	/**
-	 * Name of this Plugin.
-	 */
-	protected String name = "Acronyms";
+public class AcronymsPlugin implements WeblogEntryPlugin {
+    
+    private static final Log mLogger = LogFactory.getLog(AcronymsPlugin.class);
+    
+    protected String name = "Acronyms";
     protected String description = "Expands acronyms defined in _acronym page. " +
-        "Example: definition 'HTML=Hyper Text Markup Language' " +
-        "becomes &lt;acronym title='Hyper Text Markup Language'&gt;HTML&lt;/acronym&gt;. " +
-        "You must create an " +
-        "<a href='page.do?method=editPages&rmik=tabbedmenu.website.pages'>" +
-        "_acronym page</a> to use Acronyms.";
-    
-	/**
-	 * Constructor
-	 */
-	public AcronymsPlugin()
-	{
-		super();
+            "Example: definition 'HTML=Hyper Text Markup Language' " +
+            "becomes &lt;acronym title='Hyper Text Markup Language'&gt;HTML&lt;/acronym&gt;. " +
+            "You must create an " +
+            "<a href='page.do?method=editPages&rmik=tabbedmenu.website.pages'>" +
+            "_acronym page</a> to use Acronyms.";
+    
+    
+    public AcronymsPlugin() {
+        super();
         mLogger.debug("AcronymsPlugin instantiated.");
-	}
-
-	/**
-     * 
-     * 
-     * @see org.apache.roller.presentation.velocityWeblogEntryPluginn#init(org.apache.roller.presentation.RollerRequest, org.apache.velocity.context.Context)
-     */
-	public void init(WebsiteData website, Map model) throws RollerException
-	{
-	}
+    }
     
-    /**
-     * Look for any _acronyms Page and parse it into Properties.
-     * @param website
-     * @return
-     * @throws RollerException
-     */
-    private Properties loadAcronyms(WebsiteData website) 
-    {
-        Properties acronyms = new Properties();
-        try
-        {
-            UserManager userMgr = RollerFactory.getRoller().getUserManager();
-            WeblogTemplate acronymsPage = userMgr.getPageByName(
-                                        website, "_acronyms");
-            if (acronymsPage != null) 
-            {
-                acronyms = parseAcronymPage(acronymsPage, acronyms);
-            }
-        }
-        catch (RollerException e)
-        {
-            // not much we can do about it
-            mLogger.warn(e);
-        }
-        return acronyms;
+    
+    public String getName() {
+        return name;
     }
-
-    /**
-     * 
-     * 
-     * @see org.apache.roller.presentation.velocityWeblogEntryPluginn#render(org.apache.roller.pojos.WeblogEntryData, boolean)
-     */
-	public String render(WeblogEntryData entry, String str)
-	{
+    
+    
+    public String getDescription() {
+        return StringEscapeUtils.escapeJavaScript(description);
+    }
+    
+    
+    public void init(WebsiteData website, Map model) throws RollerException {}
+    
+    
+    public String render(WeblogEntryData entry, String str) {
         String text = str;
         
-		if (mLogger.isDebugEnabled()) {
-			mLogger.debug("render(entry = "+entry.getId()+")");
-		}
-
+        if (mLogger.isDebugEnabled()) {
+            mLogger.debug("render(entry = "+entry.getId()+")");
+        }
+        
         /*
          * Get acronyms Properties.
          */
         Properties acronyms = loadAcronyms(entry.getWebsite());
         mLogger.debug("acronyms.size()=" + acronyms.size());
-        if (acronyms.size() == 0)
-        {
+        if (acronyms.size() == 0) {
             return text;
         }
-
+        
         /*
          * Compile the user's acronyms into RegEx patterns.
          */
         Pattern[] acronymPatterns = new Pattern[acronyms.size()];
         String[] acronymTags = new String[acronyms.size()];
         int count = 0;
-        for (Iterator iter = acronyms.keySet().iterator(); iter.hasNext();)
-        {
+        for (Iterator iter = acronyms.keySet().iterator(); iter.hasNext();) {
             String acronym = (String) iter.next();
             acronymPatterns[count] = Pattern.compile("\\b" + acronym + "\\b");
             mLogger.debug("match '" + acronym + "'");
             acronymTags[count] =
-                "<acronym title=\""
-                + acronyms.getProperty(acronym)
-                + "\">"
-                + acronym
-                + "</acronym>";
+                    "<acronym title=\""
+                    + acronyms.getProperty(acronym)
+                    + "\">"
+                    + acronym
+                    + "</acronym>";
             count++;
         }
         
@@ -157,79 +114,85 @@
         if (acronymPatterns == null || acronymPatterns.length == 0) {
             return text;
         }
-
+        
         return matchAcronyms(text, acronymPatterns, acronymTags);
-	}
+    }
+    
+    
+    /**
+     * Look for any _acronyms Page and parse it into Properties.
+     * @param website
+     * @return
+     * @throws RollerException
+     */
+    private Properties loadAcronyms(WebsiteData website) {
+        Properties acronyms = new Properties();
+        try {
+            UserManager userMgr = RollerFactory.getRoller().getUserManager();
+            WeblogTemplate acronymsPage = userMgr.getPageByName(
+                    website, "_acronyms");
+            if (acronymsPage != null) {
+                acronyms = parseAcronymPage(acronymsPage, acronyms);
+            }
+        } catch (RollerException e) {
+            // not much we can do about it
+            mLogger.warn(e);
+        }
+        return acronyms;
+    }
+    
+    
+    /**
+     * Iterates through the acronym properties and replaces matching
+     * acronyms in the entry text with acronym html-tags.
+     *
+     * @param text entry text
+     * @param acronyms user provided set of acronyms
+     * @return entry text with acronym explanations
+     */
+    private String matchAcronyms(String text, Pattern[] acronymPatterns, String[] acronymTags) {
+        if (mLogger.isDebugEnabled()) {
+            mLogger.debug("matchAcronyms("+text+")");
+        }
         
-
-	/**
-	 * @return this Page Plugin's name
-	 */
-	public String toString()
-	{
-		return name;
-	}
-	
-	/**
-	 * Iterates through the acronym properties and replaces matching 
-	 * acronyms in the entry text with acronym html-tags.
-	 * 
-	 * @param text entry text
-	 * @param acronyms user provided set of acronyms
-	 * @return entry text with acronym explanations
-	 */
-	private String matchAcronyms(String text, Pattern[] acronymPatterns, String[] acronymTags)
-	{
-		if (mLogger.isDebugEnabled()) {
-			mLogger.debug("matchAcronyms("+text+")");
-		}
-
         Matcher matcher = null;
-		for (int i=0; i<acronymPatterns.length; i++)
-		{
+        for (int i=0; i<acronymPatterns.length; i++) {
             matcher = acronymPatterns[i].matcher(text);
             text = matcher.replaceAll(acronymTags[i]);
-		}
-		return text;
-	}
-
-	/**
-	 * Parse the Template of the provided WeblogTemplate and turns it
-	 * into a <code>Properties</code> collection.
-	 * 
-	 * @param acronymPage
-	 * @return acronym properties (key = acronym, value= full text), empty if Template is empty
-	 */
-	private Properties parseAcronymPage(WeblogTemplate acronymPage, Properties acronyms)
-	{
-		String rawAcronyms = acronymPage.getContents();
-		
-		if (mLogger.isDebugEnabled()) 
-		{
-			mLogger.debug("parsing _acronyms template: \n'"+rawAcronyms+"'");
-		}
-		
-		String regex = "\n"; // end of line
-		String[] lines = rawAcronyms.split(regex);
-
-		if (lines != null)
-		{
-			for (int i = 0; i < lines.length; i++)
-			{
-				int index = lines[i].indexOf('=');
-				if (index > 0)
-				{
-					String key = lines[i].substring(0, index).trim();
-					String value =
-						lines[i].substring(index + 1, lines[i].length()).trim();
-					acronyms.setProperty(key, value);
-				}
-			}
-		}
-
-		return acronyms;
-	}
-
-    public String getName() { return name; }
-    public String getDescription() { return StringEscapeUtils.escapeJavaScript(description); }
+        }
+        return text;
+    }
+    
+    /**
+     * Parse the Template of the provided WeblogTemplate and turns it
+     * into a <code>Properties</code> collection.
+     *
+     * @param acronymPage
+     * @return acronym properties (key = acronym, value= full text), empty if Template is empty
+     */
+    private Properties parseAcronymPage(WeblogTemplate acronymPage, Properties acronyms) {
+        String rawAcronyms = acronymPage.getContents();
+        
+        if (mLogger.isDebugEnabled()) {
+            mLogger.debug("parsing _acronyms template: \n'"+rawAcronyms+"'");
+        }
+        
+        String regex = "\n"; // end of line
+        String[] lines = rawAcronyms.split(regex);
+        
+        if (lines != null) {
+            for (int i = 0; i < lines.length; i++) {
+                int index = lines[i].indexOf('=');
+                if (index > 0) {
+                    String key = lines[i].substring(0, index).trim();
+                    String value =
+                            lines[i].substring(index + 1, lines[i].length()).trim();
+                    acronyms.setProperty(key, value);
+                }
+            }
+        }
+        
+        return acronyms;
+    }
+    
 }

Modified: incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/bookmarks/BookmarkPlugin.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/bookmarks/BookmarkPlugin.java?rev=414918&r1=414917&r2=414918&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/bookmarks/BookmarkPlugin.java (original)
+++ incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/bookmarks/BookmarkPlugin.java Fri Jun 16 14:22:13 2006
@@ -1,89 +1,89 @@
 /*
-* 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.
-*/
-/*
- * Created on Nov 2, 2003
+ * 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.presentation.velocity.plugins.bookmarks;
 
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
 import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.RollerException;
 import org.apache.roller.model.BookmarkManager;
 import org.apache.roller.model.RollerFactory;
+import org.apache.roller.model.WeblogEntryPlugin;
 import org.apache.roller.pojos.BookmarkData;
 import org.apache.roller.pojos.FolderData;
 import org.apache.roller.pojos.WeblogEntryData;
-import org.apache.roller.model.WeblogEntryPlugin;
-import java.util.regex.PatternSyntaxException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
 import org.apache.roller.pojos.WebsiteData;
 
+
 /**
- * @author lance
- * @author Anil Gangolli (significant modifications)
+ * Automatically insert links into entry text based on users bookmarks.
  */
-public class BookmarkPlugin implements WeblogEntryPlugin
-{
+public class BookmarkPlugin implements WeblogEntryPlugin {
+    
+    private static Log mLogger = LogFactory.getLog(BookmarkPlugin.class);
+    
     protected String name = "Bookmark Linker";
     protected String description = "Automatically uses your Bookmarks to " +
-        "create links.  Simply use the Name of a Bookmark and it will be " +
-        "converted into a hyperlink using the Bookmark's URL.";
-
-    private static Log mLogger =
-       LogFactory.getFactory().getInstance(BookmarkPlugin.class);
-
-    public BookmarkPlugin()
-    {
+            "create links.  Simply use the Name of a Bookmark and it will be " +
+            "converted into a hyperlink using the Bookmark's URL.";
+    
+    
+    public BookmarkPlugin() {
         mLogger.debug("BookmarkPlugin instantiated.");
     }
-
-    public String toString() { return name; }
-
-
-    public void init(WebsiteData website, Map model) throws RollerException
-    {
+    
+    
+    public String getName() {
+        return name;
     }
-
-    public String render(WeblogEntryData entry, String str)
-    {
-        String text = str;        
-        try
-        {
+    
+    
+    public String getDescription() {
+        return StringEscapeUtils.escapeJavaScript(description);
+    }
+    
+    
+    public void init(WebsiteData website, Map model) throws RollerException {}
+    
+    
+    public String render(WeblogEntryData entry, String str) {
+        String text = str;
+        try {
             BookmarkManager bMgr = RollerFactory.getRoller().getBookmarkManager();
             FolderData rootFolder = bMgr.getRootFolder(entry.getWebsite());
             text = matchBookmarks(text, rootFolder);
             text = lookInFolders(text, rootFolder.getFolders());
-        }
-        catch (RollerException e)
-        {
+        } catch (RollerException e) {
             // nothing much I can do, go with default "Weblog" value
             // could be RollerException or NullPointerException
             mLogger.warn(e);
         }
         return text;
     }
-
+    
+    
     /**
      * Recursively travel down Folder tree, attempting
      * to match up Bookmarks in each Folder.
@@ -92,44 +92,36 @@
      * @param folders
      * @return
      */
-    private String lookInFolders(String text, Collection folders)
-    {
+    private String lookInFolders(String text, Collection folders) {
         Iterator it = folders.iterator();
-        while (it.hasNext())
-        {
+        while (it.hasNext()) {
             FolderData folder = (FolderData)it.next();
             text = matchBookmarks(text, folder);
-
-            try
-            {
-                if (!folder.getFolders().isEmpty())
-                {
+            
+            try {
+                if (!folder.getFolders().isEmpty()) {
                     lookInFolders(text, folder.getFolders());
                 }
-            }
-            catch (RollerException e)
-            {
+            } catch (RollerException e) {
                 mLogger.error("Error getting child Folders");
             }
         }
         return text;
     }
-
-    private String matchBookmarks(String text, FolderData folder)
-    {
+    
+    
+    private String matchBookmarks(String text, FolderData folder) {
         Iterator bookmarks = folder.getBookmarks().iterator();
         String workingText = text;
-        while (bookmarks.hasNext())
-        {
+        while (bookmarks.hasNext()) {
             BookmarkData bookmark = (BookmarkData)bookmarks.next();
             String bkDescription = bookmark.getDescription();
             if (bkDescription == null) bkDescription = "";
             String bookmarkLink = "<a href=\"" +
-                bookmark.getUrl() + "\" title=\"" +
-                bkDescription + "\">" +
-                bookmark.getName() + "</a>";
-            try
-            {
+                    bookmark.getUrl() + "\" title=\"" +
+                    bkDescription + "\">" +
+                    bookmark.getName() + "</a>";
+            try {
                 // Replace all occurrences of bookmark name that don't occur within the bounds of an anchor tag
                 // Notes:
                 // - use reluctant quantifiers on the tags to avoid gobbling more than desired
@@ -140,24 +132,16 @@
                 Matcher m = Pattern.compile(regEx).matcher(workingText);
                 StringBuffer textBuf = new StringBuffer(workingText.length());
                 int inLink = 0;
-                while (m.find())
-                {
-                    if (m.group(1) != null)
-                    {
+                while (m.find()) {
+                    if (m.group(1) != null) {
                         // self-closed anchor tag <a  ... /> -- ignore
-                    }
-                    else if (m.group(2) != null)
-                    {
+                    } else if (m.group(2) != null) {
                         // matched opening anchor tag <a ...>
                         inLink++;
-                    }
-                    else if (m.group(3) != null)
-                    {
+                    } else if (m.group(3) != null) {
                         // closing anchor tag </a>, but ignore nonmatching ones
                         if (inLink > 0) inLink--;
-                    }
-                    else if (m.group(4) != null)
-                    {
+                    } else if (m.group(4) != null) {
                         // matched the bookmark -- replace, but only if not within a link tag.
                         if (inLink == 0) m.appendReplacement(textBuf, bookmarkLink);
                     }
@@ -165,16 +149,12 @@
                 }
                 m.appendTail(textBuf);
                 workingText = textBuf.toString();
-            }
-            catch (PatternSyntaxException e)
-            {
+            } catch (PatternSyntaxException e) {
                 // Can happen since we don't escape pattern the bookmark name to protect pattern characters.
                 mLogger.warn("Failed to substitute for bookmark [" + bookmark.getName() + "] due to regular expression characters.");
             }
         }
         return workingText.toString();
     }
-
-    public String getName() { return name; }
-    public String getDescription() { return StringEscapeUtils.escapeJavaScript(description); }
+    
 }

Modified: incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/convertbreaks/ConvertLineBreaksPlugin.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/convertbreaks/ConvertLineBreaksPlugin.java?rev=414918&r1=414917&r2=414918&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/convertbreaks/ConvertLineBreaksPlugin.java (original)
+++ incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/convertbreaks/ConvertLineBreaksPlugin.java Fri Jun 16 14:22:13 2006
@@ -1,21 +1,20 @@
 /*
-* 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.
-*/
-/* Created on July 10, 2005, 3:17 PM */
+ * 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.presentation.velocity.plugins.convertbreaks;
 
@@ -29,6 +28,7 @@
 import org.apache.roller.pojos.WebsiteData;
 import org.apache.roller.model.WeblogEntryPlugin;
 
+
 /**
  * Simple page plugin that converts paragraphs of plain text into html paragraphs.
  * We wrap each full paragraph in html &lt;p&gt; opening and closing tags, and
@@ -42,12 +42,10 @@
  * &lt;p&gt;This is one&lt;br/&gt;
  * paragraph&lt;/p&gt;
  *
- * @author Allen Gilliland
  */
 public class ConvertLineBreaksPlugin implements WeblogEntryPlugin {
     
-    private static Log mLogger = 
-        LogFactory.getFactory().getInstance(ConvertLineBreaksPlugin.class);
+    private static Log mLogger = LogFactory.getLog(ConvertLineBreaksPlugin.class);
     
     private static final String name = "Convert Line Breaks";
     private static final String description = "Convert plain text paragraphs to html by adding p and br tags";
@@ -57,16 +55,18 @@
     public ConvertLineBreaksPlugin() {
         mLogger.debug("Instantiating ConvertLineBreaksPlugin v"+this.version);
     }
-
+    
     
     public String getName() {
         return name;
     }
-
+    
+    
     public String getDescription() {
         return description;
     }
     
+    
     public void init(WebsiteData website, Map model) throws RollerException {
         // we don't need to do any init.
         mLogger.debug("initing");
@@ -125,6 +125,5 @@
         
         return buf.toString();
     }
-
-    //public boolean getSkipOnSingleEntry() {return false;}
+    
 }

Modified: incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/email/ObfuscateEmailPlugin.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/email/ObfuscateEmailPlugin.java?rev=414918&r1=414917&r2=414918&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/email/ObfuscateEmailPlugin.java (original)
+++ incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/email/ObfuscateEmailPlugin.java Fri Jun 16 14:22:13 2006
@@ -1,24 +1,21 @@
 /*
-* 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.
-*/
-/*
- * Created on Nov 2, 2003
+ * 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.presentation.velocity.plugins.email;
 
 import java.util.Map;
@@ -26,44 +23,45 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.roller.RollerException;
-import org.apache.roller.pojos.WeblogEntryData;
 import org.apache.roller.model.WeblogEntryPlugin;
+import org.apache.roller.pojos.WeblogEntryData;
 import org.apache.roller.pojos.WebsiteData;
 import org.apache.roller.util.RegexUtil;
 
+
 /**
- * @author lance
- *
+ * Obfuscate email addresses in entry text.
  */
-public class ObfuscateEmailPlugin implements WeblogEntryPlugin
-{
+public class ObfuscateEmailPlugin implements WeblogEntryPlugin {
+    
+    private static Log mLogger = LogFactory.getLog(ObfuscateEmailPlugin.class);
+    
     protected String name = "Email Scrambler";
+    
     protected String description = "Automatically converts email addresses " +
-      "to me-AT-mail-DOT-com format.  Also &quot;scrambles&quot; mailto: links.";
+            "to me-AT-mail-DOT-com format.  Also &quot;scrambles&quot; mailto: links.";
     
-    private static Log mLogger = 
-       LogFactory.getFactory().getInstance(ObfuscateEmailPlugin.class);
-           
-    public ObfuscateEmailPlugin()
-    {
+    
+    public ObfuscateEmailPlugin() {
         mLogger.debug("ObfuscateEmailPlugin instantiated.");
     }
     
-    public String toString() { return name; }
-
-	public void init(WebsiteData website, Map model) throws RollerException {
-	}
-
-	/* 
-     * Find any likely email addresses and HEX escape them 
-     * (non-Javadoc)
-	 * @see org.apache.roller.presentation.velocity.WeblogEntryPlugin#render(java.lang.String)
-	 */
-	public String render(WeblogEntryData entry, String str)
-	{
+    
+    public String getName() {
+        return name;
+    }
+    
+    
+    public String getDescription() {
+        return StringEscapeUtils.escapeJavaScript(description);
+    }
+    
+    
+    public void init(WebsiteData website, Map model) throws RollerException {}
+    
+    
+    public String render(WeblogEntryData entry, String str) {
         return RegexUtil.encodeEmail(str);
-	}
-
-    public String getName() { return name; }
-    public String getDescription() { return StringEscapeUtils.escapeJavaScript(description); }
+    }
+    
 }

Modified: incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java?rev=414918&r1=414917&r2=414918&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java (original)
+++ incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/readmore/ReadMorePlugin.java Fri Jun 16 14:22:13 2006
@@ -1,24 +1,21 @@
 /*
-* 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.
-*/
-/*
- * Created on Nov 2, 2003
+ * 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.presentation.velocity.plugins.readmore;
 
 import java.util.Map;
@@ -28,65 +25,54 @@
 import org.apache.roller.RollerException;
 import org.apache.roller.model.RollerFactory;
 import org.apache.roller.model.UserManager;
+import org.apache.roller.model.WeblogEntryPlugin;
 import org.apache.roller.pojos.WeblogEntryData;
 import org.apache.roller.pojos.WebsiteData;
-import org.apache.roller.model.WeblogEntryPlugin;
 import org.apache.roller.ui.core.RollerContext;
 import org.apache.roller.util.Utilities;
 
+
 /**
- * @author lance
+ * DEPRECATED. Truncates entry text and displays a link to read more.
  */
-public class ReadMorePlugin implements WeblogEntryPlugin
-{
+public class ReadMorePlugin implements WeblogEntryPlugin {
+    
+    private static Log mLogger = LogFactory.getLog(ReadMorePlugin.class);
+    
     protected String name = "Read More Summary";
     protected String description = "Stops entry after 250 characters and creates " +
-        "a link to the full entry.";
+            "a link to the full entry.";
     
-    private static Log mLogger = 
-       LogFactory.getFactory().getInstance(ReadMorePlugin.class);
-       
-    String baseURL = "";
+    private String baseURL = "";
     
-    public ReadMorePlugin()
-    {
+    
+    public ReadMorePlugin() {
         mLogger.debug("ReadMorePlugin instantiated.");
     }
     
-    public String toString() { return name; }
-
-	/* (non-Javadoc)
-	 * @see org.apache.roller.presentation.velocity.WeblogEntryPlugin#init(
-     *   org.apache.roller.presentation.RollerRequest, 
-     *   org.apache.velocity.context.Context)
-	 */
-	public void init(WebsiteData website, Map model) throws RollerException
-	{  
-        this.baseURL = RollerContext.getRollerContext().getAbsoluteContextUrl();        
-	}
-
-	/**
-     * @param mgr
-     * @param website
-     * @return
-     */
-    private String getPageLink(UserManager mgr, WebsiteData website) throws RollerException
-    {
-        return website.getDefaultPage().getLink();
+    
+    public String getName() {
+        return name;
     }
     
     
-    public String render(WeblogEntryData entry, String str)
-    {        
+    public String getDescription() {
+        return StringEscapeUtils.escapeJavaScript(description);
+    }
+    
+    
+    public void init(WebsiteData website, Map model) throws RollerException {
+        this.baseURL = RollerContext.getRollerContext().getAbsoluteContextUrl();
+    }
+    
+    
+    public String render(WeblogEntryData entry, String str) {
         // in case it didn't initialize
         String pageLink = "Weblog";
-        try
-        {
+        try {
             pageLink = getPageLink(
-                RollerFactory.getRoller().getUserManager(), entry.getWebsite());
-        }
-        catch (RollerException e) 
-        {
+                    RollerFactory.getRoller().getUserManager(), entry.getWebsite());
+        } catch (RollerException e) {
             mLogger.warn("Unable to get pageLink", e);
         }
         
@@ -95,18 +81,18 @@
         //String result = Utilities.truncateNicely(entry.getText(), 240, 260, "... ");
         
         // if the result is shorter, we need to add "Read More" link
-        if (result.length() < str.length())
-        {            
-            String link = "<div class=\"readMore\"><a href=\"" + 
-                baseURL + entry.getPermaLink() + "\">Read More</a></div>";
+        if (result.length() < str.length()) {
+            String link = "<div class=\"readMore\"><a href=\"" +
+                    baseURL + entry.getPermaLink() + "\">Read More</a></div>";
             
             result += link;
         }
         return result;
     }
-
-
-    public String getName() { return name; }
-    public String getDescription() { return StringEscapeUtils.escapeJavaScript(description); }
+    
+    
+    private String getPageLink(UserManager mgr, WebsiteData website) throws RollerException {
+        return website.getDefaultPage().getLink();
+    }
     
 }

Modified: incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/smileys/SmileysPlugin.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/smileys/SmileysPlugin.java?rev=414918&r1=414917&r2=414918&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/smileys/SmileysPlugin.java (original)
+++ incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/smileys/SmileysPlugin.java Fri Jun 16 14:22:13 2006
@@ -1,105 +1,86 @@
 /*
-* 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.presentation.velocity.plugins.smileys;
+ * 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.
+ */
 
-import org.apache.commons.lang.StringEscapeUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.roller.RollerException;
-import org.apache.roller.pojos.WeblogEntryData;
-import org.apache.roller.model.WeblogEntryPlugin;
+package org.apache.roller.presentation.velocity.plugins.smileys;
 
 import java.util.Enumeration;
 import java.util.Map;
 import java.util.Properties;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.roller.RollerException;
+import org.apache.roller.model.WeblogEntryPlugin;
+import org.apache.roller.pojos.WeblogEntryData;
 import org.apache.roller.pojos.WebsiteData;
 import org.apache.roller.ui.core.RollerContext;
 
+
 /**
  * Converts ascii emoticons into HTML image tags.
- * 
- * @author lance.lavandowska
- * Created on Jun 8, 2004
  */
-public class SmileysPlugin implements WeblogEntryPlugin
-{
-    private String name = "Emoticons";
-    private String description = "Change ASCII emoticons to graphics.  " +
-        ":-) becomes <img src='./images/smileys/smile.gif'>";
+public class SmileysPlugin implements WeblogEntryPlugin {
     
-    public String toString() { return name; } 
+    private static Log mLogger = LogFactory.getLog(SmileysPlugin.class);
     
     public static Pattern[] smileyPatterns = new Pattern[0]; // public for tests
     static String[] imageTags = new String[0];
-
-    private static Log mLogger = 
-        LogFactory.getFactory().getInstance(SmileysPlugin.class);
-
-    /*
-     * Definition of the emoticons 'glyph' and graphic.
-     */
     private static Properties smileyDefs = new Properties();
-    static
-    {
-        try
-        {
+    
+    private String name = "Emoticons";
+    private String description = "Change ASCII emoticons to graphics.  " +
+            ":-) becomes <img src='./images/smileys/smile.gif'>";
+    
+    
+    static {
+        try {
             smileyDefs.load(SmileysPlugin.class.getResourceAsStream("smileys.properties"));
-        }
-        catch (Exception e)
-        {
+        } catch (Exception e) {
             mLogger.error("Unable to load smileys.properties", e);
-        }        
+        }
     }
+
     
-    public SmileysPlugin()
-    {
+    public SmileysPlugin() {
         mLogger.debug("SmileysPlugin instantiated.");
     }
-
-    /* 
-     * Find occurences of ascii emoticons and turn them into
-     * HTML image pointers.
-     * 
-     * @see org.apache.roller.presentation.velocity.WeblogEntryPlugin#render(java.lang.String)
-     */
-    public String render(WeblogEntryData entry, String text)
-    {
-        Matcher matcher = null;
-        for (int i=0; i<smileyPatterns.length; i++)
-        {
-            matcher = smileyPatterns[i].matcher(text);
-            text = matcher.replaceAll(imageTags[i]);
-        }
-        return text;
+    
+    
+    public String getName() {
+        return name;
     }
-
-    /* 
+    
+    
+    public String getDescription() {
+        return StringEscapeUtils.escapeJavaScript(description);
+    }
+    
+    
+    /*
      * Convert the SmileyDefs into RegEx patterns and img tags for
      * later use.  Need an HttpServletRequest though so that we can
      * get the ServletContext Path.  But only do it once.
      */
-    public synchronized void init(WebsiteData website, Map model) throws RollerException
-    {
+    public synchronized void init(WebsiteData website, Map model) throws RollerException {
         // don't do this work if Smileys already loaded
-        if (SmileysPlugin.smileyPatterns.length < 1)
-        {
+        if (SmileysPlugin.smileyPatterns.length < 1) {
             String baseURL = RollerContext.getRollerContext().getAbsoluteContextUrl(null);
             
             Pattern[] tempP = new Pattern[SmileysPlugin.smileyDefs.size()];
@@ -107,17 +88,16 @@
             //System.out.println("# smileys: " + smileyDefs.size());
             int count = 0;
             Enumeration enum1 = SmileysPlugin.smileyDefs.propertyNames();
-            while(enum1.hasMoreElements())
-            {
+            while(enum1.hasMoreElements()) {
                 String smiley = (String)enum1.nextElement();
                 String smileyAlt = htmlEscape(smiley);
                 tempP[count] = Pattern.compile(regexEscape(smiley));
-                tempS[count] = "<img src=\"" + 
-                               baseURL + "/images/smileys/" + 
-                               smileyDefs.getProperty(smiley, "smile.gif") +
-                               "\" class=\"smiley\"" + 
-                               " alt=\"" + smileyAlt + "\"" +
-                               " title=\"" + smileyAlt +"\" />";
+                tempS[count] = "<img src=\"" +
+                        baseURL + "/images/smileys/" +
+                        smileyDefs.getProperty(smiley, "smile.gif") +
+                        "\" class=\"smiley\"" +
+                        " alt=\"" + smileyAlt + "\"" +
+                        " title=\"" + smileyAlt +"\" />";
                 //System.out.println(smiley + "=" + tempS[count]);
                 count++;
             }
@@ -126,67 +106,65 @@
         }
     }
     
+    
+    /**
+     * Find occurences of ascii emoticons and turn them into HTML image pointers.
+     */
+    public String render(WeblogEntryData entry, String text) {
+        Matcher matcher = null;
+        for (int i=0; i<smileyPatterns.length; i++) {
+            matcher = smileyPatterns[i].matcher(text);
+            text = matcher.replaceAll(imageTags[i]);
+        }
+        return text;
+    }
+    
+    
     /*
      * To display the smiley 'glyph' certain characters
      * must be HTML escaped.
      */
-    private String htmlEscape(String smiley) 
-    {
+    private String htmlEscape(String smiley) {
         char[] chars = smiley.toCharArray();
         StringBuffer buf = new StringBuffer();
-        for (int i=0; i<chars.length; i++) 
-        {
-            if (chars[i] == '"')
-            {
+        for (int i=0; i<chars.length; i++) {
+            if (chars[i] == '"') {
                 buf.append("&quot;");
-            }
-            else if (chars[i] == '>')
-            {
+            } else if (chars[i] == '>') {
                 buf.append("&gt;");
-            }
-            else if (chars[i] == '<')
-            {
+            } else if (chars[i] == '<') {
                 buf.append("&lt;");
-            }
-            else
-            {    
+            } else {
                 buf.append(chars[i]);
             }
         }
-        return buf.toString();    
+        return buf.toString();
     }
-
+    
     /**
      * Some characters have to escaped with a backslash before
      * being compiled into a Regular Expression.
-     * 
+     *
      * @param smiley
      * @return
      */
-    private static char[] escape_regex = new char[] 
-        {'-', '(', ')', '\\', '|', ':', '^', '$', '*', '+', '?', 
-         '{', '}', '!', '=', '<', '>', '&', '[', ']' };
-    private String regexEscape(String smiley)
-    {
+    private static char[] escape_regex = new char[]
+    {'-', '(', ')', '\\', '|', ':', '^', '$', '*', '+', '?',
+     '{', '}', '!', '=', '<', '>', '&', '[', ']' };
+    
+    private String regexEscape(String smiley) {
         char[] chars = smiley.toCharArray();
         StringBuffer buf = new StringBuffer();
-        for (int i=0; i<chars.length; i++) 
-        {
-            for (int x=0; x<escape_regex.length; x++)
-            {
-                if (escape_regex[x] == chars[i])
-                {
+        for (int i=0; i<chars.length; i++) {
+            for (int x=0; x<escape_regex.length; x++) {
+                if (escape_regex[x] == chars[i]) {
                     buf.append("\\");
-                    break;                    
+                    break;
                 }
             }
             buf.append(chars[i]);
         }
         return buf.toString();
     }
-
-    public String getName() { return name; }
-    public String getDescription() { return StringEscapeUtils.escapeJavaScript(description); }
-
-    //public boolean getSkipOnSingleEntry() {return false;}
+    
 }

Modified: incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/textile/TextilePlugin.java
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/textile/TextilePlugin.java?rev=414918&r1=414917&r2=414918&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/textile/TextilePlugin.java (original)
+++ incubator/roller/branches/roller_3.0/contrib/plugins/src/org/apache/roller/presentation/velocity/plugins/textile/TextilePlugin.java Fri Jun 16 14:22:13 2006
@@ -1,20 +1,20 @@
 /*
-* 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.
-*/
+ * 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.presentation.velocity.plugins.textile;
 
@@ -26,48 +26,53 @@
 import org.apache.roller.pojos.WebsiteData;
 import org.apache.roller.model.WeblogEntryPlugin;
 
+
 /**
- * @author David M Johnson
+ * Render text using textile engine.
  */
-public class TextilePlugin implements WeblogEntryPlugin
-{
+public class TextilePlugin implements WeblogEntryPlugin {
+    
+    private static Log mLogger = LogFactory.getLog(TextilePlugin.class);
+    
     public String name = "Textile Formatter";
     public String description = "Allows use of Textile formatting to easily " +
-        "generate HTML. See the <a href='http://textism.com/tools/textile' target='textile'>Textile</a> site.";
-
-    public String toString() { return name; } 
+            "generate HTML. See the <a href='http://textism.com/tools/textile' target='textile'>Textile</a> site.";
     
     private net.sf.textile4j.Textile mTextile = new net.sf.textile4j.Textile();
     
-    private static Log mLogger = 
-       LogFactory.getFactory().getInstance(TextilePlugin.class);
     
-    public TextilePlugin()
-    {
+    public TextilePlugin() {
         mLogger.debug("Textile Plugin instantiated.");
     }
     
-    /** 
+    
+    public String getName() {
+        return name;
+    }
+    
+    
+    public String getDescription() {
+        return StringEscapeUtils.escapeJavaScript(description);
+    }
+    
+    
+    /**
      * Put plugin into the page context so templates may access it.
      */
-    public void init(WebsiteData website, Map model)
-    {
+    public void init(WebsiteData website, Map model) {
+        // TODO: we probably shouldn't allow plugins access to the model
         model.put("textileRenderer",this);
     }
     
-    /** 
+    
+    /**
      * 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 )
-    {
+    public String render(WeblogEntryData entry, String src ) {
         return mTextile.process(src);
     }
-
-    public String getName() { return name; }
-    public String getDescription() { return StringEscapeUtils.escapeJavaScript(description); }
-
-    //public boolean getSkipOnSingleEntry() {return false;}
+    
 }