Confluence 2.9 : Working with Macros
This page last changed on Aug 06, 2008 by smaddox.
Macros perform programmatic functions within a page and can be used to generate complex content structures or dynamic content. Macros allow you to add extra functionality or include dynamic content in a page. For example, the Attachments macro will list a page's attachments in the page itself, so that readers do not have to visit the Attachments tab. On this page: Error formatting macro: toc: java.lang.NullPointerException
Including a Macro in your PageGenerally speaking, a macro is simply a command wrapped inside curly braces {...}. For instance, the Attachments Macro is written as:
{attachments} Optional Parameters in MacrosMany macros allow you to include optional parameters to control the macro's output. With the Attachments Macro, for instance, you have two optional parameters:
These optional parameters are included within the curly braces, following a colon, like this:
{attachments:patterns=.*jpg} When specifying more than one parameter within the same macro, use the pipe symbol ('|') to separate one from the other, like this: {attachments:old=true|patterns=.*jpg}
Case Sensitivity in Macro ParametersMacro parameters are case sensitive. In most cases, the macro will expect its parameters to be in lower case. Make sure you follow the documentation for the specific macro and match the expected case, otherwise the parameter may be ignored. For example, this code correctly has the parameter 'patterns' with a lower case 'p' as expected by the Attachments Macro: {attachments:patterns=.*jpg} This code will not work, because the parameter 'Patterns' has an upper case 'p', which the Attachments Macro will not recognise: {attachments:Patterns=.*jpg} Macros Shipped with your Confluence InstallationWhen you download your Confluence installation file, many macros are shipped with the download. Below is a list of the macros currently shipped with Confluence. Click a macro name for details of the usage, including optional parameters and examples.
Information about Other MacrosOther macros are available as plugins or as user macros, and can be installed by your Confluence administrator. Customers using Adaptavist macros or plugins might be interested in the Adaptavist's Confluence user guide. Some examples are:
Writing your own MacrosTo learn how to write your own macro, take a look at the following documentation:
RELATED TOPICSConfluence Notation Guide Overview Take me back to Confluence User Guide. |
![]() |
Document generated by Confluence on Aug 07, 2008 19:09 |