fix: rendering in typst
This commit is contained in:
+11
-7
@@ -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}");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user