This server will be upgraded at 3pm Sydney time on December 3rd (December 2nd, 8pm PST) and will be down for up to 30 minutes.

Render user macro wiki body in confluence prior to 2.3.3

##
## Render the wiki body in versions previous to 2.3
##
#set($wiki=$body)
#set($globalHelper=$action.getGlobalHelper())
#if($content) ## i. e. we render a normal page
#set($renderer=$globalHelper.getWikiStyleRenderer())
#set($context=$content.toPageContext())
#set($xhtml=$renderer.convertWikiToXHtml($context, $wiki))
#else ## we are e. g. in Global Template Preview
#set($xhtml=$globalHelper.renderConfluenceMacro($wiki))
#end
## remove leading <p> and trailing </p>
#if($xhtml.startsWith("<p>",0) && $xhtml.endsWith("</p>"))
#set($len=$xhtml.length()-$generalUtil.convertToInteger(4))
#set($xhtml=$xhtml.substring(3,$len))
#end
#set($body=$xhtml)
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Sep 19, 2007

    James Mortimer says:

    For Confluence versions prior to 2.3.3, this code snippet can be inserted before...

    For Confluence versions prior to 2.3.3, this code snippet can be inserted before user macros that would use the 'Convert macro body wiki markup to HTML' parameter that was made available in 2.3.3

    • renders wiki syntax from the body in the context of the current page
    • removes the extra <p>..</p> elements that used to be inserted in some versions
  2. Sep 19, 2007

    James Mortimer says:

    Please alter with care: this page is included in Expand Text User Macro
    Please alter with care: this page is included in Expand Text User Macro