Merge pull request #1493 from BBC-Esq/main

fix ._hocr
This commit is contained in:
jbarlow
2025-04-06 04:11:31 -04:00
committed by GitHub
+5 -1
View File
@@ -263,9 +263,13 @@ class HocrTransform:
def _get_text_direction(self, par):
"""Get the text direction of the paragraph.
Arabic, Hebrew, Persian, are right-to-left languages.
When the paragraph element is None, defaults to left-to-right.
"""
if par is None:
return TextDirection.LTR
return (
TextDirection.RTL
if par.attrib.get('dir', 'ltr') == 'rtl'