mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Wrap expected text in code block when no answer provided
This commit is contained in:
parent
de86d6b40f
commit
2c952cf3af
2 changed files with 4 additions and 7 deletions
|
@ -607,14 +607,9 @@ class Reviewer:
|
|||
origSize = len(buf)
|
||||
buf = buf.replace("<hr id=answer>", "")
|
||||
hadHR = len(buf) != origSize
|
||||
# munge correct value
|
||||
expected = self.typeCorrect
|
||||
provided = self.typedAnswer
|
||||
if not provided:
|
||||
output = expected
|
||||
else:
|
||||
# compare with typed answer
|
||||
output = self.mw.col.compare_answer(expected, provided)
|
||||
output = self.mw.col.compare_answer(expected, provided)
|
||||
# and update the type answer area
|
||||
def repl(match: Match) -> str:
|
||||
# can't pass a string in directly, and can't use re.escape as it
|
||||
|
|
|
@ -90,7 +90,9 @@ impl DiffContext {
|
|||
let expected = render_tokens(&output.expected);
|
||||
format!(
|
||||
"<code id=typeans>{}</code>",
|
||||
if no_mistakes(&output.expected) {
|
||||
if self.provided.is_empty() {
|
||||
self.expected.iter().collect()
|
||||
} else if no_mistakes(&output.expected) {
|
||||
provided
|
||||
} else {
|
||||
format!("{provided}<br><span id=typearrow>↓</span><br>{expected}")
|
||||
|
|
Loading…
Reference in a new issue