mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-08 17:24:20 +02:00
When generating template based filenames replace multiple spaces with a single space
This commit is contained in:
parent
314f8fefd4
commit
43b51ed334
1 changed files with 2 additions and 1 deletions
|
|
@ -99,7 +99,8 @@ def preprocess_template(template):
|
|||
|
||||
def safe_format(x, format_args):
|
||||
try:
|
||||
return x.format(**format_args).strip()
|
||||
ans = x.format(**format_args).strip()
|
||||
return re.sub(r'\s+', ' ', ans)
|
||||
except IndexError: # Thrown if user used [] and index is out of bounds
|
||||
pass
|
||||
except AttributeError: # Thrown if user used a non existing attribute
|
||||
|
|
|
|||
Loading…
Reference in a new issue