layout.html
file for Python's Sphinx and found the following random tit-bit of use when using Jinga:
{%- for rellink in rellinks[1:]|reverse %}
<div class="{{ loop.cycle('buttonPrevious', 'buttonNext') }}">
<a href="{{ pathto(rellink[0]) }}">
{{loop.cycle('Previous', 'Next')}}
</a>
{%- endfor %}
With
loop.cycle
you can cycle through string
s or div
sas the loop iterates..
In the above example, a
div
is created first for buttonPrevious and thenthe next iteration for buttonNext. The same applies to the strings that determine what gets
printed on the button.
No comments:
Post a Comment