You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jinja2 supports e.g. {{ ' ' * 10 }} but that doesn't work with MiniJinja. We were able to circumvent the issue with a recursive macro, but that operator would simplify things!
Error: invalid operation: tried to use * operator on unsupported types string and number (in template.html:15)
Below is the workaround in case anyone else is having the same issue.
{%- macro repeat(s, times) -%}
{%- if times >= 1 -%}
{{ s }}
{%- if times > 1 -%}
{{ repeat(s, times - 1) }}
{%- endif -%}
{%- endif -%}
{%- endmacro -%}
{{ repeat("abc", 4) }}
The text was updated successfully, but these errors were encountered:
Jinja2 supports e.g.
{{ ' ' * 10 }}
but that doesn't work with MiniJinja. We were able to circumvent the issue with a recursive macro, but that operator would simplify things!Below is the workaround in case anyone else is having the same issue.
The text was updated successfully, but these errors were encountered: