Missed Team ’24? Catch up on announcements here.

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

Can I set a default value for a user macro to be INLINE or BLOCK in the template?

Timothy Veldhuizen June 14, 2012

I have made a few user macro's in Confluence 3.3 and tested them in Confluence 4+.

The user macro's in Confluence 4 are all showed as block. I am aware of the fact that user macros with a body have the option in the RTE to set on a new line or at the same line, but that doesn't solve my problem.

My problem is that in combination with the create-page plugin we create in one click, pages based on templates, and on these templates we use te user macros. So everytime a new page is made based on a template a user should manually toggle the user macros to be on the same line...

I also read about a standard atlassian parameter for the output but it didn't help me solving the problem: http://community.customware.net/customware/topics/inline_text_following_a_macro

So my question is, can I set a default value for the outputtype in the user macro template, something like:

#set($macro.OutputType.INLINE)

or

#set($macro.getOutputType().INLINE)

or

#set($atlassian-macro-output-type=INLINE)

5 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Juri Reinsalu September 30, 2012

I was able to overcome this problem by explicitly adding this parameter:

<parameter name="atlassian-macro-output-type" type="enum" required="true">
        <value name="INLINE"/>
</parameter>

to macro declaration in atlassian-plugin.xml

It starts to appear in Macro Browser of course, but user can't change it from there (as its a "required" single-valued enum param).

User can still change it from macro property-panel though...

 

 

2 votes
Joe Clark
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
June 18, 2012

It looks like there is currently no 'proper' way for a user macro with a body to default itself to be an inline macro. The only way to do it is for the user to highlight the macro in the editor and select the 'inline' option for each macro instance. :-(

This was raised as a feature request in Confluence, but was marked as resolved in Confluence 4.0 because of this user editing option. (see https://jira.atlassian.com/browse/CONF-15860). It's a shame that this was closed, because I think there should be some choice on the part of the macro author as to what the default behaviour of the macro should be.

As CharlesH above me suggests, you'll probably have to write some javascript/css to manipulate the DOM to give your macro the 'appearance' of being inline.

Timothy Veldhuizen June 18, 2012

Joseph, indeed it seems like there is no 'proper' way for a user macro to default itself. And I agree there should be some choice for the author to set inline or block as default.

Thanks for the link to the feature request.

I also found this request (https://jira.atlassian.com/browse/CONF-24581)

0 votes
Roy Lu May 18, 2016

Hello,

Just want to follow up on this question, is there a way to use Velocity to set the default Output Type of a user macro to be BLOCK instead of INLINE? 

Thanks,

0 votes
Alejandro Conde Carrillo
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.
July 9, 2014

This is a current bug in the application and it is being tracked in CONF-22898.

0 votes
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.
June 15, 2012
If the Atlassian output-type parameter doesn't want to play ball in a user macro, then how about using your own parameter which triggers the inclusion of some jquery in the user macro output to manipulate itself, rendering as inline?

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events