{% macro rating(num) %} {% set base = num/10*5 %} {% set r = base|round(0, 'floor') %} {% set l = (base - r)|round(1) %} {% for i in range(1, 6) %} {% if i <= base %} {% else %} {% if l >= 0.5 and loop.index == 4 %} {% else %} {% endif %} {% endif %} {% endfor %} {% endmacro %} {% macro actors_link(actors) %} {% for name in actors %} {{ name }}, {% endfor %} {% endmacro %}