eval

evaluate a RubyLess expression

see else, link, set, show, text, trans

You can use this parameter to evaluated complex RubyLess expressions. The following example creates a link by using the link url as link text:

<r:link eval='url'/>

Please note that url is a helper method that takes the current node as default argument. See url.

obsolete docs to be removed

<r:set var='price'><r:show attr='d_price'/> 20.0</r:set>
<r:set var='count' do='stat' find='count'/>
<r:show eval='50 + ( price * count )' format='%.2f $'/>

<r:show eval='[d_total_hours] * 100.0' format='%.2f $'/>

In the example above, we use a trick to have a default value in case d_price is not set.

The value for “price” is set to 20.0 when d_price is empty or 25.0 20.0 when there is a value. The trick works because "25.0 20.0" as float is 25.0.

Also note that you have to use spaces between allowed signs in the expression. Currently permitted elements are:

* multiply
/ divide
+ add
( open parenthesis
) close parenthesis
[...] attribute
xyz set variable