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) }}
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.