user macro resolution order

Guenter Huber
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.
August 13, 2013

When I put a {userMacro} inside a [link to {userMacro}] it doesn t get resolved at the right time. Confluence wants to create a page, though the link exists.

Solution?
Thx
G.

1 answer

2 votes
EddieW
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.
August 14, 2013

I would suggest you modify the userMacro in question to just generate the link rather then the page name.

Guenter Huber
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.
August 22, 2013

Thanks, I did just this, but isn t the resolution order violation a major bug?

CharlesH
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.
August 22, 2013

Hi Guenter,

I'm not so sure this is a bug, major or minor. The output from a user macro could be anything, not just text. I guess Confluence is playing it safe and saying that a text string is expected between [ and ], hence it doesn't parse the contents for any user macro processing.

Regards,

Charles

Guenter Huber August 22, 2013

Well, thanks, my opinion is that expressions should be parsed in the right order, no matter what - and they could throw an error still if it evaluates to something the browser can t handle.

The currents behavior fits well with Confluence s other inconsistencies.
G.

EddieW
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.
August 22, 2013

@Guenter - if you feel strongly, I suggest you raise a well-worded ticket here, https://jira.atlassian.com and make your case for the Atlassian team to address. If feasible and highly desired they usually will deliver.

Daniel Borcherding
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.
August 23, 2013

@Guenter - I would also be interested to know what version of Confluence you are using.

Guenter Huber August 23, 2013

Good idea, Daniel!
5.1.3, so I need to re-test how much this applies to a version > 4. We were at 3.5.9 until recently.

Just tested this quickly and saw that a Link > Advanced [link to {userMacro}] renders an internal server error.

Needa rethink the whole dynamic link thing.
Thanks

Guenter Huber
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.
September 1, 2013

As I couldn t find a way to put a macro inside a link I had to code the whole thing as XHTML:

## @noparams
#set($len1 = $space.key.length() - 2)
#set($len2 = $space.key.length() - 1)
#set($sub0 = $space.Key.substring($len2))
#set($sub1 = $space.Key.substring($len1, $len2))
#set($sub2 = $space.Key.substring($len1, $len2))
#set($sub3 = $space.Key.substring($len2))
<ac:link> <ri:page ri:content-title="page title part 1 #if ($sub0 == "0")$sub1#else$sub2.$sub3#end page title part 2" ri:space-key="SPACEKEY"/> </ac:link>

As I got no answer to the https://answers.atlassian.com/questions/205782/velocity-expression-as-argument/205824 I had to put the argument expressions into variables.

G.

Suggest an answer

Log in or Sign up to answer