mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
don't allow {{c0::
This commit is contained in:
parent
c1ea82273b
commit
aedf88ee6d
2 changed files with 6 additions and 0 deletions
|
@ -533,6 +533,8 @@ select id from notes where mid = ?)""" % " ".join(map),
|
|||
ord = map[fname][0]
|
||||
ords.update([int(m)-1 for m in re.findall(
|
||||
"{{c(\d+)::[^}]*?}}", sflds[ord])])
|
||||
if -1 in ords:
|
||||
ords.remove(-1)
|
||||
return list(ords)
|
||||
|
||||
# Sync handling
|
||||
|
|
|
@ -157,6 +157,10 @@ def test_cloze():
|
|||
f['Text'] = "{{c2::hello}} {{c1::foo}}"
|
||||
f.flush()
|
||||
assert d.cardCount() == cnt + 1
|
||||
# 0 or negative indices are not supported
|
||||
f['Text'] += "{{c0::zero}} {{c-1:foo}}"
|
||||
f.flush()
|
||||
assert len(f.cards()) == 2
|
||||
|
||||
def test_modelChange():
|
||||
deck = getEmptyDeck()
|
||||
|
|
Loading…
Reference in a new issue