{% for page in pages %}
photo
{% for line in page.lines %} {% if line.recognition %} {% for segment in line.recognition %} segment_{{ segment.index }} {% endfor %} {% else %} line_{{ line.index }} {% endif %} {% endfor %}
{% endfor %}