Package org.fife.ui.rsyntaxtextarea
Class HtmlUtil
- java.lang.Object
-
- org.fife.ui.rsyntaxtextarea.HtmlUtil
-
public final class HtmlUtil extends java.lang.Object
Utility methods useful when generating HTML representations of RSTA content.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
HtmlUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.static java.lang.String
getHexString(java.awt.Color c)
Returns a hex string for the specified color, suitable for HTML.static java.lang.String
getTextAsHtml(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 withinpre
tags. 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
", ornull
ifc
isnull
.
-
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.
-
-