From 0d1bff74c21b9f0b45985c3e0927f4b521554819 Mon Sep 17 00:00:00 2001 From: xenofem Date: Sun, 3 Mar 2024 01:08:57 -0500 Subject: [PATCH] small fixes to alphabetic_numbering detection --- dlibrary/dlibrary.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dlibrary/dlibrary.py b/dlibrary/dlibrary.py index 864d6b6..a862737 100755 --- a/dlibrary/dlibrary.py +++ b/dlibrary/dlibrary.py @@ -582,7 +582,7 @@ def unique_hierarchical_prefix_numbering(entries, start_point=0): def alphabetic_numbering(entries, start_point): alphabetized = {} for entry in entries: - ending = entry.stem[start_point:] + ending = nfc(entry.stem)[start_point:] if len(ending) > 1: return None index = 0 if ending == '' else ord(ending.lower()) - ord('a') + 1 @@ -591,8 +591,9 @@ def alphabetic_numbering(entries, start_point): alphabetized[(index,)] = [entry] indices = list(alphabetized.keys()) indices.sort() - if indices != [(i,) for i in range(len(indices))]: - return None + for i in range(1, len(indices)): + if indices[i][0] - indices[i-1][0] != 1: + return None return alphabetized def check_extension(path, exts):