It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Is there a good resourse for learning to write user macros?

We want to write a user macro to style certain numbered lists with alpha characters. We need a macro rather than just forcing a level 2 list in the source code or creating a style because we also output our documents using K15t Scroll PDF Exporter. In PDF Exporter numbered list styles can be styled in the template, but only for the entire document. K15t tells us that the exporter will maintain styles set in a user macro. So ... we need a user macro to style a numbered list with lower alpha characters.

K15t sent the following as an example, but we don't know enough to change the #set area of the macro. Looks like this might be a timestamp macro? You see our problem. WE understand everything that comes after <style>.

## @noparams

#set ($timestamp = $action.dateFormatter.calendar.timeInMillis)
#set ($uniqueClass = "list-${timestamp}")

.${uniqueClass} ol {
list-style-type: lower-alpha !important;
<div class="${uniqueClass}">

1 answer

0 votes
Dominic_Lagger Community Leader Dec 14, 2019

Hi @Kris Fininen 

There is one overview site, which let you know more about user macros:

I've had some programming skills but no clue about velocity. I learnt velocity just by try and error and the API

Confluence uses velocity as the script language. On the linked page, velocity is explained quite good. 

In your case:

  • The "#set" is to define a variable. 
  • The "$action.dateFormatter.calendar.timeInMillis" sets the actual time in milliseconds to the variable $timestamp
  • The "#set ($uniqueClass = "list-${timestamp}")" defines a unique class, which will be referenced in the HTML and the CSS, which you understand

Hope this gives you a good overview. If you need any help, let me know.

Regards, Dominic

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

How is your team having fun and bonding, remotely, utilizing Confluence?

Thanks everyone for answering last week’s question. The winner of the random drawing from those who commented is: @LarryBrock I’ll contact you separately with your prize details. This wee...

269 views 9 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you