org.liquidsite.core.text
Class PlainFormatter

java.lang.Object
  extended byorg.liquidsite.core.text.PlainFormatter

public class PlainFormatter
extends java.lang.Object

A plain text formatter. This class contains static methods for processing plain text to HTML.


Constructor Summary
PlainFormatter()
           
 
Method Summary
static java.lang.String clean(java.lang.String text)
          Cleans a plain text string from excessive characters.
static java.lang.String escapeHtml(java.lang.String str)
          Escapes HTML constructs in a string.
static java.lang.String formatHtml(java.lang.String text)
          Formats a plain text string in HTML.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlainFormatter

public PlainFormatter()
Method Detail

clean

public static java.lang.String clean(java.lang.String text)
Cleans a plain text string from excessive characters.

Parameters:
text - the plain text string
Returns:
the cleaned text string

escapeHtml

public static java.lang.String escapeHtml(java.lang.String str)
Escapes HTML constructs in a string.

Parameters:
str - the string to process
Returns:
the HTML escaped string

formatHtml

public static java.lang.String formatHtml(java.lang.String text)
Formats a plain text string in HTML. This method will escape any occurencies of special HTML characters, insert HTML linebreaks instead of normal line breaks and create links for any absolute URLs found.

Parameters:
text - the plain text string
Returns:
the HTML encoded text