From ca2f9acce25b2326127eb4dc76fe1a317984dc14 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 25 Sep 2012 14:49:51 +0900 Subject: [PATCH] fix error in type answer when field has \g etc --- aqt/reviewer.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/aqt/reviewer.py b/aqt/reviewer.py index ae0a02344..91c4de7a4 100644 --- a/aqt/reviewer.py +++ b/aqt/reviewer.py @@ -386,9 +386,13 @@ Please run Tools>Maintenance>Empty Cards""") res += u"
{0}
{1}
".format( _(u"Correct answer was:"), cor) # and update the type answer area - return re.sub(self.typeAnsPat, """ -%s""" % - (self.typeFont, self.typeSize, res), buf) + def repl(match): + # can't pass a string in directly, and can't use re.escape as it + # escapes too much + return """ +%s""" % ( + self.typeFont, self.typeSize, res) + return re.sub(self.typeAnsPat, repl, buf) def _contentForCloze(self, txt, idx): matches = re.findall("\{\{c%s::(.+?)\}\}"%idx, txt)