Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions bidi.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def determine_paragraph_embedding_level(chars: list[CharacterInfo], verbose: boo
first_strong_char = None # the character found by P2, if any

for ci in chars:
char_type = ci.character_type
char_type = ci.original_type
if char_type in ISOLATE_INITIATOR_TYPES:
open_isolate_count += 1
elif char_type == 'PDI':
Expand All @@ -145,7 +145,7 @@ def determine_paragraph_embedding_level(chars: list[CharacterInfo], verbose: boo
print(f"--- Rule P2 --- first strong character outside isolates: "
f"index {first_strong_char.index} "
f"(U+{ord(first_strong_char.character):04X} {shown_char}, "
f"type {first_strong_char.character_type}) "
f"type {first_strong_char.original_type}) "
f"-> level {paragraph_level}")
else:
print(f"--- Rule P3 --- no strong character outside isolates "
Expand Down Expand Up @@ -188,10 +188,11 @@ def _resolve_fsi_direction(chars: list[CharacterInfo], fsi_index: int) -> str:
if depth == 0:
break
elif depth == 1:
if t in ('R', 'AL'):
return 'RLI'
elif t == 'L':
return 'LRI'
if t in STRONG_TYPES:
if t == 'L':
return 'LRI'
else: # R or AL
return 'RLI'
return 'LRI' # default


Expand Down
Loading