Databases Reference
In-Depth Information
When your macro doesn't have any parameters, you should use @noparams in
your template. This will let Confluence know that it doesn't need to display a
parameter input field. If your macro doesn't contain parameters and does not specify
@noparams , the macro browser will display a free-format textbox allowing users to
enter undefined parameters. You should use @noparams in your template as follows:
## @noparams
Template code
Now that we have a good descriptive header and parameter declarations for our
macro, it is time to write to the macro template code.
When writing your macro, the following objects are available to you to use:
Variable
Description
$body
The body of the macro, if your macro has one.
$param<name>
Named parameters as described in your macro template.
$renderContext
The PageContext object, useful for (among other things) checking
$renderContext.baseUrl or $renderContext.spaceKey .
More information on the PageContext object is located at
http://docs.atlassian.com/atlassian-confluence/
latest/com/atlassian/confluence/renderer/
PageContext.html .
$space
The space object where this page or blog post is located. This object
can be used to retrieve information as the space name, description,
and URL. More information is available at http://docs.
atlassian.com/atlassian-confluence/latest/com/
atlassian/confluence/spaces/Space.html .
$content
The current ContentEntity object in which this macro is included.
This can for example be used to retrieve attachments, labels, or
comments. More information is available at http://docs.
atlassian.com/atlassian-confluence/latest/com/
atlassian/confluence/core/ContentEntityObject.html .
Using these objects it is possible to get access to certain extra information that
is otherwise not available on a Confluence page; this makes user macros
really powerful.
Including another macro
For our user macro we want to include a predefined version of the panel
macro, bundled with Confluence. This means we need to find out what
the Confluence-specific XML is that defines the panel.
 
Search WWH ::




Custom Search