mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Only detect the template type keyword on the first line.
Remove an extra space from the default formatter exception message.
This commit is contained in:
parent
f1f8c32975
commit
294a28433c
@ -216,7 +216,14 @@ class TemplateHighlighter(QSyntaxHighlighter):
|
||||
pp = self.find_paren(bn, i)
|
||||
if pp and pp.highlight:
|
||||
self.setFormat(i, length, self.Formats[format_])
|
||||
elif format_ == 'keyword':
|
||||
if bn > 0 and i == 0:
|
||||
if text[i:i+length] == ('python:' if self.for_python else 'program:'):
|
||||
continue
|
||||
print('bn', bn, format_, text[i:i+length])
|
||||
self.setFormat(i, length, self.Formats[format_])
|
||||
else:
|
||||
print('bn', bn, format_, text[i:i+length])
|
||||
self.setFormat(i, length, self.Formats[format_])
|
||||
|
||||
self.setCurrentBlockState(NORMAL)
|
||||
|
@ -1591,7 +1591,7 @@ class TemplateFormatter(string.Formatter):
|
||||
raise(ValueError(
|
||||
_('Syntax error on line {0} column {1}: text {2}').format(e.lineno, e.offset, e.text)))
|
||||
except KeyError:
|
||||
raise(ValueError(_("Error: the {0} function is not defined in the template").format('evaluate')))
|
||||
raise(ValueError(_("The {0} function is not defined in the template").format('evaluate')))
|
||||
|
||||
# ################# Override parent classes methods #####################
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user