Class ContentExcerptUtils

java.lang.Object
com.atlassian.confluence.content.render.xhtml.ContentExcerptUtils

public final class ContentExcerptUtils extends Object
Defines common functions that obtain excerpts of content (e.g. 'page children' and 'content by label' macros).
  • Constructor Details

    • ContentExcerptUtils

      public ContentExcerptUtils()
  • Method Details

    • extractTextFromXhtmlContent

      public static String extractTextFromXhtmlContent(String content)
      Returns the text from a fragment of XHTML content.
      Parameters:
      content - the XHTML content.
      Returns:
      a value that contains only text.
    • extractTextSummaryFromXhtmlContent

      public static String extractTextSummaryFromXhtmlContent(String content, int minLength, int maxLength)
      Returns the text from the tag in the content (such as a heading or paragraph), unless its to short in which case text from the following tags are also included.
      Parameters:
      content - the XHTML content.
      minLength - the minimum length (normally 1) character (if available).
      maxLength - the maximum length (normally 100) characters.
      Returns:
      a value that contains only text.