Update _hocr.py

This commit is contained in:
BBC-Esq
2025-03-08 07:37:37 -05:00
committed by GitHub
parent 7b2dd892e5
commit 0970cebfea
+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'