User Macro show-if

I created a user macro to use the show-if command but it doesnt recongise it as macro and renders it as plan text.

however the velocity i am using it working fine but i want to use a show-if statement so the info is only displayed when the page is exported.


Here is the content of my user macro

## Macro name: pdf-revision
## @noparams

{show-if:display=printable}
#set($user = $userAccessor.getUser($content.lastModifierName))
#set($dateFormatter = $action.getDateFormatter())
Revision: $content.version by $user.fullName on $dateFormatter.format($content.lastModificationDate)
{show-if}

when thie macro is displayed in a page it renders like the following

{show-if:display=printable} Revision: 25 by Brian Mitchell on Dec 06, 2012 {show-if}

I dont understand though as if i edit the page and use the show-if statment it works with no issues, is this a problem as im using a macro within a macro?

1 answer

1 accepted

1 vote
Accepted answer
Thomas Schlegel Community Champion Dec 06, 2012

Hi Brian,

with Confluence 3.x there was the ability to have an output of type wiki markup. With this output, your example works fine.

With Confluence 4, this is not possible (there's no Wiki Markup anymore). A workaround might be to do something like this on the page:

{show-if:display=printable}pdf-revision{show-if}

and remove the "{show-if}" from the pdf-revision-macro

Hope this helps

Cheers

Thomas

This did work, thankyou very much

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Oct 24, 2018 in Confluence

Atlassian Research opportunity with Confluence templates

Do you use templates with Confluence? Take part in a remote 1-hr workshop. You'll receive USD $100 for your time!   We're looking for people to participate in a   remote 1-hr workshop...

1,114 views 17 14
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you