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
Community moderators have prevented the ability to post new answers.
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
Thanks Lukas! but thats not what Im after, this feature exists according to Atlassian documentation, just need to understand what Im doing wrong.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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=....
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tried that, didnt work :( Have you tried it and made it work this way? Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you refer to that documentation https://developer.atlassian.com/confdev/confluence-plugin-guide/confluence-plugin-module-types/macro-module/including-information-in-your-macro-for-the-macro-browser then this is <macro> and not <xhtml-macro>.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
well thats confusing :| Thanks Panos! Do you happen to know if there is a similar page for xhtml macro?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, not really :/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 ifdynamictasklist
is an alias oftasklist
, editing an existingdynamictasklist
macro will open it as atasklist
macro.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.