From ddcf83bc7f508a5688e0407453675bf1e90d1e87 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 29 Apr 2011 11:43:06 +0900 Subject: [PATCH] add [] to cloze --- anki/template/template.py | 4 ++-- tests/test_models.py | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/anki/template/template.py b/anki/template/template.py index 7dc157dd9..bc433e1d6 100644 --- a/anki/template/template.py +++ b/anki/template/template.py @@ -177,9 +177,9 @@ class Template(object): # replace chosen cloze with type if type == "q": if m.group(2): - txt = re.sub(reg%ord, "...(\\3)", txt) + txt = re.sub(reg%ord, "[...(\\3)]", txt) else: - txt = re.sub(reg%ord, "...", txt) + txt = re.sub(reg%ord, "[...]", txt) elif type == "actx": txt = re.sub(reg%ord, "\\1", txt) else: diff --git a/tests/test_models.py b/tests/test_models.py index 44ef26de5..3a642c052 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -119,7 +119,7 @@ def test_cloze(): # try with one cloze f['Text'] = "hello {{c1::world}}" assert d.addFact(f) == 1 - assert "hello ..." in f.cards()[0].q() + assert "hello [...]" in f.cards()[0].q() # the default is no context assert "world" in f.cards()[0].a() assert "hello world" not in f.cards()[0].a() @@ -130,16 +130,16 @@ def test_cloze(): f = d.newFact() f['Text'] = "hello {{c1::world::typical}}" assert d.addFact(f) == 1 - assert "...(typical)" in f.cards()[0].q() + assert "[...(typical)]" in f.cards()[0].q() assert "world" in f.cards()[0].a() # and with 2 clozes f = d.newFact() f['Text'] = "hello {{c1::world}} {{c2::bar}}" assert d.addFact(f) == 2 (c1, c2) = f.cards() - assert "... bar" in c1.q() + assert "[...] bar" in c1.q() assert "world bar" in c1.a() - assert "world ..." in c2.q() + assert "world [...]" in c2.q() assert "world bar" in c2.a() # if there are multiple answers for a single cloze, they are given in a # list