Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
jinja2.utils.Cycler Class Reference

Public Member Functions

None __init__ (self, *t.Any items)
 
None reset (self)
 
t.Any current (self)
 
t.Any next (self)
 

Public Attributes

 items
 
 pos
 

Detailed Description

Cycle through values by yield them one at a time, then restarting
once the end is reached. Available as ``cycler`` in templates.

Similar to ``loop.cycle``, but can be used outside loops or across
multiple loops. For example, render a list of folders and files in a
list, alternating giving them "odd" and "even" classes.

.. code-block:: html+jinja

    {% set row_class = cycler("odd", "even") %}
    <ul class="browser">
    {% for folder in folders %}
      <li class="folder {{ row_class.next() }}">{{ folder }}
    {% endfor %}
    {% for file in files %}
      <li class="file {{ row_class.next() }}">{{ file }}
    {% endfor %}
    </ul>

:param items: Each positional argument will be yielded in the order
    given for each cycle.

.. versionadded:: 2.1

Member Function Documentation

◆ current()

t.Any jinja2.utils.Cycler.current (   self)
Return the current item. Equivalent to the item that will be
returned next time :meth:`next` is called.

◆ next()

t.Any jinja2.utils.Cycler.next (   self)
Return the current item, then advance :attr:`current` to the
next item.

◆ reset()

None jinja2.utils.Cycler.reset (   self)
Resets the current item to the first item.

The documentation for this class was generated from the following file: