It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Do curly braces in string macro parameters break the macro?

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

0 votes
Answer accepted

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:

So it really seems to be a bug.

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 ;)

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.

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

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.

Take a look on:

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

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?

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 ;)

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Off-topic

Friday Fun: Virtual dance party!

Do dance parties help you relieve stress? How about *virtual dance parties*? My team holds virtual dance parties to brighten the mood of a tough day or celebrate an upcoming weekend.  Want t...

194 views 22 9
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you