allow empty suffixes

This commit is contained in:
un-pogaz 2025-07-09 19:49:44 +02:00
parent 3bc9f1c4f4
commit 86e4a79f32

View File

@ -3512,10 +3512,12 @@ This can be useful to truncate a value.
def repl(mo): def repl(mo):
fmt_char = mo.group(1) fmt_char = mo.group(1)
suffixes = re.split(r'\|', mo.group(3) or '') suffixes = mo.group(3)
match len(suffixes): if suffixes is None:
case 1 if not suffixes[0]:
zero_suffix = one_suffix = more_suffix = fmt_char.lower() + ' ' zero_suffix = one_suffix = more_suffix = fmt_char.lower() + ' '
else:
suffixes = re.split(r'\|', suffixes)
match len(suffixes):
case 1: case 1:
zero_suffix = one_suffix = more_suffix = suffixes[0] zero_suffix = one_suffix = more_suffix = suffixes[0]
case 2: case 2: