fix multiple cloze tags contained on one line

inner regex was capturing multiple clozes. fixes
https://anki.tenderapp.com/discussions/ankidesktop/6599-empty-cards-3533-cards-to-delete
This commit is contained in:
Damien Elmes 2014-04-16 01:15:59 +09:00
parent 966aca0f20
commit 694682d964

View file

@ -569,7 +569,7 @@ select id from notes where mid = ?)""" % " ".join(map),
sflds = splitFields(flds) sflds = splitFields(flds)
map = self.fieldMap(m) map = self.fieldMap(m)
ords = set() ords = set()
matches = re.findall("{{[^}]*?cloze:(?:.*?:)*(.+?)}}", m['tmpls'][0]['qfmt']) matches = re.findall("{{[^}]*?cloze:(?:[^}]?:)*(.+?)}}", m['tmpls'][0]['qfmt'])
matches += re.findall("<%cloze:(.+?)%>", m['tmpls'][0]['qfmt']) matches += re.findall("<%cloze:(.+?)%>", m['tmpls'][0]['qfmt'])
for fname in matches: for fname in matches:
if fname not in map: if fname not in map: