Package com.atlassian.confluence.util
Class ExcerptHelper
- java.lang.Object
-
- com.atlassian.confluence.util.ExcerptHelper
-
public class ExcerptHelper extends Object
Defines common functions that obtain excerpts of content (e.g. 'page children' and 'content by label' macros).
-
-
Constructor Summary
Constructors Constructor Description ExcerptHelper()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
getExcerpt(ContentEntityObject contentEntityObject)
Returns the body of an excerpt macro (including any xhtml tags).String
getExcerptSummary(ContentEntityObject contentEntityObject)
Returns the first line of an excerpt macro as plain text (all xhtml tags will be stripped)MacroDefinition
getMacroDefinition(ContentEntityObject contentEntityObject, String macroName)
Gets the firstMacroDefinition
in the supplied (@code contentEntityObject}.String
getText(String content)
Deprecated.since 7.20 UseContentExcerptUtils.extractTextFromXhtmlContent(String)
String
getTextSummary(String content, int minLength, int maxLength)
Deprecated.void
setContentTransformerFactory(ContentTransformerFactory contentTransformerFactory)
void
setHtmlParagraphStripper(HTMLParagraphStripper htmlParagraphStripper)
-
-
-
Method Detail
-
getExcerpt
public String getExcerpt(ContentEntityObject contentEntityObject)
Returns the body of an excerpt macro (including any xhtml tags).- Parameters:
contentEntityObject
- that contains the excerpt macro.- Returns:
- the body of an excerpt macro or
""
if there was no excerpt macro.
-
getExcerptSummary
public String getExcerptSummary(ContentEntityObject contentEntityObject)
Returns the first line of an excerpt macro as plain text (all xhtml tags will be stripped)- Parameters:
contentEntityObject
- that contains the excerpt macro.- Returns:
- the summary of an excerpt macro or
""
if there was no excerpt macro.
-
getMacroDefinition
public MacroDefinition getMacroDefinition(ContentEntityObject contentEntityObject, String macroName)
Gets the firstMacroDefinition
in the supplied (@code contentEntityObject}.- Parameters:
contentEntityObject
- (normally a Page) in which to find the macro.macroName
- the name of the macro to find.- Returns:
- the MacroDefinition or null if not found, or the content is not XHTML.
-
getText
@Deprecated public String getText(String content)
Deprecated.since 7.20 UseContentExcerptUtils.extractTextFromXhtmlContent(String)
Returns the text from a fragment of XHTML content.- Parameters:
content
- the XHTML content.- Returns:
- a value that contains only text.
-
getTextSummary
@Deprecated public String getTextSummary(String content, int minLength, int maxLength)
Deprecated.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.
-
setContentTransformerFactory
public void setContentTransformerFactory(ContentTransformerFactory contentTransformerFactory)
-
setHtmlParagraphStripper
public void setHtmlParagraphStripper(HTMLParagraphStripper htmlParagraphStripper)
-
-