public class

PlainTextToHtmlConverter

extends Object
java.lang.Object
   ↳ com.atlassian.confluence.util.PlainTextToHtmlConverter

Class Overview

Static methods for the conversion of text to HTML.

Summary

Public Constructors
PlainTextToHtmlConverter()
Public Methods
static String[] encodeHtmlEntities(Object... items)
Encodes the angle brackets, ampersands, and quotation marks in all the input items as HTML entities.
static String encodeHtmlEntities(String text)
Encodes the angle brackets, ampersands, and quotation marks in the input as HTML entities.
static String[] encodeHtmlEntities(String... items)
Encodes the angle brackets, ampersands, and quotation marks in all the input items as HTML entities.
static String matchAndReplaceSpaces(String html)
static String toHtml(String plainText)
The function converts plain text into html in two steps.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public PlainTextToHtmlConverter ()

Public Methods

public static String[] encodeHtmlEntities (Object... items)

Encodes the angle brackets, ampersands, and quotation marks in all the input items as HTML entities. The items are converted to Strings using valueOf(boolean).

Parameters
items objects to convert to strings and encode
Returns
  • an array containing the items converted to strings with encoded HTML entities

public static String encodeHtmlEntities (String text)

Encodes the angle brackets, ampersands, and quotation marks in the input as HTML entities.

Parameters
text string to encode
Returns
  • the input with encoded HTML entities

public static String[] encodeHtmlEntities (String... items)

Encodes the angle brackets, ampersands, and quotation marks in all the input items as HTML entities.

Parameters
items strings to encode
Returns
  • an array containing the items with encoded HTML entities

public static String matchAndReplaceSpaces (String html)

public static String toHtml (String plainText)

The function converts plain text into html in two steps. 1. utilize the oscore plain2html function to turn the plain text into html including converting linebreaks and special characters. 2. finds occurences of multiple spaces and replaces them with &nbsp html entities.

Returns
  • String converted to html