Class HtmlTextTemplateMigrationHelper

java.lang.Object
de.xima.fc.logic.migrate.HtmlTextTemplateMigrationHelper

public final class HtmlTextTemplateMigrationHelper extends Object
  • Method Details

    • readDefaultPre83CssRules

      public static Set<String> readDefaultPre83CssRules() throws IOException
      Reads the default CSS rules from the classpath. This is all the CSS that was contained in the system HTML text templates provided by the system before the form theme update.
      Returns:
      A set of default CSS rules.
      Throws:
      IOException
    • removeDefaultStylesFromHtml

      public static String removeDefaultStylesFromHtml(String html, Set<String> defaultCssRules)
      Parses the given HTML and inspects all inline styles. If all inline styles are default styles, removes all inline styles and returns the HTML without those styles. Otherwise, if the HTML contains at least one inline style that does not solely consist of default styles, returns null.
      Parameters:
      html - The HTML to inspect.
      Returns:
      The HTML without default styles, or null if the HTML cannot be parsed or contains either not styles at all or non-default styles.