diff --git a/dlibrary/dlibrary.py b/dlibrary/dlibrary.py index c246cc9..cf8b69b 100755 --- a/dlibrary/dlibrary.py +++ b/dlibrary/dlibrary.py @@ -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]