Package org.freeplane.core.util
Class HtmlUtils
java.lang.Object
org.freeplane.core.util.HtmlUtils
Utilities for conversion from/to HTML and XML used in Freeplane: In scripts available
as "global variable"
htmlUtils.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcombineTextWithExceptionInfo(String text, Exception ex) static Stringstatic Stringstatic intstatic StringextractRawBody(String text) static ElementgetCurrentLinkElement(HTMLDocument doc, int pos) static HtmlUtilsstatic intgetMaximalOriginalPosition(int pI, ArrayList<HtmlUtils.IndexPair> pListOfIndices) static intgetMinimalOriginalPosition(int pI, ArrayList<HtmlUtils.IndexPair> pListOfIndices) static StringgetReplaceResult(Pattern pattern, String text, String replacement) Replaces text in node content without replacing tags. fc, 19.12.06: This method is very difficult.static StringgetURLOfExistingLink(HTMLDocument doc, int pos) Gets the string URL of an existing link, or null if none.static StringhtmlToPlain(String text) equivalent to htmlToPlain(text, strictHTMLOnly=true, removeNewLines=true)static StringhtmlToPlain(String text, boolean strictHTMLOnly) equivalent to htmlToPlain(text, strictHTMLOnly, removeNewLines=true)static StringhtmlToPlain(String text, boolean strictHTMLOnly, boolean removeNewLines) removes html markup and entities, partly and where appropriate by replacing it by plaintext equivalents like <li> → '*'.static StringiconToHtml(Icon icon) static StringimageToHtml(RenderedImage image) static booleanstatic booleanstatic booleanisHtmlNode(String text) Deprecated.static StringJoin arbitrary texts to html.static StringobjectToHtml(Object object) static StringplainToHTML(String text) transforms&, <, >, \nand whitespace by their HTML counterpart and encloses the whole text in<html><body><p>...</p></body></html>.static Stringstatic StringRemoves all tags (<..>) from a string if it starts with "<html>..." to make it compareable.static StringtextToHTML(String text) static Stringstatic Stringstatic Stringstatic StringtoXMLEscapedText(String text) static Stringstatic StringtoXMLUnescapedText(String text) static Stringstatic String
-
Method Details
-
getInstance
-
htmlToPlain
equivalent to htmlToPlain(text, strictHTMLOnly=true, removeNewLines=true)- See Also:
-
htmlToPlain
equivalent to htmlToPlain(text, strictHTMLOnly, removeNewLines=true)- See Also:
-
htmlToPlain
removes html markup and entities, partly and where appropriate by replacing it by plaintext equivalents like <li> → '*'.- Parameters:
strictHTMLOnly- if true does nothing unless the text starts with <html>removeNewLines- set to false to keep all blank lines.
-
isHtmlNode
Deprecated. -
textToHTML
-
isHtml
-
plainToHTML
transforms&, <, >, \nand whitespace by their HTML counterpart and encloses the whole text in<html><body><p>...</p></body></html>. -
removeAllTagsFromString
-
removeHtmlTagsFromString
Removes all tags (<..>) from a string if it starts with "<html>..." to make it compareable. -
toXMLEscapedText
-
toXMLEscapedTextExpandingWhitespace
-
toXMLUnescapedText
-
unescapeHTMLUnicodeEntity
-
unicodeToHTMLUnicodeEntity
-
getMaximalOriginalPosition
- Returns:
- the maximal index i such that pI is mapped to i by removing all tags from the original input.
-
getMinimalOriginalPosition
-
getReplaceResult
Replaces text in node content without replacing tags. fc, 19.12.06: This method is very difficult. If you have a simpler method, please supply it. But look that it complies with FindTextTests!!! -
toHtml
-
objectToHtml
-
iconToHtml
-
imageToHtml
-
toXhtml
-
endOfText
-
combineTextWithExceptionInfo
-
element
-
element
-
extractRawBody
-
getURLOfExistingLink
Gets the string URL of an existing link, or null if none. -
getCurrentLinkElement
-
isEmpty
-
toHTMLEscapedText
-
join
Join arbitrary texts to html. Plain text arguments will be transformed viaplainToHTML(String), i.e. newlines and other special characters will be translated to their HTML counterpart and wrapped in a paragraph (<p></p>).// plain + html -> <html><body><p>text1</p>text2</body></html> HtmlUtils.join("text1", "", "<html><body>text2</body></html>"); // insert an empty paragraph (<p></p>) between two strings: HtmlUtils.join("text1", "", "text2"); // this will insert two paragraphs: HtmlUtils.join("text1", "\n", "text2");- Parameters:
texts- either html (starting with <HTML> or <html>) or plain text.- Returns:
- html
-