public class HTMLUtil extends Object
Constructor and Description |
---|
HTMLUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
entify(String text)
Converts instances of
<, >, & and " into their
entified equivalents: <, >, & and " . |
static String |
makeLinear(String text)
Inserts a
<br> tag before every newline. |
static String |
makeParagraphs(String text)
Inserts a {@code
|
static String |
restrictHTML(String src)
Restrict all HTML from the specified String.
|
static String |
restrictHTML(String src,
boolean allowFormatting,
boolean allowImages,
boolean allowLinks)
Restrict HTML except for the specified tags.
|
static String |
restrictHTML(String src,
String[] regexes)
Restrict HTML from the specified string except for the specified
regular expressions.
|
static String |
simpleFormat(String text)
Does some simple HTML markup, matching bare image URLs and wrapping
them in image tags, matching other URLs and wrapping them in href
tags, and wrapping * prefixed lists into ul-style HTML lists.
|
public static String entify(String text)
<, >, & and "
into their
entified equivalents: <, >, & and "
.
These characters are mentioned in the HTML spec as being common
candidates for entification.public static String makeParagraphs(String text)
<p>
tag between every two consecutive newlines.public static String simpleFormat(String text)
public static String restrictHTML(String src)
public static String restrictHTML(String src, boolean allowFormatting, boolean allowImages, boolean allowLinks)
allowFormatting
- enables <i>, <b>, <u>,
<font>, <br>, <p>, and
<hr>.allowImages
- enabled <img ...>.allowLinks
- enabled <a href ...>.Copyright © 2015. All rights reserved.