mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
commit
4259d185e7
@ -274,9 +274,9 @@ class TemplateFormatter(string.Formatter):
|
|||||||
colon += 1
|
colon += 1
|
||||||
|
|
||||||
funcs = formatter_functions.get_functions()
|
funcs = formatter_functions.get_functions()
|
||||||
if fmt[colon:p] in funcs:
|
fname = fmt[colon:p]
|
||||||
field = fmt[colon:p]
|
if fname in funcs:
|
||||||
func = funcs[field]
|
func = funcs[fname]
|
||||||
if func.arg_count == 2:
|
if func.arg_count == 2:
|
||||||
# only one arg expected. Don't bother to scan. Avoids need
|
# only one arg expected. Don't bother to scan. Avoids need
|
||||||
# for escaping characters
|
# for escaping characters
|
||||||
@ -292,6 +292,8 @@ class TemplateFormatter(string.Formatter):
|
|||||||
else:
|
else:
|
||||||
val = func.eval_(self, self.kwargs, self.book, self.locals,
|
val = func.eval_(self, self.kwargs, self.book, self.locals,
|
||||||
val, *args).strip()
|
val, *args).strip()
|
||||||
|
else:
|
||||||
|
return _('%s: unknown function')%fname
|
||||||
if val:
|
if val:
|
||||||
val = self._do_format(val, dispfmt)
|
val = self._do_format(val, dispfmt)
|
||||||
if not val:
|
if not val:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user