Name | no-include |
---|---|
Macro Body Processing | Macro has a body |
Output format | HTML |
Usage | {"no-include} |
Ref | https://confluence.atlassian.com/display/DOC/Include+Page+Macro |
Code
#macro(trimp $xhtml) ## 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 $xhtml #end #macro(render $wiki) #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).replaceAll("\n|\r","")) #else## we are e. g. in Global Template Preview #set($xhtml=$globalHelper.renderConfluenceMacro($wiki).replaceAll("\n|\r","")) #end#trimp(${xhtml}) #end #set ($qString = $req.getQueryString()) #set ($titleStart = $qString.indexOf("title=")+6) #set ($nextAmpIndex = $qString.indexOf("&",$titleStart)) #if ($nextAmpIndex == -1) #set ($titleEnd = $qString.length()) #else #set ($titleEnd = $nextAmpIndex) #end #set ($reqTitle = $qString.substring($titleStart, $titleEnd)) #if ($content.title == $reqTitle) #render($body) #end