Yes you're correct. Nested if-else constructs are not supported.

The current implementation is a simple "90%" approach. You can drop down to erb 
for a proper nested if/elsif/else (and frankly the erb syntax is much nicer 
than an XML-ish syntax for a construct like that).

The other advantage of the 'last_if' hack, is that it's very easy to create 
other tags that support else, e.g.

<collection>...</collection>
<else> ... content if the collection is empty ... </else>

As you can see we are pragmatists rather than purists : )

Tom


On 8 Jul 2010, at 06:25, femto Zheng wrote:

> Hello all, I'm examing the hobo dryml src,
> for the implementation of if/else tag,
> 
> <def attrs='test' tag='if'><%= 
>   test = all_attributes.fetch(:test, this)
>   res = (cond = !test.blank?) ? parameters.default : ""
>   Hobo::Dryml.last_if = cond
>   res
> %></def>
> 
> <def tag='else'><%= parameters.default unless Hobo::Dryml.last_if %></def>
> 
> It says else just simply examine the last_if value,
> it's just too simple and cannot handle nest case.
> so as I understand, it can not handle situation like this:
> If 
>   If
> Else
> 
> or situation like this?
> If
>   If
>   Else
> Else
> 
> right?
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Hobo Users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/hobousers?hl=en.

-- 
You received this message because you are subscribed to the Google Groups "Hobo 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/hobousers?hl=en.

Reply via email to