HtmlUtils

org.freeplane.core.util

## クラス HtmlUtils

- java.lang.Object
- - org.freeplane.core.util.HtmlUtils

-     public class HtmlUtils
      extends java.lang.Object

  Utilities for conversion from/to HTML and XML used in Freeplane: In scripts available as "global variable" `htmlUtils`.

- - ### ネストされたクラスの概要

    ネストされたクラス
    修飾子とタイプ | クラスと説明
    --- | ---
    `static class` | `HtmlUtils.IndexPair`

  - ### メソッドの概要

    メソッド
    修飾子とタイプ | メソッドと説明
    --- | ---
    `static java.lang.String` | `combineTextWithExceptionInfo(java.lang.String text, java.lang.Exception ex)`
    `static java.lang.String` | `element(java.lang.String name, java.util.Map<java.lang.String,java.lang.String> attributes, java.lang.String content)`
    `static java.lang.String` | `element(java.lang.String name, java.lang.String content)`
    `static int` | `endOfText(java.lang.String html)`
    `static java.lang.String` | `extractRawBody(java.lang.String text)`
    `static javax.swing.text.Element` | `getCurrentLinkElement(javax.swing.text.html.HTMLDocument doc, int pos)`
    `static HtmlUtils` | `getInstance()`
    `static int` | `getMaximalOriginalPosition(int pI, java.util.ArrayList<HtmlUtils.IndexPair> pListOfIndices)`
    `static int` | `getMinimalOriginalPosition(int pI, java.util.ArrayList<HtmlUtils.IndexPair> pListOfIndices)`
    `static java.lang.String` | `getReplaceResult(java.util.regex.Pattern pattern, java.lang.String text, java.lang.String replacement)` Replaces text in node content without replacing tags. fc, 19.12.06: This method is very difficult.
    `static java.lang.String` | `getURLOfExistingLink(javax.swing.text.html.HTMLDocument doc, int pos)` Gets the string URL of an existing link, or null if none.
    `static java.lang.String` | `htmlToPlain(java.lang.String text)` equivalent to htmlToPlain(text, strictHTMLOnly=true, removeNewLines=true)
    `static java.lang.String` | `htmlToPlain(java.lang.String text, boolean strictHTMLOnly)` equivalent to htmlToPlain(text, strictHTMLOnly, removeNewLines=true)
    `static java.lang.String` | `htmlToPlain(java.lang.String text, boolean strictHTMLOnly, boolean removeNewLines)` removes html markup and entities, partly and where appropriate by replacing it by plaintext equivalents like <li> -> '*'.
    `static boolean` | `isEmpty(java.lang.String newText)`
    `static boolean` | `isHtmlNode(java.lang.String text)`
    `static boolean` | `isWellformedXml(java.lang.String xml)`
    `static java.lang.String` | `plainToHTML(java.lang.String text)`
    `static java.lang.String` | `removeAllTagsFromString(java.lang.String text)`
    `static java.lang.String` | `removeHtmlTagsFromString(java.lang.String text)` Removes all tags (<..>) from a string if it starts with " ..." to make it compareable.
    `static java.lang.String` | `toHtml(java.lang.String xhtmlText)`
    `static java.lang.String` | `toHTMLEscapedText(java.lang.String s)`
    `static java.lang.String` | `toXhtml(java.lang.String htmlText)`
    `static java.lang.String` | `toXMLEscapedText(java.lang.String text)`
    `static java.lang.String` | `toXMLEscapedTextExpandingWhitespace(java.lang.String text)`
    `static java.lang.String` | `toXMLUnescapedText(java.lang.String text)`
    `static java.lang.String` | `unescapeHTMLUnicodeEntity(java.lang.String text)`
    `static java.lang.String` | `unicodeToHTMLUnicodeEntity(java.lang.String text)`

    - ### クラスから継承されたメソッド java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### メソッドの詳細

    - #### getInstance

          public static HtmlUtils getInstance()

    - #### htmlToPlain

          public static java.lang.String htmlToPlain(java.lang.String text)

      equivalent to htmlToPlain(text, strictHTMLOnly=true, removeNewLines=true)
      関連項目:
        `htmlToPlain(String, boolean, boolean)`

    - #### htmlToPlain

          public static java.lang.String htmlToPlain(java.lang.String text,
                                     boolean strictHTMLOnly)

      equivalent to htmlToPlain(text, strictHTMLOnly, removeNewLines=true)
      関連項目:
        `htmlToPlain(String, boolean, boolean)`

    - #### htmlToPlain

          public static java.lang.String htmlToPlain(java.lang.String text,
                                     boolean strictHTMLOnly,
                                     boolean removeNewLines)

      removes html markup and entities, partly and where appropriate by replacing it by plaintext equivalents like <li> -> '*'.
      パラメータ:
        `strictHTMLOnly` - if true does nothing unless the text starts with <html>
        `removeNewLines` - set to false to keep all blank lines.

    - #### isHtmlNode

          public static boolean isHtmlNode(java.lang.String text)

    - #### plainToHTML

          public static java.lang.String plainToHTML(java.lang.String text)

    - #### removeAllTagsFromString

          public static java.lang.String removeAllTagsFromString(java.lang.String text)

    - #### removeHtmlTagsFromString

          public static java.lang.String removeHtmlTagsFromString(java.lang.String text)

      Removes all tags (<..>) from a string if it starts with "
      ..." to make it compareable.

    - #### toXMLEscapedText

          public static java.lang.String toXMLEscapedText(java.lang.String text)

    - #### toXMLEscapedTextExpandingWhitespace

          public static java.lang.String toXMLEscapedTextExpandingWhitespace(java.lang.String text)

    - #### toXMLUnescapedText

          public static java.lang.String toXMLUnescapedText(java.lang.String text)

    - #### unescapeHTMLUnicodeEntity

          public static java.lang.String unescapeHTMLUnicodeEntity(java.lang.String text)

    - #### unicodeToHTMLUnicodeEntity

          public static java.lang.String unicodeToHTMLUnicodeEntity(java.lang.String text)

    - #### getMaximalOriginalPosition

          public static int getMaximalOriginalPosition(int pI,
                                       java.util.ArrayList<HtmlUtils.IndexPair> pListOfIndices)

      戻り値:
        the maximal index i such that pI is mapped to i by removing all tags from the original input.

    - #### getMinimalOriginalPosition

          public static int getMinimalOriginalPosition(int pI,
                                       java.util.ArrayList<HtmlUtils.IndexPair> pListOfIndices)

    - #### getReplaceResult

          public static java.lang.String getReplaceResult(java.util.regex.Pattern pattern,
                                          java.lang.String text,
                                          java.lang.String replacement)

      Replaces text in node content without replacing tags. fc, 19.12.06: This method is very difficult. If you have a simplier method, please supply it. But look that it complies with FindTextTests!!!

    - #### isWellformedXml

          public static boolean isWellformedXml(java.lang.String xml)

      戻り値:
        true, if well formed XML.

    - #### toHtml

          public static java.lang.String toHtml(java.lang.String xhtmlText)

    - #### toXhtml

          public static java.lang.String toXhtml(java.lang.String htmlText)

    - #### endOfText

          public static int endOfText(java.lang.String html)

    - #### combineTextWithExceptionInfo

          public static java.lang.String combineTextWithExceptionInfo(java.lang.String text,
                                                      java.lang.Exception ex)

    - #### element

          public static java.lang.String element(java.lang.String name,
                                 java.lang.String content)

    - #### element

          public static java.lang.String element(java.lang.String name,
                                 java.util.Map<java.lang.String,java.lang.String> attributes,
                                 java.lang.String content)

    - #### extractRawBody

          public static java.lang.String extractRawBody(java.lang.String text)

    - #### getURLOfExistingLink

          public static java.lang.String getURLOfExistingLink(javax.swing.text.html.HTMLDocument doc,
                                              int pos)

      Gets the string URL of an existing link, or null if none.

    - #### getCurrentLinkElement

          public static javax.swing.text.Element getCurrentLinkElement(javax.swing.text.html.HTMLDocument doc,
                                                       int pos)

    - #### isEmpty

          public static boolean isEmpty(java.lang.String newText)

    - #### toHTMLEscapedText

          public static java.lang.String toHTMLEscapedText(java.lang.String s)