Class V2UserMacroAdapter

java.lang.Object
com.atlassian.renderer.v2.macro.BaseMacro
com.atlassian.confluence.renderer.v2.macros.V2UserMacroAdapter
All Implemented Interfaces:
com.atlassian.renderer.v2.macro.Macro

public class V2UserMacroAdapter extends com.atlassian.renderer.v2.macro.BaseMacro
An adapter class to allow XHTML user macros (i.e. GenericVelocityMacro) to be used as v2 macros.

As of Confluence 4.0, all user macros are automatically converted over to being XHTML macros represented as GenericVelocityMacro.

To ensure that we can still render user macros that appear in wiki markup, we need an adapter to allow our new XHTML user macros to be used as v2 macros by the v2 renderer.

Since:
4.0
  • Field Summary

    Fields inherited from interface com.atlassian.renderer.v2.macro.Macro

    RAW_PARAMS_KEY
  • Constructor Summary

    Constructors
    Constructor
    Description
    V2UserMacroAdapter(Macro xhtmlUserMacro)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    execute(Map parameters, String body, com.atlassian.renderer.RenderContext renderContext)
     
    com.atlassian.renderer.v2.RenderMode
    There are only two render modes that we need to support: suppress F_FIRST_PARA and allow F_HTMLESCAPE (see old version of com.atlassian.confluence.renderer.UserMacroConfig#toMacro())
     
    boolean
     

    Methods inherited from class com.atlassian.renderer.v2.macro.BaseMacro

    getTokenType, getWysiwygBodyType, isInline, suppressMacroRenderingDuringWysiwyg, suppressSurroundingTagDuringWysiwygRendering

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • V2UserMacroAdapter

      public V2UserMacroAdapter(Macro xhtmlUserMacro)
  • Method Details

    • execute

      public String execute(Map parameters, String body, com.atlassian.renderer.RenderContext renderContext) throws com.atlassian.renderer.v2.macro.MacroException
      Throws:
      com.atlassian.renderer.v2.macro.MacroException
    • getBodyRenderMode

      public com.atlassian.renderer.v2.RenderMode getBodyRenderMode()
      There are only two render modes that we need to support: suppress F_FIRST_PARA and allow F_HTMLESCAPE (see old version of com.atlassian.confluence.renderer.UserMacroConfig#toMacro())

      We don't need to respect F_HTMLESCAPE here, as this concern is handled in the execution of GenericVelocityMacro (also see CONFDEV-1509)

    • hasBody

      public boolean hasBody()
    • getXhtmlMacro

      public Macro getXhtmlMacro()