Script - list of user macros

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} 

Log a request with our support team.

Confluence®, Jira®, Atlassian Bamboo®, Bitbucket®, Fisheye®, and Atlassian Crucible® are registered trademarks of Atlassian®
Copyright © 2005 - 2024 Appfire | All rights reserved. Appfire™, the 'Apps for makers™' slogan and Bob Swift Atlassian Apps™ are all trademarks of Appfire Technologies, LLC.