Skip to content

Commit

Permalink
Avoid duplicate ids in alto line/region typology
Browse files Browse the repository at this point in the history
  • Loading branch information
mittagessen committed Mar 1, 2024
1 parent e083808 commit 2ff2055
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions kraken/templates/alto
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'postprocessing': 'postOperation'}
%}
{%+ macro render_line(page, line) +%}
<TextLine ID="line_{{ line.index }}" HPOS="{{ line.bbox[0] }}" VPOS="{{ line.bbox[1] }}" WIDTH="{{ line.bbox[2] - line.bbox[0] }}" HEIGHT="{{ line.bbox[3] - line.bbox[1] }}" {% if line.baseline %}BASELINE="{{ line.baseline|sum(start=[])|join(' ') }}"{% endif %} {% if line.tags %}TAGREFS="{% for type in page.line_types %}{% if type[0] in line.tags and line.tags["type[0]"] == type[1] %}TYPE_{{ loop.index }}{% endif %}{% endfor %}"{% endif %}>
<TextLine ID="line_{{ line.index }}" HPOS="{{ line.bbox[0] }}" VPOS="{{ line.bbox[1] }}" WIDTH="{{ line.bbox[2] - line.bbox[0] }}" HEIGHT="{{ line.bbox[3] - line.bbox[1] }}" {% if line.baseline %}BASELINE="{{ line.baseline|sum(start=[])|join(' ') }}"{% endif %} {% if line.tags %}TAGREFS="{% for type in page.line_types %}{% if type[0] in line.tags and line.tags["type[0]"] == type[1] %}LINE_TYPE_{{ loop.index }}{% endif %}{% endfor %}"{% endif %}>
{% if line.boundary %}
<Shape>
<Polygon POINTS="{{ line.boundary|sum(start=[])|join(' ') }}"/>
Expand Down Expand Up @@ -72,10 +72,10 @@
</Description>
<Tags>
{% for type, label in page.line_types %}
<OtherTag DESCRIPTION="line type" ID="TYPE_{{ loop.index }}" TYPE="{{ type }}" LABEL="{{ label }}"/>
<OtherTag DESCRIPTION="line type" ID="LINE_TYPE_{{ loop.index }}" TYPE="{{ type }}" LABEL="{{ label }}"/>
{% endfor %}
{% for label in page.region_types %}
<OtherTag DESCRIPTION="region type" ID="TYPE_{{ loop.index }}" TYPE="region" LABEL="{{ label }}"/>
<OtherTag DESCRIPTION="region type" ID="REGION_TYPE_{{ loop.index }}" TYPE="region" LABEL="{{ label }}"/>
{% endfor %}
</Tags>
{% if page.line_orders|length() > 0 %}
Expand Down Expand Up @@ -107,7 +107,7 @@
{% if loop.previtem and loop.previtem.type == 'line' %}
</TextBlock>
{% endif %}
<TextBlock ID="block_{{ entity.index }}" HPOS="{{ entity.bbox[0] }}" VPOS="{{ entity.bbox[1] }}" WIDTH="{{ entity.bbox[2] - entity.bbox[0] }}" HEIGHT="{{ entity.bbox[3] - entity.bbox[1] }}" {% for type in page.region_types %}{% if type == entity.region_type %}TAGREFS="TYPE_{{ loop.index }}"{% endif %}{% endfor %}>
<TextBlock ID="block_{{ entity.index }}" HPOS="{{ entity.bbox[0] }}" VPOS="{{ entity.bbox[1] }}" WIDTH="{{ entity.bbox[2] - entity.bbox[0] }}" HEIGHT="{{ entity.bbox[3] - entity.bbox[1] }}" {% for type in page.region_types %}{% if type == entity.region_type %}TAGREFS="REGION_TYPE_{{ loop.index }}"{% endif %}{% endfor %}>
<Shape>
<Polygon POINTS="{{ entity.boundary|sum(start=[])|join(' ') }}"/>
</Shape>
Expand Down

0 comments on commit 2ff2055

Please sign in to comment.