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

Do curly braces in string macro parameters break the macro?

rworgul April 3, 2014

Hello everyone,

i recently developed a confluence plugin which adds some xhtml macros. I just wondered how the image macro preview (while editing a page) is errornous or even fails rendering with a null pointer exception if you write something like {} in your string macro parameters. The final rendered macro would be ok, as seen in MacroBrowser or if you just view the page.

I started playing around, trying to find my mistake and discovered that it seems like this behavior hasn't anything to do with my plugin. I can simply reproduce it in several Confluence versions on different servers:

  • 5.4.4 for development (atlas-run),
  • 5.4.4 normal Confluence on another server,
  • 5.4.3 normal Confluence on root server,
  • 5.3.1 atlas-run

To reproduce it you can use the Panel macro:

  1. add Panel macro
  2. write "world" in body
  3. edit macro in MacroBrowser
  4. type "hello" in title
  5. save (-> everything works)
    working panel
  6. edit again in MacroBrowser
  7. append "{}" to "hello" -> "hello{}"
  8. save (-> will show a blank )
    error on panel

... or the Gallery macro, which is nearly the same procedure but with the difference, that it will cause an heavy error and won't render at all:

  1. add Gallery macro
  2. edit macro in MacroBrowser
  3. type "hello" in title param
  4. save (-> works)
    working gallery
  5. edit in MacroBrowser again
  6. append "{}" to "hello" -> "hello{}"
  7. save (-> gets stuck loading with all controls disabled)
    gallery produces errors

It won't break if you escape the curly braces with \{ and \}, but I dont think you have to?! E.g. the Gallery macro would render something like this if you escape the curly braces within the macro properties:

gallery macro with escaped curly braces in title

So what is the way to go? Escape curly braces and handle while executing the macro? If so, are there other characters likely to break the macros? Or is it something like a bug of the preview in edit mode (which could be the case because everything seems to render fine with curly braces - outside the edit mode)?

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
rworgul April 27, 2014

There was no real discussion about this topic and Steve could confirm that he got this behaviour, too, so I submitted this as a bug which got accepted by now:

https://jira.atlassian.com/browse/CONF-33399

So it really seems to be a bug.

1 vote
Steve Gerstner [bridgingIT]
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 3, 2014

It worked for me in Confluence 5.4 and i had a panel with the text "hello world! {}".

But i think that can happen accidently when you are fast in typing. Maybe you have not recognised selecting the gallery macro?

But I did not use the macro browser, maybe this helps ;)

rworgul April 3, 2014

It's not about the macro body, it's about it's properties in MacroBrowser. Please try to type something like this into a string property field like the title / heading of the panel.

Steve Gerstner [bridgingIT]
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 3, 2014

Hi Robert, I tried it in the panel title and it workd as well...

Steve Gerstner [bridgingIT]
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 3, 2014

some screenshot:

rworgul April 3, 2014

Hi again Steve, that looks like the final rendered version of the macro (like the one you get by viewing the page or using the preview in MacroBrowser). The problem I'm facing is only visible while you edit the page and get the WYSIWYG preview of the macro (not in macro browser, neither with the preview button -- directly in TinyMCE).

It would be great if you could show me how your TinyMCE displays this macro.

Steve Gerstner [bridgingIT]
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 13, 2014

Take a look on:

We changed our color scheme, so there are some different colors now ;)

rworgul April 13, 2014

Thank you for responding again. I'll explain it on your example. Your screenshot is from either the pages preview or from viewing the page. The problem occurs only in the WYSIWYG Editor.

For me the Panel Macro looks like this, too:

But if I edit the page it looks like this in editor:

As you can see, the macros icon and description is missing because of the curly braces in "world{}". If I remove the curly braces from world, the macro looks normal:

How does your makro look like in edit mode?

Steve Gerstner [bridgingIT]
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 14, 2014

Ok, I did never come to that point, that this is your problem. Maybe I'm just used on not trusting the editor :D

Yes, it's the same on my instance. But my expectation is never, that I get everything rendered perfectly in the editor. If I need informations on my configuration, I open the macro or just use the preview.

P.S.: I want the wikimarkup back ;)

TAGS
AUG Leaders

Atlassian Community Events