mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
cloze generation needs to use provided fields, not field 0
This commit is contained in:
parent
014dc3d987
commit
9fab2834da
1 changed files with 10 additions and 3 deletions
|
@ -509,9 +509,16 @@ select id from notes where mid = ?)""" % " ".join(map),
|
|||
return avail
|
||||
|
||||
def _availClozeOrds(self, m, flds):
|
||||
ret = [int(m)-1 for m in re.findall(
|
||||
"{{c(\d+)::[^}]*?}}", splitFields(flds)[0])]
|
||||
return list(set(ret))
|
||||
sflds = splitFields(flds)
|
||||
map = self.fieldMap(m)
|
||||
ords = set()
|
||||
for fname in re.findall("{{cloze:(.+?)}}", m['tmpls'][0]['qfmt']):
|
||||
if fname not in map:
|
||||
continue
|
||||
ord = map[fname][0]
|
||||
ords.update([int(m)-1 for m in re.findall(
|
||||
"{{c(\d+)::[^}]*?}}", sflds[ord])])
|
||||
return list(ords)
|
||||
|
||||
# Sync handling
|
||||
##########################################################################
|
||||
|
|
Loading…
Reference in a new issue