Package org.fife.ui.rsyntaxtextarea
Class HtmlUtil
- java.lang.Object
-
- org.fife.ui.rsyntaxtextarea.HtmlUtil
-
public final class HtmlUtil extends java.lang.ObjectUtility methods useful when generating HTML representations of RSTA content.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateHtmlUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringescapeForHtml(java.lang.String s, java.lang.String newlineReplacement, boolean inPreBlock)Returns a string with characters that are special to HTML (such as<,>and&) replaced by their HTML escape sequences.static java.lang.StringgetHexString(java.awt.Color c)Returns a hex string for the specified color, suitable for HTML.static java.lang.StringgetTextAsHtml(RSyntaxTextArea textArea, int start, int end)Returns text from a text area as HTML.
-
-
-
Method Detail
-
escapeForHtml
public static java.lang.String escapeForHtml(java.lang.String s, java.lang.String newlineReplacement, boolean inPreBlock)Returns a string with characters that are special to HTML (such as<,>and&) replaced by their HTML escape sequences.- Parameters:
s- The input string.newlineReplacement- What to replace newline characters with. If this isnull, they are simply removed.inPreBlock- Whether this HTML will be in withinpretags. If this istrue, spaces will be kept as-is; otherwise, they will be converted to "".- Returns:
- The escaped version of
s.
-
getHexString
public static java.lang.String getHexString(java.awt.Color c)
Returns a hex string for the specified color, suitable for HTML.- Parameters:
c- The color.- Returns:
- The string representation, in the form "
#rrggbb", ornullifcisnull.
-
getTextAsHtml
public static java.lang.String getTextAsHtml(RSyntaxTextArea textArea, int start, int end)
Returns text from a text area as HTML. Markup is added so that the HTML represents the syntax highlighting in the editor.- Parameters:
textArea- The text area.start- The start offset.end- The end offset.- Returns:
- The HTML.
-
-