Trying to add curly brases to existing string does not consistently make a working macro
Asked by Diane Sexton:

We have a user who is making many wiki pages which rely on the viewxls macro. Instead of typing the viewxls string in every time, the user has made some automations in Excel so that all he has to do is copy and paste the viewxls macro sring into his wiki page and then add the curly braces to render the macro.

The workflow that we stumbled upon to make this behave reasonably consistently, is to double click to select the full macro string and then type the curly braces { } and the macro magically renders.

However this does not always work and we do not know why. It might stop working for the n+1th page after working consistently for n pages, and there is no common value for n. It might stop working for the nth page and then a different user can make it work on the same page. The user surmises that it will only work if he does nothing else on the new page, just pastes the string and then does the curlies. If the workflow is not exactly paste - select - type curlies (e.g. paste - type something - select - curlies) then it seems that it doesn't work.

We have also noticed the following behaviours with the curly braces and an existing macro string:

\* if you click to place the cursor at the start of the string( that is, before the v of viewxls) and then type the curly brace, then the autocomplete starts up and if the user ignores that and clicks to place the cursor at the end of the string and type the closing brace, then the macro fails to render. You just get a string enclosed in curly braces.

\* if you click somewhere within the string and the edit link popup appears, then use the keyboard arrow keys to move the cursor to the start of the macro string and type the opening curly brace, followed by arrowing to the end and typing the closing brace, then the macro consistently renders.

Basically we just want consistent behaviour for simple conversion of a string into a macro. We are unsure if this is a bug or not as the above workflow that we have used (double click and type the curlies) is not documented and we just stumbled upon it.


Answers:
author: Denise Unterwurzacher [Atlassian]
body: I have had a play around with your method, and I've not been able to replicate a situation where I can't get the macro to be picked up. What I did was this:

* Pasted my string: {viewxls:Page=TestPage\|name="test.xls"}
* I have done just about anything/everything else in the editor in between these steps and haven't had a problem
* Removed the closing } character
* Again, I have done anything/everything else in between usually with no problem
* Re-typed the closing } character

In a couple of cases this did not cause the macro to be picked up, though it was the vast minority. In those cases, I did this and the macro was picked up:

* Deleted the opening '{' as well, re-added it, then re-added the closing '}' character

I suspect this isn't an intended way of entering macros, but hopefully in most cases the above steps will cause the macro to be picked up. If you do find a consistent set of steps that cause the macro conversion to fail, please raise a ticket at <http://support.atlassian.com>


author: David at David Simpson Apps
body: If you use the **viewxls** macro a lot, perhaps you could create a [Keyboard Shortcut Module](https://developer.atlassian.com/display/CONFDEV/Keyboard+Shortcut+Module) for the macro in the editor.

e.g. "CTRL+L" or similar could bring up the macro browser with the **viewxls** macro selected, then you'd just need to paste the filename into the selected field.