mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Strip spaces off of function names before looking them up. They shouldn't ever be significant.
This commit is contained in:
parent
a761e5a9d6
commit
e336d8a2b9
@ -137,6 +137,7 @@ class _Parser(object):
|
|||||||
# We have a function.
|
# We have a function.
|
||||||
# Check if it is a known one. We do this here so error reporting is
|
# Check if it is a known one. We do this here so error reporting is
|
||||||
# better, as it can identify the tokens near the problem.
|
# better, as it can identify the tokens near the problem.
|
||||||
|
id = id.strip()
|
||||||
if id not in funcs:
|
if id not in funcs:
|
||||||
self.error(_('unknown function {0}').format(id))
|
self.error(_('unknown function {0}').format(id))
|
||||||
|
|
||||||
@ -246,6 +247,7 @@ class _CompileParser(_Parser):
|
|||||||
# We have a function.
|
# We have a function.
|
||||||
# Check if it is a known one. We do this here so error reporting is
|
# Check if it is a known one. We do this here so error reporting is
|
||||||
# better, as it can identify the tokens near the problem.
|
# better, as it can identify the tokens near the problem.
|
||||||
|
id = id.strip()
|
||||||
if id not in funcs:
|
if id not in funcs:
|
||||||
self.error(_('unknown function {0}').format(id))
|
self.error(_('unknown function {0}').format(id))
|
||||||
|
|
||||||
@ -457,7 +459,7 @@ class TemplateFormatter(string.Formatter):
|
|||||||
colon += 1
|
colon += 1
|
||||||
|
|
||||||
funcs = formatter_functions().get_functions()
|
funcs = formatter_functions().get_functions()
|
||||||
fname = fmt[colon:p]
|
fname = fmt[colon:p].strip()
|
||||||
if fname in funcs:
|
if fname in funcs:
|
||||||
func = funcs[fname]
|
func = funcs[fname]
|
||||||
if func.arg_count == 2:
|
if func.arg_count == 2:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user