Вопрос

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, 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, egg on my face. Turns out I just needed to add a "toString" to the end of the whole thing.

#set($myexcerpt =  $action.getHelper().renderConfluenceMacro($macroFinal).replaceAll('"', '"').toString())

So, lesson learned, when in doubt, toString.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top