This commit is contained in:
Kovid Goyal 2022-10-13 18:11:20 +05:30
parent 3bb39cb88d
commit 8d42c86479
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 2 additions and 1 deletions

View File

@ -854,6 +854,7 @@ def evaluate(book, ctx):
return ','.join(list(ctx.helper_function(tags)))
'''
from calibre.utils.formatter import PythonTemplateContext
class CustomContext(PythonTemplateContext):
def helper_function(self, arg):
s = set(arg)

View File

@ -208,7 +208,7 @@ class TemplateHighlighter(QSyntaxHighlighter):
# we avoid thinking a # inside a string starts a comment.
t = re.sub(self.stringRe, self.replace_strings_with_dash, text)
sharp_pos = t.find('#')
if sharp_pos >= 0: # Do we still have a #?
if sharp_pos >= 0: # Do we still have a #?
self.setFormat(sharp_pos, len(text), self.Formats["comment"])
self.setCurrentBlockState(NORMAL)