fix: rendering in typst
Pipeline / check (pull_request) Successful in 3m8s
Pipeline / docs (pull_request) Skipped
Pipeline / nightly (pull_request) Skipped
Pipeline / release (pull_request) Skipped

This commit is contained in:
2026-09-22 00:19:40 -04:00
parent 003340dc6f
commit cfe8a3216c
8 changed files with 414 additions and 81 deletions
+11 -7
View File
@@ -259,11 +259,10 @@ pub fn render(catalog: &Catalog, record: &AssessmentFile, opts: &Options) -> Res
/// The Quarto YAML front matter.
fn front_matter(course: &CourseFile, record: &AssessmentFile, variant: Variant) -> String {
let title = if matches!(variant, Variant::Solutions) {
format!("{}: {}", record.assessment.title, variant.title_word())
} else {
record.assessment.title.clone()
};
// Both documents name themselves. Two PDFs called "Homework 1" are
// indistinguishable in a downloads folder, which is how a solutions copy
// gets posted in place of the worksheet.
let title = format!("{}: {}", record.assessment.title, variant.title_word());
let subtitle = format!("{} · {}", course.course.code, course.course.title);
let mut out = String::from("---\n");
out.push_str(&format!("title: \"{}\"\n", yaml_quote(&title)));
@@ -663,13 +662,18 @@ items:
&Options::default().form,
)
.expect("renders");
assert!(ws.contains("title: \"Homework 1: Questions\""));
assert!(ws.contains("title: \"Homework 1: Questions\""), "{ws}");
let sol = solutions(
&catalog("front-matter-sol"),
&record(),
&Options::default().form,
)
.expect("renders");
assert!(sol.contains("title: \"Homework 1: Solutions\""));
assert!(sol.contains("title: \"Homework 1: Solutions\""), "{sol}");
// Neither document may title itself with the bare assessment name: two
// PDFs called "Homework 1" are indistinguishable once downloaded, and
// the pair that gets confused is the one with the answers in it.
assert!(!ws.contains("title: \"Homework 1\""), "{ws}");
assert!(!sol.contains("title: \"Homework 1\""), "{sol}");
}
}