Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a macro from another macro

Frederic Fox June 25, 2019

Hi,

I am writing a macro which based on a condition it should "call" the HTML macro with a paramater.

 

The end goal (as I guess that there is another way to achieve what I need) is to create an open div.

Basically output shoud be <div id = $paramX>

however currently when i look at page source the div is automatically closed which i why I was looking at calling the HTML macro where having an open div is possible.

 

Many thanks for our help (i am totally new to all this macro stuff)

1 answer

1 accepted

1 vote
Answer accepted
Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 26, 2019

I would ask why you want an open div tag?

But you don't need to call the HTML macro. A simple user macro will work, where:

## @param divID:title=Div ID

<div id = $paramdivID>

No I am not sure what will happen you place the macro. I assume it will just close the div tag immediately (i.e., you won't be able to place any content inside the div).

What I suggest is a wrapper macro where you place to the content you want to wrap inside the macro. Your new macro would be:

## @param divID:title=Div ID

<div id = $paramdivID>$body</div>

This will work.

Frederic Fox June 26, 2019

Thanks this is exactly what I needed !!!!

Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 27, 2019

Here is an article I wrote sometime back that talks about a more sophisticated wrapper macro, to give you more ideas:

https://community.atlassian.com/t5/Confluence-articles/Getting-Started-with-User-Macros-Writing-a-Wrapper-Macro/ba-p/979571

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events