crodas / Haanga

Template compiler for PHP, Django-style (as much as possible). Pretty efficent by avoiding to have anything at run-time.
http://haanga.org/
Other
136 stars 28 forks source link

Seems elif tag is missing... #19

Open eriknyk opened 12 years ago

eriknyk commented 12 years ago

Hi cesar,

from: https://docs.djangoproject.com/en/1.4/ref/templates/builtins/#if

if The {% if %} tag evaluates a variable, and if that variable is "true" (i.e. exists, is not empty, and is not a false boolean value) the contents of the block are output:

{% if athlete_list %} Number of athletes: {{ athlete_list|length }} {% elif athlete_in_locker_room_list %} Athletes should be out of the locker room soon! {% else %} No athletes. {% endif %} In the above, if athlete_list is not empty, the number of athletes will be displayed by the {{ athlete_list|length }} variable.

As you can see, the if tag may take one or several {% elif %} clauses, as well as an {% else %} clause that will be displayed if all previous conditions fail. These clauses are optional.

New in Django 1.4: Please see the release notes

The if tag now supports {% elif %} clauses.

Actually Haanga is not supporting elif tag,.. twig template engine implements elseif tag, do you have plans to add elif or elseif tag?

crodas commented 12 years ago

When I started haanga the "elif" was missing on Django. I can add a filter now but if you can need or if you can wait,yesterday I started a much cleaner version of haanga (it's called Haanga2) that will be more like twig. It should be ready within a month or so.

eriknyk commented 12 years ago

That's very good news :), i will wait for it.

Best regards.