Wrap type answer output in code tag; remove extra div

This would make more sense as a class on the outer div, but existing
templates reference code#typeans, so avoid breaking things for now.
This commit is contained in:
Damien Elmes 2022-07-22 20:29:39 +10:00
parent eceacb643b
commit 340da23104
3 changed files with 6 additions and 2 deletions

View file

@ -602,7 +602,7 @@ class Reviewer:
# can't pass a string in directly, and can't use re.escape as it # can't pass a string in directly, and can't use re.escape as it
# escapes too much # escapes too much
s = """ s = """
<span style="font-family: '{}'; font-size: {}px">{}</span>""".format( <div style="font-family: '{}'; font-size: {}px">{}</div>""".format(
self.typeFont, self.typeFont,
self.typeSize, self.typeSize,
output, output,

View file

@ -90,7 +90,7 @@ impl DiffContext {
let provided = render_tokens(&output.provided); let provided = render_tokens(&output.provided);
let expected = render_tokens(&output.expected); let expected = render_tokens(&output.expected);
format!( format!(
"<div style='white-space: pre-wrap;'>{}</div>", "<code id=typeans>{}</code>",
if no_mistakes(&output.expected) { if no_mistakes(&output.expected) {
provided provided
} else { } else {

View file

@ -52,6 +52,10 @@ li {
box-sizing: border-box; box-sizing: border-box;
} }
code#typeans {
white-space: pre-wrap;
}
.typeGood { .typeGood {
background: #afa; background: #afa;
color: black; color: black;