fix detection of media refs in cloze

https://anki.tenderapp.com/discussions/beta-testing/796-another-check-media-issue
This commit is contained in:
Damien Elmes 2017-10-18 21:56:57 +10:00
parent a6391bbe8c
commit e3885fd924

View file

@ -189,15 +189,15 @@ create table meta (dirMod int, lastUsn int); insert into meta values (0, 0);
strings = []
from anki.template.template import clozeReg
def qrepl(m):
if m.group(3):
return "[%s]" % m.group(3)
if m.group(4):
return "[%s]" % m.group(4)
else:
return "[...]"
def arepl(m):
return m.group(1)
return m.group(2)
for ord in ords:
s = re.sub(clozeReg%ord, qrepl, string)
s = re.sub(clozeReg%".+?", "\\2", s)
s = re.sub(clozeReg%".+?", "\\4", s)
strings.append(s)
strings.append(re.sub(clozeReg%".+?", arepl, string))
return strings