mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Add edge-case to type-in-answer filter in reviewer (#3010)
This commit is contained in:
parent
b80057440e
commit
df70564079
1 changed files with 4 additions and 0 deletions
|
@ -721,6 +721,7 @@ class Reviewer:
|
|||
def typeAnsAnswerFilter(self, buf: str) -> str:
|
||||
if not self.typeCorrect:
|
||||
return re.sub(self.typeAnsPat, "", buf)
|
||||
orig = buf
|
||||
origSize = len(buf)
|
||||
buf = buf.replace("<hr id=answer>", "")
|
||||
hadHR = len(buf) != origSize
|
||||
|
@ -744,6 +745,9 @@ class Reviewer:
|
|||
s = f"<hr id=answer>{s}"
|
||||
return s
|
||||
|
||||
if hadHR and not re.search(self.typeAnsPat, buf):
|
||||
return orig
|
||||
|
||||
return re.sub(self.typeAnsPat, repl, buf)
|
||||
|
||||
def _contentForCloze(self, txt: str, idx: int) -> str | None:
|
||||
|
|
Loading…
Reference in a new issue