Module platform

Class HtmlUtil

java.lang.Object
de.grogra.pf.ui.autocomplete.impl.HtmlUtil

public final class HtmlUtil extends Object
Utility methods useful when generating HTML representations of RSTA content.
  • Method Details

    • escapeForHtml

      public static String escapeForHtml(String s, String newlineReplacement, boolean inPreBlock)
      Returns a string with characters that are special to HTML (such as <, > and &) replaced by their HTML escape sequences.
      Parameters:
      s - The input string.
      newlineReplacement - What to replace newline characters with. If this is null, they are simply removed.
      inPreBlock - Whether this HTML will be in within pre tags. If this is true, spaces will be kept as-is; otherwise, they will be converted to " ".
      Returns:
      The escaped version of s.
    • getHexString

      public static String getHexString(Color c)
      Returns a hex string for the specified color, suitable for HTML.
      Parameters:
      c - The color.
      Returns:
      The string representation, in the form "#rrggbb", or null if c is null.