slightly more flexible detection of alphabetic numbering suffixes
This commit is contained in:
parent
6b3982ecf0
commit
7726af7dab
|
@ -606,10 +606,12 @@ 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 = nfc(entry.stem)[start_point:]
|
ending = nfc(entry.stem)[start_point:].strip(' -_()')
|
||||||
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
|
||||||
|
if index < 0 or index > 26:
|
||||||
|
return None
|
||||||
if (index,) in alphabetized:
|
if (index,) in alphabetized:
|
||||||
return None
|
return None
|
||||||
alphabetized[(index,)] = [entry]
|
alphabetized[(index,)] = [entry]
|
||||||
|
|
Loading…
Reference in a new issue