How documented by the first parameter in the User Macro?

I have a old user macro with one default parameter.

#if($param0)
  #set ($object = $generalUtil.htmlEscapeQuotes($param0))
  <a href="http://some_address?object=$object&otherParam">$object</a>
#else
  Define link parameter!
#end
{link:some_object_atribute}

Question is: what should I use for the parameter name of default parameter? I not found in documentation yet.

## @param
## @param 0
## @param param0
## @param 0:title=Object 
## @param :title=Object
## @param param0:title=Object

2 answers

0 votes

There is no concept of "default parameter", you need to feed user macros proper parameters now.

But you can keep it simple.  Your third line will work - you can say ## @param param0, and it will assume you mean it's a string, and it will then be usable by looking at $paramparam0

Although, I've tended to use a style more like  ## @param BetterName, as that leads to something easier to read later in the code - $paramBetterName

 

Hi Nic,

Your advice does not help me. Maybe better describe what bothers me.


We have updated Confluence. We have ext -anch macro (for open link in new window). First parameter (unnamed) with the title, second is {{url}} and optional {{tagret}}.

This is old user macro without meta data. For users looking macro in editor as follows:

ext-anch_macro_in_editor.png

Where 15 is unnamed first parameter display as title in page preview.

The url is normal named parameter with url and target parameter not present yet.

When user click on the macro in editor, was displayed a warning message:

ext-anch_macro_in_editor_no_metadata.png

Ok, we added some metadata into macro:

##
## @param url:title=Url|type=string|required=true
## @param target:title=Target|type=string
##

and user can edit parameter url and target now:

ext-anch_macro_with_metadata_without_def_param.png

But if such an adjustment saves, losing the first (unnamed) parameter.

Question is

What can I do to allow the user to edit old title (first unnamed parameter)?


Cheers,

Libor

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,181 views 20 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