Confluence User Macros

Macros mit Source-Code in diesem Artikel:

Table of contents

Administration Panel

User Macro einstellen

Macro Browser

Parameter

Confluence Seite

Code Beispiele

Seiten-ID

## Macro title: Get Content ID
## Macro has a body: N
## Body processing: Unrendered
## Output: Unrendered
##
## Developed by: Jens
## Date created: 23/03/2020
## Installed by: Jens

## This is an example macro
## @noparams

$content.getIdAsString()

Parameter

## Macro title: Parameters Example
## Macro has a body: N
## Body processing: Unrendered
## Output: Rendered
##
## Developed by: Jens
## Date created: 23/03/2020
## Installed by: Jens

## This is an example macro
## @param status:title=Status|type=string|required=true|desc=Status to display
## @param user:title=Username|type=username|desc=Select username to display
## @param fromDate:title=From Date|type=date|desc=Date to start from. Format: dd/mm/YYYY
## @param numPosts:title=Number of Posts|type=int|default=15|desc=Number of posts to display
## @param pcent:title=Percentage|type=percentage|desc=Number of posts to display

<table>
<tr><td>Status</td><td>$paramstatus</td></tr>
<tr><td>Username</td><td>$paramuser</td></tr>
<tr><td>From Date</td><td>$paramfromDate</td></tr>
<tr><td>Number of Posts</td><td>$paramnumPosts</td></tr>
<tr><td>Percentage</td><td>$parampcent</td></tr>
</table>

Ersteller einer Seite

## Macro title: Get User Name
## Macro has a body: N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: Jens
## Date created: 25/03/2020
## Installed by: Jens

## This is an example macro
## @noparams

$content.getEntity().getCreator().getName()

Erstellungsdatum einer Seite

## Macro title: Get Creation Date
## Macro has a body: N
## Body processing: Selected body processing option
## Output: Selected output option
##
## Developed by: Jens
## Date created: 25/03/2020
## Installed by: Jens

## This is an example macro
## @noparams

#set( $dateFormatter = $action.getDateFormatter() )
#set( $creationDate = $content.getEntity().getCreationDate() )
$dateFormatter.formatDateTime($creationDate)

Circled Numbers

## Macro title: Get Circled Numbers
## Macro has a body: Y
## Body processing: N
## Output: N
##
## Developed by: Jens
## Date created: 27/03/2020
## Installed by: Jens

## This is an example macro
## @param Colour:title=Color|type=enum|enumValues=red,green,blue|default=red|desc=Choose a color
## @param Textsize:title=Textsize|type=enum|enumValues=100,200,300,400,500,600|default=100|desc=Textsize
## @param number:title=Number|type=int|default=1|desc=Enter a number between 1-10 or 11-20

#set( $bodyNumber = 10101 )
#set( $bodyNumber = $bodyNumber + $bodyNumber.parseInt($paramnumber) )
#set( $bodyString = "" )
#set( $bodyString = $bodyString.format("%c", $bodyNumber) )

<span style="font-size:$paramTextsize%;color:$paramColour">$bodyString</span>

Reach out to me for professional support!

Contact