{%+ macro render_line(line) +%}
{% if line.boundary %}
{% endif %}
{% if line.baseline %}
{% endif %}
{% if line.text is string %}
{{ line.text|e }}
{% else %}
{% for segment in line.recognition %}
{% if segment.boundary %}
{% else %}
{% endif %}
{% for char in segment.recognition %}
{{ char.text|e }}
{% endfor %}
{{ segment.text|e }}
{% endfor %}
{%+ if line.confidences|length %}{% for segment in line.recognition %}{{ segment.text|e }}{% endfor %}{% endif +%}
{% endif %}
{%+ endmacro %}
kraken {{ metadata.version }}
{{ page.date }}
{{ page.date }}
{% for entity in page.entities %}
{% if entity.type == "region" %}
{% if loop.previtem and loop.previtem.type == 'line' %}
{% endif %}
{% if entity.boundary %}{% endif %}
{%- for line in entity.lines -%}
{{ render_line(line) }}
{%- endfor %}
{% else %}
{% if not loop.previtem or loop.previtem.type != 'line' %}
{% endif %}
{{ render_line(entity) }}
{% if loop.last %}
{% endif %}
{% endif %}
{% endfor %}