Hi,
I'm writing a lot of user macros and stumble upon this one problem every now and then:
I have no idea how to escape double quotes properly. In this specific case I'm writing a macro that holds Bob Swifts run&cli plugins, where quotes are needed. Here's a code example:
#set($globalHelper = $action.getHelper()) #set ($update = $globalHelper.renderConfluenceMacro("{run:replace=status:green:Lorem ipsum?:radio::green::yellow::red|titleRun=lorem!} {cli:profile=confluence|hideOutput=false} --action storePage --space xxx --title "yyy" --content "zzz" {cli} Status aktualisiert. {run} "))
The part within the {cli-stuff makes the problems.
I tried single quotes, escaping with backslash...even HTML entities, nothing is working properly. With quotes like above I get an error message when using the macro (of course), when escaping the values are set exactly with the chars I used to escape.
I'm really hoping there's a solution for this :)
Hello Superuschi,
I stumbled into the same problem today and found that: http://mail-archives.apache.org/mod_mbox/velocity-user/200311.mbox/%3C3FC29041.3000000@gmx.de%3E
Thus, I solved my problem by introducing a constant containing the quote character
#set( $q = '"' )
and using it like that:
#set( $style = "style=${q}$paramStyle${q}" )
Hope that helps.
Kirstin,
Your solution also worked for me. I needed to expand a file name using a user supplied variable but the period and suffix were causing problems. Ther period needed to be separated from the variable name by whitespace or the variable would not be replaced witht the user supplied value :-(
I used this technique to create a suffix variable that was set to ".rss" and then my macro worked like a charm.
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nice to hear that, Matthew.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Okay, I figured that in this case, I can just use no quotes at all in the cli-part. Won't work in other cases though.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.