Missed Team ’24? Catch up on announcements here.

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

Adding an alias to xhtml-macro

Aviram Gabay
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.
April 15, 2015

Hi, 

I would like to rename some of my macros, Im trying to use the alias tag to ensure exiting macros will not break but it seems it has no effect.

Below is a code sample:

<xhtml-macro name="new-name" class="com.path.to.class" key="old-name">
    <alias name="old-name" />
    <category name="confluence-content"/>
    <parameters>
        <parameter name="username" required="true" type="username"/>
        <parameter name="container" required="false" type="string"/>
        <parameter name="location" required="false" type="enum">
            <value name="append"/>
            <value name="prepend"/>
        </parameter>
    </parameters>
</xhtml-macro>

Thanks for the help

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Lukas Knoch -Rumpelcoders-
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.
April 15, 2015

You could replace the old macros with the new ones with the help of https://marketplace.atlassian.com/plugins/at.rumpelcoder.confluence.search-and-replace

 

Aviram Gabay
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.
April 15, 2015

Thanks Lukas! but thats not what Im after, this feature exists according to Atlassian documentation, just need to understand what Im doing wrong.

Lukas Knoch -Rumpelcoders-
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.
April 15, 2015

I understand that. In this case try to put the alias as an attribute of the xhtml tag just like <xhtml-macro name="bla" alias="blub" class=....

Aviram Gabay
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.
April 15, 2015

Tried that, didnt work :( Have you tried it and made it work this way? Thanks!

Lukas Knoch -Rumpelcoders-
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.
April 15, 2015

No, sry didn`t try it. It could be that there is no more option for aliasing a macro with xhtml macros any more. You used to be able to do it with the v2 macro ( pre version 4) just by specifying the same plugin key with different name. An option might be to just copy the whole macro and just change name AND key for the copied version. That should give you the desired functionality.

Aviram Gabay
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.
April 15, 2015

Yes thats an option, I might use it if no one else is has a better solution. But Im still crossing my fingers for an official Atlassian response! Thanks for all your help!

Panos
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.
April 16, 2015
Aviram Gabay
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.
April 16, 2015

well thats confusing :| Thanks Panos! Do you happen to know if there is a similar page for xhtml macro?

Panos
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.
April 16, 2015

No, not really :/

0 votes
jgiacoppo
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 28, 2017

There is a way!

<xhtml-macro name='mymacro' class='com.atlassian.confluence.macro.thing.MyMacro' key='mymacro-xhtml'>
<description key="mymacro.description"/>
<alias name="mymacro-alias" />
<parameters/>
</xhtml-macro>

There's an obscure reference in Including Information in your Macro for the Macro Browser

The docs seem very confusing to me, so I'm going to suggest internally that we fix this up

 

Andrei September 10, 2018

There is no (easy) way.

The alias element works only when editing the macro (in the Macro Browser), or if you start typing {alias-name to get the editor.

The existing macros using the alias name will be shown as Unknown macro.

Tested with Confluence 6.4.3. The docs seems to say the same thing:

Defines an alias for the macro. This means that the Macro Browser will open for the defined aliases as if it were this macro.
For example if dynamictasklist is an alias of tasklistediting an existing dynamictasklist macro will open it as a tasklist macro.

TAGS
AUG Leaders

Atlassian Community Events