public class HtmlUtilities
extends java.lang.Object
| Constructor and Description |
|---|
HtmlUtilities() |
| Modifier and Type | Method and Description |
|---|---|
static void |
appendString2html(java.lang.StringBuilder sb,
java.lang.String s)
Appends a given non-HTML string to an HTML string, translating character
entities to the appropriate HTML form.
|
static java.lang.String |
highlightString(java.lang.String s,
java.lang.String styleTag,
java.util.List<java.lang.Integer> ranges)
Creates an HTML presentation of a given string, where selected substrings
are highlighted with a given syntax style tag.
|
static SyntaxStyle |
parseHighlightStyle(java.lang.String style,
java.awt.Font f)
Parses a string specifying a syntax highlight style.
|
static java.lang.String |
style2html(java.lang.String prop,
java.awt.Font f)
Parses a string specifying a syntax highlight style, and creates an
HTML representation for it.
|
public static SyntaxStyle parseHighlightStyle(java.lang.String style, java.awt.Font f)
style - The syntax highlight style string.f - The font to which the syntax style will apply.public static java.lang.String style2html(java.lang.String prop,
java.awt.Font f)
prop - The syntax highlight style string.f - The font to which the syntax style will apply.public static java.lang.String highlightString(java.lang.String s,
java.lang.String styleTag,
java.util.List<java.lang.Integer> ranges)
s - The (non-HTML) string to highlight.styleTag - The HTML string representing the highlight style.ranges - The indices of the substrings to highlight, in pairs: The start
index of a substring followed by the end index of the substring.public static void appendString2html(java.lang.StringBuilder sb,
java.lang.String s)
sb - The HTML string to which the non-HTML string is appended.s - The non-HTML string to append.