mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
fix typing of cloze answer
This commit is contained in:
parent
53f6dacf62
commit
8ea44cb3bf
1 changed files with 5 additions and 9 deletions
|
@ -282,22 +282,18 @@ img { max-width: 95%; max-height: 95%; }
|
||||||
return buf
|
return buf
|
||||||
fld = m.group(1)
|
fld = m.group(1)
|
||||||
# if it's a cloze, extract data
|
# if it's a cloze, extract data
|
||||||
if fld.startswith("cq:"):
|
if fld.startswith("cloze:"):
|
||||||
# get field and cloze position
|
# get field and cloze position
|
||||||
m = re.match("cq:(\d+):(.+)", fld)
|
clozeIdx = self.card.ord + 1
|
||||||
if not m:
|
fld = fld.split(":")[1]
|
||||||
return re.sub(
|
|
||||||
self.typeAnsPat, _("Type answer: invalid cloze pattern"),
|
|
||||||
buf)
|
|
||||||
clozeIdx = m.group(1)
|
|
||||||
fld = m.group(2)
|
|
||||||
# loop through fields for a match
|
# loop through fields for a match
|
||||||
for f in self.card.model()['flds']:
|
for f in self.card.model()['flds']:
|
||||||
if f['name'] == fld:
|
if f['name'] == fld:
|
||||||
self.typeCorrect = self.card.note()[f['name']]
|
self.typeCorrect = self.card.note()[f['name']]
|
||||||
if clozeIdx:
|
if clozeIdx:
|
||||||
# narrow to cloze
|
# narrow to cloze
|
||||||
self.typeCorrect = self._contentForCloze(self.typeCorrect, clozeIdx)
|
self.typeCorrect = self._contentForCloze(
|
||||||
|
self.typeCorrect, clozeIdx)
|
||||||
self.typeFont = f['font']
|
self.typeFont = f['font']
|
||||||
self.typeSize = f['size']
|
self.typeSize = f['size']
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in a new issue