handle edge case of prefix detection
This commit is contained in:
parent
d0cd88c289
commit
ae56fe5175
|
@ -816,7 +816,10 @@ def unique_hierarchical_prefix_numbering(entries, start_point=0):
|
||||||
ents_idx = numbering.pop(idx)
|
ents_idx = numbering.pop(idx)
|
||||||
debug(f'Index {idx} has multiple entries')
|
debug(f'Index {idx} has multiple entries')
|
||||||
longest = max(ents_idx, key=lambda e: len(nname(e)))
|
longest = max(ents_idx, key=lambda e: len(nname(e)))
|
||||||
next_layer_start = pos + NUMBER_REGEX.match(nname(longest)[pos:]).end()
|
next_match = NUMBER_REGEX.match(nname(longest)[pos:])
|
||||||
|
if not next_match:
|
||||||
|
return None
|
||||||
|
next_layer_start = pos + next_match.end()
|
||||||
sub_numbering = unique_hierarchical_prefix_numbering(ents_idx, start_point=next_layer_start) or alphabetic_numbering(ents_idx, next_layer_start)
|
sub_numbering = unique_hierarchical_prefix_numbering(ents_idx, start_point=next_layer_start) or alphabetic_numbering(ents_idx, next_layer_start)
|
||||||
if not sub_numbering:
|
if not sub_numbering:
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in a new issue