public abstract class BaseMacro extends Object implements Macro
RAW_PARAMS_KEY| Constructor and Description |
|---|
BaseMacro() |
| Modifier and Type | Method and Description |
|---|---|
TokenType |
getTokenType(Map parameters,
String body,
RenderContext context)
Declares what sort of html elements are returned by the macro.
|
WysiwygBodyType |
getWysiwygBodyType()
Defines how the Macro's body should be rendered for Wysiwyg editors.
|
boolean |
isInline()
Deprecated.
override
getTokenType(java.util.Map, java.lang.String, com.atlassian.renderer.RenderContext) to indicate inline or strict block behaviour. However, for
macros to be backwardly compatible they will still need to implement isInline() too. |
boolean |
suppressMacroRenderingDuringWysiwyg()
Suppress the rendering of the macro -- the macro's body may still be rendered (depending on the render mode of
the macro), but the HTML the macro adds will not be created.
|
boolean |
suppressSurroundingTagDuringWysiwygRendering()
Suppress surrounding div/span during Wysiwyg rendering.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitexecute, getBodyRenderMode, hasBodypublic TokenType getTokenType(Map parameters, String body, RenderContext context)
TokenType.INLINE elements will have paragraphs drawn around them, or be incorporated into paragraphs
they are included in.
TokenType.BLOCK elements will be treated as their own paragraph, splitting any paragraphs they
would otherwise be in.
TokenType.INLINE_BLOCK elements will not have paragraphs drawn around them, but they won't split any
paragraphs they appear in either.
Macros that contain elements that shouldn't appear in a paragraph, such as pre, should return
TokenType.BLOCK. If it produces a span, replacement text or text decoration, return
TokenType.INLINE. If it affects logic of whether its children are displayed but doesn't add its own
content, or you aren't sure what to return, return TokenType.INLINE_BLOCK.
The default implementation tries to maintain backward compatibility with most macros. It returns
TokenType.INLINE for macros that return true from isInline() and
TokenType.INLINE_BLOCK for macros that return false.
getTokenType in interface Macroparameters - ignoredbody - ignoredcontext - ignoredpublic boolean isInline()
getTokenType(java.util.Map, java.lang.String, com.atlassian.renderer.RenderContext) to indicate inline or strict block behaviour. However, for
macros to be backwardly compatible they will still need to implement isInline() too.
Most macros will want to return false here.
The default implementation now returns false, which has been a defacto default previously.
public boolean suppressSurroundingTagDuringWysiwygRendering()
MacrosuppressSurroundingTagDuringWysiwygRendering in interface Macropublic boolean suppressMacroRenderingDuringWysiwyg()
MacrosuppressMacroRenderingDuringWysiwyg in interface Macropublic WysiwygBodyType getWysiwygBodyType()
false from Macro.suppressSurroundingTagDuringWysiwygRendering(),
true from Macro.suppressMacroRenderingDuringWysiwyg() and true from Macro.hasBody().
The default implementation returns WysiwygBodyType.WIKI_MARKUP
for most macros, but WysiwygBodyType.PREFORMAT for macros that
have a Macro.getBodyRenderMode() of RenderMode.NO_RENDER.
getWysiwygBodyType in interface MacroWysiwygBodyType.WIKI_MARKUP or WysiwygBodyType.PREFORMATCopyright © 2019 Atlassian. All rights reserved.