In Confluence v.5.3, I'm trying to write a User Macro that creates a table from my index page's children. Each child page has an Excerpt macro in it that I need to add to the index page's table. From my User Macro, the excerpts are being pulled out by calling Excerpt-Include within my macro. They are printing quite fine on the table.
My problem is I can't seem to use the excerpts within an if-else comparison. For whatever reason, it's not comparing them because of a type incompatibility or I'm writing it incorrectly. This is what I am attempting to do:
#set($macroFinal = "{excerpt-include:" + $page.getTitle() + "|nopanel=true}") #set($myexcerpt = $action.getHelper().renderConfluenceMacro($macroFinal).replaceAll('"', '"') + " ") #if($myexcerpt == "High") #set($colors = "#F0F0F0") #else #set($colors = "#FFFFFF") #end
Any idea how to get the comparison to work?
Well, I feel a little silly now. After some more fiddling with it, it turns out I just needed a "toString" on the end of the macro call.
#set($myexcerpt = $action.getHelper().renderConfluenceMacro($macroFinal).replaceAll('"', '"').toString())
Worked perfectly fine after I got that in. So, note to everyone, when in doubt, toString. XD
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.