Package com.day.text

Class AutoFormatter

java.lang.Object
java.text.Format
com.day.text.AutoFormatter
All Implemented Interfaces:
Serializable, Cloneable

public class AutoFormatter extends Format
The AutoFormatter class implements the automatic conversion of line endings to <br> HTML lists. This is the formatting subset of the UBM feature of the former Communiqué 2 system.

This implementation only supports automatically converting bulleted and numbered lists as well as line breaking. Therefore these formatting options are not implemented here : FORMAT_NOISODEC, FORMAT_ISOENC, FORMAT_AUTOLINK, and FORMAT_URLENC. For replacements, use the

invalid reference
CodeISO
and/or java.net.URLEncoder classes.
See Also:
  • Field Details

    • FORMAT_NOISODEC

      public static final int FORMAT_NOISODEC
      Deprecated.
      not implemented here, use
      invalid reference
      CodeISO
      instead.
      ISO encodes the <, " and & characters.
      See Also:
    • FORMAT_ISOENC

      public static final int FORMAT_ISOENC
      Deprecated.
      not implemented here, use
      invalid reference
      CodeISO
      instead.
      ISO encode characters according to HTTP standard.
      See Also:
    • FORMAT_AUTOLISTS

      public static final int FORMAT_AUTOLISTS
      Automatically create ordered and unordered lists.
      See Also:
    • FORMAT_BR

      public static final int FORMAT_BR
      Automatically convert line breaks to <br> tags
      See Also:
    • FORMAT_URLENC

      public static final int FORMAT_URLENC
      Deprecated.
      not implemented here, use
      invalid reference
      CodeISO
      or java.net.URLEncoder#encode(String) instead.
      Encodes characters illegal in URLs.
      See Also:
    • FORMAT_AUTOBR

      public static final int FORMAT_AUTOBR
      Combination of line break handling and automatic lists.
      See Also:
    • DEFAULT_FORMATTER

      public static final AutoFormatter DEFAULT_FORMATTER
      The system default formatter. Use this instance when formatting with no special configuration is needed.
  • Constructor Details

    • AutoFormatter

      public AutoFormatter()
      Deprecated.
      as of echidna. To get an instance with default settings use the DEFAULT_FORMATTER.
      Creates a new AutoFormatter object with the default configuration.
    • AutoFormatter

      public AutoFormatter(Properties config)
      Creates a new AutoFormatter object with the given configuration.

      The configuration contained in the config parameter is assumed to have the following structure, where config.getName() would return auto or config.getChild("auto") is used as the configuration (this is the same structure as was used in Communiqué 2 to configure automatic formatting.

               
                  
      invalid input: '<'ol begin="invalid input: '<'ol start=\"%s\">" end="" >

    All values are replaced as-is except for the ol.start attribute which gets the string %s replaced with the number which is used in the input to defined the ordered list. If the %s string is missing that number is of course not inserted.