slightly more flexible detection of alphabetic numbering suffixes

main
xenofem 2024-03-11 12:19:56 -04:00
parent 6b3982ecf0
commit 7726af7dab
1 changed files with 3 additions and 1 deletions

View File

@ -606,10 +606,12 @@ def unique_hierarchical_prefix_numbering(entries, start_point=0):
def alphabetic_numbering(entries, start_point):
alphabetized = {}
for entry in entries:
ending = nfc(entry.stem)[start_point:]
ending = nfc(entry.stem)[start_point:].strip(' -_()')
if len(ending) > 1:
return None
index = 0 if ending == '' else ord(ending.lower()) - ord('a') + 1
if index < 0 or index > 26:
return None
if (index,) in alphabetized:
return None
alphabetized[(index,)] = [entry]