Support {% elif %} clause in if template tag syntax #35

Merged
merged 2 commits into from Jul 20, 2012

Projects

None yet

2 participants

@psyeugenic

I have implemented support for {% elif Expr %} clause like the if template tag in Django 1.4.

Example:

<td>
    {% if b.status == "done" %}
    <span class="badge badge-success">{{b.status}}</span>
    {% elif b.status == "aborted" %}
    <span class="badge badge-important">{{b.status}}</span>
    {% elif b.status == "timeout" %}
    <span class="badge badge-warning">{{b.status}}</span>
    {% else %}
    <span class="badge badge-info">{{b.status}}</span>
    {% endif %}
</td>

Unit tests for elif clauses are also included in the branch.

If this is something you want, merge it as-is or give a shout out to me if something needs polishing.

Regards,
Björn-Egil

@evanmiller

Love it, thanks!

@evanmiller evanmiller merged commit a61e741 into erlydtl:master Jul 20, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment