set_...

Set a variable to some content evaluated with RubyLess.

see set, zena 1.0

This is a very powerful and easy way to set variables. See set for another way to define variables.

Variables have priority over any other RubyLess evaluated method. For example, this means that you can overwrite date RubyLess method by setting:

<r:void set_date='log_at'>...</r:void>

You could do the same to overwrite “title” or any other method resolved with RubyLess.

You cannot overwrite zafu methods however.

storing node context

For example, you might want to keep track of the project before moving into the list of posts:

Note that set_… is evaluated before changing context and is the only exception where parameters before do are not considered html.

<div set_base='this' do='posts in project'>
  'this' is now the list of posts

  <r:link href='base'/> --> Linking to node stored in 'base' variable

  <r:base>
    Moving to 'base' context
  </r:base>

  Back to list of posts
</div>

Remember that “this” is a special keyword referring to the current node context.

storing anything

In fact, you can store anything with this trick (we suppose the ‘hourly_rate’ property exists) :

<r:void set_rate='hourly_rate'>
  ...
  Price: <r:eval>hours * rate</r:eval>
</r:void>