mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
fix broken cloze deletion
This commit is contained in:
parent
ce803b9f44
commit
67728e73d7
3 changed files with 2 additions and 3 deletions
|
@ -197,7 +197,7 @@ create table meta (dirMod int, lastUsn int); insert into meta values (0, 0);
|
||||||
return m.group(1)
|
return m.group(1)
|
||||||
for ord in ords:
|
for ord in ords:
|
||||||
s = re.sub(clozeReg%ord, qrepl, string)
|
s = re.sub(clozeReg%ord, qrepl, string)
|
||||||
s = re.sub(clozeReg%".+?", "\\1", s)
|
s = re.sub(clozeReg%".+?", "\\2", s)
|
||||||
strings.append(s)
|
strings.append(s)
|
||||||
strings.append(re.sub(clozeReg%".+?", arepl, string))
|
strings.append(re.sub(clozeReg%".+?", arepl, string))
|
||||||
return strings
|
return strings
|
||||||
|
|
|
@ -203,7 +203,7 @@ class Template:
|
||||||
return buf
|
return buf
|
||||||
txt = re.sub(reg%ord, repl, txt)
|
txt = re.sub(reg%ord, repl, txt)
|
||||||
# and display other clozes normally
|
# and display other clozes normally
|
||||||
return re.sub(reg%"\d+", "\\1", txt)
|
return re.sub(reg%"\d+", "\\2", txt)
|
||||||
|
|
||||||
# look for clozes wrapped in mathjax, and change {{cx to {{Cx
|
# look for clozes wrapped in mathjax, and change {{cx to {{Cx
|
||||||
def _removeFormattingFromMathjax(self, txt, ord):
|
def _removeFormattingFromMathjax(self, txt, ord):
|
||||||
|
|
|
@ -17,7 +17,6 @@ def test_flags():
|
||||||
# set flag 2
|
# set flag 2
|
||||||
col.setUserFlag(2, [c.id])
|
col.setUserFlag(2, [c.id])
|
||||||
c.load()
|
c.load()
|
||||||
print("db is", col.db.all("select id, flags from cards"))
|
|
||||||
assert c.userFlag() == 2
|
assert c.userFlag() == 2
|
||||||
assert c.flags & origBits == origBits
|
assert c.flags & origBits == origBits
|
||||||
assert len(col.findCards("flag:0")) == 0
|
assert len(col.findCards("flag:0")) == 0
|
||||||
|
|
Loading…
Reference in a new issue