Purpose
This will make all following confluence tables a specific width
Details
Macro Name | related-content | ||||||||
---|---|---|---|---|---|---|---|---|---|
Macro-Title | Create Page below Parent | ||||||||
Description | This Macro creates a headline and display all pages with the same labels as the Page itself | ||||||||
Categories | Confluence Content | ||||||||
Documentation URL | http://www.mos-eisley.dk/x/CgBNAQ | ||||||||
Definition of User Macro |
| ||||||||
Reference | Modified from http://confluence.atlassian.com/display/DISC/Related+Content |
Macro Code Confluence < 5.7
## @noparams <h2>Relaterede sider eller blogs:</h2> #set($wiki="") #set($globalHelper=$action.getHelper()) #if($content) ## i. e. we render a normal page #set($renderer=$globalHelper.getWikiStyleRenderer()) #set($context=$content.toPageContext()) #set($labelList=$content.getGlobalLabels($action.getRemoteUser())) #if($labelList.size() > 0) #set($labelUtil=$content.getLabelUtil()) #set($labels=$labelUtil.convertToDelimitedString($labelList)) #if($paramlabel) #set($labels=$labels + " " + $paramlabel) #end #if($paramlabels) #set($labels=$labels + " " + $paramlabels) #end #set($wiki="{contentbylabel:labels=$labels") #if($paramauthor) #set($wiki=$wiki + "|author=$paramauthor") #end #if($paramtype) #set($wiki=$wiki + "|type=$paramtype") #end #if($paramshowLabels) #set($wiki=$wiki + "|showLabels=$paramshowLabels") #end #if($paramshowSpace) #set($wiki=$wiki + "|showSpace=$paramshowSpace") #end #if($paramtitle) #set($wiki=$wiki + "|title=$paramtitle") #end #if($parammax) #set($wiki=$wiki + "|max=$parammax") #end #if($parammaxResults) #set($wiki=$wiki + "|max=$parammaxResults") #end #if($paramexcerpt) #set($wiki=$wiki + "|excerpt=$paramexcerpt") #end #if($paramspace) #set($wiki=$wiki + "|space=$paramspace") #end #if($paramspaces) #set($wiki=$wiki + "|space=$paramspaces") #end #if($paramsort) #set($wiki=$wiki + "|sort=$paramsort") #end #if($paramreverse) #set($wiki=$wiki + "|reverse=$paramreverse") #end #set($wiki=$wiki + "}") #end #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 ${xhtml}
Macro Code Confluence >= 5.7
Confluence 5.8 and onwards use CQL for searching (internally/REST) - https://developer.atlassian.com/blog/2015/02/confluence-5-7-apis/ + https://developer.atlassian.com/confdev/confluence-rest-api/advanced-searching-using-cql
## @noparams <div id=related-content> <script language=javascript> function toogle(divname) { if (document.getElementById(divname).style.display != "block") { document.getElementById(divname).style.display = "block"; } else { document.getElementById(divname).style.display = "none"; } } </script> #if($content.getIdAsString()!='4161541') #set($wiki="") #set($globalHelper=$action.getHelper()) #if($content) ## i. e. we render a normal page #set($renderer=$globalHelper.getWikiStyleRenderer()) #set($context=$content.toPageContext()) #set($labelList=$content.getGlobalLabels($action.getRemoteUser())) #if($labelList.size() > 0) #set($labelUtil=$content.getLabelUtil()) #set($labels=$labelUtil.convertToDelimitedString($labelList)) #set($labels="'"+$labels+"'") #set($labels=$labels.replace(" ","','")) <h1><a href="javascript:;" onclick="toogle('rcontent');">Sider med lignende indhold</a></h1> <br> <div id=rcontent name=rcontent style="display:block;"> <ac:structured-macro ac:macro-id="e5bbc54f-287e-447c-9e9e-f84af88ad353" ac:name="contentbylabel" ac:schema-version="2"> <ac:parameter ac:name="showLabels">false</ac:parameter> <ac:parameter ac:name="cql">label in ($labels) AND label != "noshow"</ac:parameter> </ac:structured-macro> </div> #end #end #end </div>
1 Comment
Normann P. Nielsen
27-04-2012Implemeter evt. $content.getIdAsString() for ikke at vise den på 1 eller flere sider