mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix use of {formats} in save to disk templates. Fix some formatter functions causing plugboards to not validate.
This commit is contained in:
commit
b2e79fe47b
@ -20,6 +20,7 @@ from calibre.ebooks.metadata import title_sort
|
||||
from calibre.utils.date import parse_date, as_local_time
|
||||
from calibre import strftime, prints, sanitize_file_name_unicode
|
||||
from calibre.ptempfile import SpooledTemporaryFile
|
||||
from calibre.db.lazy import FormatsList
|
||||
|
||||
plugboard_any_device_value = 'any device'
|
||||
plugboard_any_format_value = 'any format'
|
||||
@ -159,7 +160,7 @@ class Formatter(TemplateFormatter):
|
||||
return self.composite_values[key]
|
||||
if key in kwargs:
|
||||
val = kwargs[key]
|
||||
if isinstance(val, list):
|
||||
if isinstance(val, list) or isinstance(val, FormatsList):
|
||||
val = ','.join(val)
|
||||
return val.replace('/', '_').replace('\\', '_')
|
||||
return ''
|
||||
|
@ -526,6 +526,8 @@ class ValidateFormatter(TemplateFormatter):
|
||||
return self._validation_string
|
||||
|
||||
def validate(self, x):
|
||||
from calibre.ebooks.metadata.book.base import Metadata
|
||||
self.book = Metadata('');
|
||||
return self.vformat(x, [], {})
|
||||
|
||||
validation_formatter = ValidateFormatter()
|
||||
|
Loading…
x
Reference in New Issue
Block a user