I need to use break for a for loop in jinja2. Below is my code:
{% for i in range (0, desc) %}{{ desclist[i] }} {% set length = length + desclist[i]|length %}{% if length >= 70 %}{% break %}{% endif %}{% endfor %}
and to import the loopcontrol extension:
However, I got an error as followed:
jinja2.exceptions.TemplateSyntaxError: Encountered unknown tag 'break'.
Jinja was looking for the following tags: 'elif' or 'else' or 'endif'. The
innermost block that needs to be closed is 'if'.
Any idea to make this work? Thank you.