If I have a list of users
say [\"Sam\", \"Bob\", \"Joe\"]
, I want to do something where I can output in my jinja template file:
{%
And using the joiner
from http://jinja.pocoo.org/docs/dev/templates/#joiner
{% set comma = joiner(",") %}
{% for user in userlist %}
{{ comma() }}{{ user }}
{% endfor %}
It's made for this exact purpose. Normally a join or a check of forloop.last would suffice for a single list, but for multiple groups of things it's useful.
A more complex example on why you would use it.
{% set pipe = joiner("|") %}
{% if categories %} {{ pipe() }}
Categories: {{ categories|join(", ") }}
{% endif %}
{% if author %} {{ pipe() }}
Author: {{ author() }}
{% endif %}
{% if can_edit %} {{ pipe() }}
Edit
{% endif %}