Automatic line break when inserting user macro
Asked Answered
F

1

7

I'm using confluence from atlassian and I need a way to modify the text size, family, and color by using a user macro. I defined my macro as follows:

## @param 0:title=forecolor|type=string|desc=Text foreground color.  Enter colors such as: red / blue / green / etc.
## @param 1:title=backcolor|type=string|desc=Text background color.  Enter colors such as: red / blue / green / etc.
## @param 2:title=size|type=string|desc=Enter size in px, for example, 20px.
## @param 3:title=family|type=string|desc=Enter the font family (listing can be found here: http://www.w3.org/Style/Examples/007/fonts.en.html) (example: serif).
<span style="color: $param0; background-color: $param1; font-size: $param2; font-family: $param3;">$body</span>

Now the user can choose this macro 'Stylish' as such:

enter image description here

However confluence automatically adds a new line

tag with content I want to appear next to it. Assume I had the text:

The brown fox jumped over the cow.

And I wanted to set the background color of the word fox as red and its forecolor to yellow. If I apply this macro to that word I end up with something like this:

enter image description here

So it automatically puts a new line in on the word that has the macro assigned to it. I want to keep it inline the entire sentence and apply the formatting to a single word. Even If I select inline in the options it still puts it in a new line.

The result comes out to this:

enter image description here

Here is a screen shot in edit mode:

enter image description here

I have selected it inline, and published the page still the result shows the brown on one line fox on another line and finally jumped over the cow on yet another line. Atlassian Confluence 5.4.4 This macro should work like the <span> tag so that the item doesn't appear as a block style element.

Fukuoka answered 20/5, 2014 at 19:3 Comment(13)
I can't see your examplesSherburne
Which radio button do you have selected for the macro body processing?Sherburne
When I selected 'inline' in the options I managed to get it to work. I had to hit backspace with the cursor in front of the word after the macro though. Play around in the editor some more until it works, I can promise you it's possible.Sherburne
This does not work, I have clicked inline and I have hit backspace in front of the word.Fukuoka
Are you publishing or previewing the page to see what it actually looks like, or are you just looking at the page in edit mode? I took your exact macro code and it's working flawlessly for me.Sherburne
Ive published the page..I can add images to what it does, maybe you can share the images?Fukuoka
What browser are you using? Im on chrome.Fukuoka
Tried IE same issue....Fukuoka
Also what version of confluence have you tried this on? We are on Atlassian Confluence 5.4.4,Fukuoka
I've tried it on IE 9 and the most recent releases of chrome and firefox. We're running 4.3.7 but I can test it on 5.4 on my dev server. EDIT: Naturally the dev server is down.Sherburne
Well I tried to bounty this question but that too expired with no answers. I also had posted this on the atlassian q&a forum but got 0 hits. I went ahead and created a support ticket with atlassian and will provide any updates if they can resolve this.Fukuoka
I just fiddled with this on version 5.5 and couldn't get it to work like it did in 4. Hopefully atlassian will come back with a response/fix for your support ticketSherburne
@Sherburne - Awesome that you were able to reproduce it on the same version we are running. Strange how it worked in version 4 but not the latest version - this happens to us all the time, we add new functionality which ends up breaking prior functionality that used to work :). Well I appreciate you verifying this. We did get an e-mail from atlassian but the unfortunate thing is this is in their backlog :(.Fukuoka
M
0

There is no good way of doing this. There's a JIRA issue you can track: CONF-15860.

Monotheism answered 10/6, 2014 at 22:29 Comment(1)
Please add this as a comment not an answer, I've also opened a jira issue for this (see the comments section).Fukuoka

© 2022 - 2024 — McMap. All rights reserved.