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

How documented by the first parameter in the User Macro?

Libor Tvrdík March 31, 2015

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
Libor Tvrdík April 3, 2015

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

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 31, 2015

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

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events