small fixes to alphabetic_numbering detection

This commit is contained in:
xenofem 2024-03-03 01:08:57 -05:00
parent 7535cb6162
commit 0d1bff74c2

View file

@ -582,7 +582,7 @@ def unique_hierarchical_prefix_numbering(entries, start_point=0):
def alphabetic_numbering(entries, start_point): def alphabetic_numbering(entries, start_point):
alphabetized = {} alphabetized = {}
for entry in entries: for entry in entries:
ending = entry.stem[start_point:] ending = nfc(entry.stem)[start_point:]
if len(ending) > 1: if len(ending) > 1:
return None return None
index = 0 if ending == '' else ord(ending.lower()) - ord('a') + 1 index = 0 if ending == '' else ord(ending.lower()) - ord('a') + 1
@ -591,8 +591,9 @@ def alphabetic_numbering(entries, start_point):
alphabetized[(index,)] = [entry] alphabetized[(index,)] = [entry]
indices = list(alphabetized.keys()) indices = list(alphabetized.keys())
indices.sort() indices.sort()
if indices != [(i,) for i in range(len(indices))]: for i in range(1, len(indices)):
return None if indices[i][0] - indices[i-1][0] != 1:
return None
return alphabetized return alphabetized
def check_extension(path, exts): def check_extension(path, exts):