forked from EduCraft/curriculum-project-hub
feat(cph): add outline export command
This commit is contained in:
@@ -130,6 +130,39 @@ pub fn check(root: &Path, engine: &Engine) -> CheckReport {
|
||||
}
|
||||
}
|
||||
|
||||
/// Load and validate the lesson, then project it into an outline.
|
||||
///
|
||||
/// Outline output is derived from the manifest and part metadata, not from the
|
||||
/// rendered lesson body. It therefore runs the same load → structural → schema
|
||||
/// gates as other non-typst builds, but intentionally does not compile any
|
||||
/// target. An invalid lesson is never written in any outline format.
|
||||
pub fn outline(root: &Path) -> (Option<cph_model::OutlineDocument>, CheckReport) {
|
||||
let mut diags = Vec::new();
|
||||
let (lesson, load_diags) = cph_model::load(root);
|
||||
diags.extend(load_diags);
|
||||
|
||||
let Some(lesson) = lesson else {
|
||||
return (
|
||||
None,
|
||||
CheckReport {
|
||||
diagnostics: dedup(diags),
|
||||
lesson_loaded: false,
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
run_structural_and_schema(&lesson, cph_schema::known_kinds(), &mut diags);
|
||||
let report = CheckReport {
|
||||
diagnostics: dedup(diags),
|
||||
lesson_loaded: true,
|
||||
};
|
||||
if report.has_errors() {
|
||||
(None, report)
|
||||
} else {
|
||||
(Some(lesson.outline_document()), report)
|
||||
}
|
||||
}
|
||||
|
||||
/// Build a PDF for `target`.
|
||||
///
|
||||
/// Runs the check phases **(a)–(c)** (load → structural → schema). If those
|
||||
|
||||
Reference in New Issue
Block a user