Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

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}")

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

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
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

342 views 23 8
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