Package jetbrains.buildServer.web.util
Class HTMLFormatter
- java.lang.Object
-
- jetbrains.buildServer.web.util.HTMLFormatter
-
public class HTMLFormatter extends java.lang.Object
Utility class which is used to substitute text containing various links (http://, mailto:, ftp: and so on) with actual HTML link and line feeds with <br/> tag.Rewritten to fix TW-8635.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
LINK_WITH_TEXT_PATTERN
static java.lang.String
URL_PATTERN
-
Constructor Summary
Constructors Constructor Description HTMLFormatter()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
addTransformLinkPattern()
static void
addTransformLinkWithTextPattern()
static java.lang.String
format(java.lang.String text, javax.servlet.jsp.JspContext context)
Searches for plain links in specified text and returns the same text with links transformed to HTML links (<a href=""></a>).static java.lang.String
format(java.lang.String text, WebContext context)
Searches for plain links in specified text and returns the same text with links transformed to HTML links (<a href=""></a>).static java.lang.String
formatMultiLine(java.lang.String text)
Escapes the text for HTML and transforms line feeds with<br>
s.static java.lang.String
formatMultiLine(java.lang.String text, boolean escape)
Transforms line feeds with<br>
s.
-
-
-
Field Detail
-
URL_PATTERN
public static final java.lang.String URL_PATTERN
- See Also:
- Constant Field Values
-
LINK_WITH_TEXT_PATTERN
public static final java.lang.String LINK_WITH_TEXT_PATTERN
- See Also:
- Constant Field Values
-
-
Method Detail
-
format
public static java.lang.String format(java.lang.String text, @NotNull javax.servlet.jsp.JspContext context)
Searches for plain links in specified text and returns the same text with links transformed to HTML links (<a href=""></a>).- Parameters:
text
- text containing linkscontext
- JSP context- Returns:
- text with transformed links
-
format
public static java.lang.String format(java.lang.String text, @NotNull WebContext context)
Searches for plain links in specified text and returns the same text with links transformed to HTML links (<a href=""></a>).- Parameters:
text
- text containing linkscontext
- context for the transformation- Returns:
- text with transformed links
- Since:
- 2018.1
-
formatMultiLine
@NotNull public static java.lang.String formatMultiLine(@Nullable java.lang.String text)
Escapes the text for HTML and transforms line feeds with<br>
s.- Parameters:
text
- text to format- Returns:
- a formatted text
- Since:
- 7.0
-
formatMultiLine
@NotNull public static java.lang.String formatMultiLine(@Nullable java.lang.String text, boolean escape)
Transforms line feeds with<br>
s.- Parameters:
text
- text to formatescape
- true if text should be escaped first- Returns:
- a formatted text
- Since:
- 7.1.2, 8.0
-
addTransformLinkWithTextPattern
public static void addTransformLinkWithTextPattern()
-
addTransformLinkPattern
public static void addTransformLinkPattern()
-
-