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

Confluence 5.3 String comparing Excerpts isn't working

Catherine Kramer February 13, 2014

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?

1 answer

1 accepted

0 votes
Answer accepted
Catherine Kramer February 18, 2014

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events