org.makumba
Class HtmlUtils

java.lang.Object
  extended by org.makumba.HtmlUtils
Direct Known Subclasses:
HtmlChoiceWriter

public class HtmlUtils
extends Object

This class provides basic 'text-to-HTML' functionality.
Note: previously this was an existing class in the internal "util" package (fred, 2003-08-24).

Version:
$Id: HtmlUtils.java 5154 2010-05-18 22:01:40Z rosso_nero $
Author:

Field Summary
static String[] specials
           
static String[] tagExamples
           
 
Constructor Summary
HtmlUtils()
           
 
Method Summary
static boolean detectHtml(String s)
          Tries to detect whether input string is HTML-formatted; heuristic detection.
static String escapeQuotes(String str)
          escapes single and double quotes in a string by adding a forward slash before them
static void main(String[] args)
           
static int maxLineLength(String s)
          Determines the maximum length of a line in a text.
static String string2html(String s)
          Converts a string into its HTML correspondent using special codes.
static String stripHTMLTags(String str)
          removes HTML tags and replaces double quotes by the corresponding HTML entity, so that the passed text can safely be included in HTML attributes (such as the <A> TITLE attribute)
static String text2html(String s, String startSeparator, String endSeparator)
          Prints a text with very long lines.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

specials

public static String[] specials

tagExamples

public static String[] tagExamples
Constructor Detail

HtmlUtils

public HtmlUtils()
Method Detail

detectHtml

public static boolean detectHtml(String s)
Tries to detect whether input string is HTML-formatted; heuristic detection. Implementation note: For long input String, checks only first 32768 characters (32 KB).


string2html

public static String string2html(String s)
Converts a string into its HTML correspondent using special codes.


maxLineLength

public static int maxLineLength(String s)
Determines the maximum length of a line in a text.


text2html

public static String text2html(String s,
                               String startSeparator,
                               String endSeparator)
Prints a text with very long lines. Surrounds every paragraph with start|end- separator. FIXME bug 38.


stripHTMLTags

public static String stripHTMLTags(String str)
removes HTML tags and replaces double quotes by the corresponding HTML entity, so that the passed text can safely be included in HTML attributes (such as the <A> TITLE attribute)


escapeQuotes

public static String escapeQuotes(String str)
escapes single and double quotes in a string by adding a forward slash before them


main

public static void main(String[] args)