Skip to end of banner
Go to start of banner

Script - list of user macros

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

List of user macros

{cache:refresh=7d|showRefresh=true|showDate=true|checkAttachments=false}
{run-now:exportFile=^user_macros.html|autoExport=true}
{groovy:output=wiki}
import com.atlassian.confluence.setup.bandana.ConfluenceBandanaContext
import com.atlassian.confluence.renderer.UserMacroConfig

def excludeList = ['xxxx'] // user macros that cause formatting errors
def userMacroKey = 'atlassian.confluence.user.macros'
def userMacros = bandanaManager.getValue(new ConfluenceBandanaContext(), userMacroKey)

if (excludeList.size() > 0) {
    println 'Exclude list: '
    excludeList.each { exclude -> println '- ' + exclude }
}

println '\n{table-plus:autoNumber=true|sortColumn=1|sortIcon=true}'
println '|| Name || Body type || Output type || Has Body || Macro ||'

if (userMacros != null) {  // null if no user macros defined
	userMacros.keySet().sort().each { key ->
    if (!(key in excludeList)) { // something with this one messes up formatting
        def macro = userMacros.get(key)
        def template = '{noformat} ' + macro.getTemplate().replaceAll("noformat", "_noformat_").replaceAll("table-plus", "_table-plus_") + ' {noformat}'
        println "| ${macro.getName()} | ${macro.getBodyType()} | ${macro.getOutputType()} | ${macro.isHasBody()} | " + template + ' | '
    }
}
}
println '{table-plus}'

{groovy}
{run-now}
{cache} 

  • No labels