mirror of
https://github.com/qurator-spk/dinglehopper.git
synced 2025-06-09 11:50:00 +02:00
🐛 dinglehopper: Fix sorting the reading order
Regions were sorted wrongly when there are more than 9 regions in an OrderedGroup because the index was sorted alphabetically, not numerically. Fix this by converting the index to integers.
This commit is contained in:
parent
10f010eaa8
commit
534958be1d
1 changed files with 1 additions and 1 deletions
|
@ -64,7 +64,7 @@ def page_text(tree):
|
|||
for group in reading_order.iterfind('./*', namespaces=nsmap):
|
||||
if ET.QName(group.tag).localname == 'OrderedGroup':
|
||||
region_ref_indexeds = group.findall('./page:RegionRefIndexed', namespaces=nsmap)
|
||||
for region_ref_indexed in sorted(region_ref_indexeds, key=lambda r: r.attrib['index']):
|
||||
for region_ref_indexed in sorted(region_ref_indexeds, key=lambda r: int(r.attrib['index'])):
|
||||
region_id = region_ref_indexed.attrib['regionRef']
|
||||
region = tree.find('.//page:TextRegion[@id="%s"]' % region_id, namespaces=nsmap)
|
||||
if region is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue