mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-26 22:14:07 +01:00
Force use of non-unicode constants in compiled templates. Fixes a problem with regular expression character classes and probably other things.
This commit is contained in:
parent
06ae93270f
commit
3c04f699c3
1 changed files with 2 additions and 2 deletions
|
|
@ -294,11 +294,11 @@ def expr(self, level):
|
|||
self.parent_book, self.parent_locals, *args)
|
||||
elif self.token_is_constant():
|
||||
# String or number
|
||||
v = self.token()
|
||||
v = unicode(self.token())
|
||||
if self.compile_text:
|
||||
tv = v.replace("\\", "\\\\")
|
||||
tv = tv.replace("'", "\\'")
|
||||
self.compile_text += "\targs[%d].append('%s')\n"%(level, tv)
|
||||
self.compile_text += "\targs[%d].append(unicode('%s'))\n"%(level, tv)
|
||||
return v
|
||||
else:
|
||||
self.error(_('expression is not function or constant'))
|
||||
|
|
|
|||
Loading…
Reference in a new issue