forked from EduCraft/curriculum-project-hub
d76f9f9a54
Replace generated-driver compilation with the template model.
cph-typst:
- driver.rs DELETED (generate_driver, static-include driver, numbering-threading).
- New manifest.rs: build_augmented_manifest(&Lesson) emits a TOML doc with [info]
+ ordered [[parts]] each carrying a `fields` array = the kind's content fields
whose <root>/<path>/<field>.typ exists on disk. Reuses cph-schema's
content_field_names (new dep; no cycle). This closes the OPEN point WU-C'
surfaced: typst has no file-exists primitive, so the engine (which has disk
access) tells the template which optional content (lemma proof) is present.
- World main = the real engineering-file template (<root>/<template>); the
augmented manifest is served as an in-memory virtual file at /.cph/manifest.toml
(never written to the tree), injected via sys.inputs.manifest. render_dir kept
only for @local/cph-render + vendored @preview/numbly resolution.
- Artifact handling: SingleFile+TypstCompile compiles; FileTree, shell-only, and
undeclared-target are blocking "deferred/not-declared" diagnostics (ADR-0011).
- Engine public signatures unchanged; LessonWorld::new takes template+manifest_src.
cph-check: no source change needed (only uses lesson.targets/target.name +
unchanged Engine methods); pipeline + Legal alignment intact.
Fixtures: mini gets exports/{student,teacher}.typ (from render/templates/) + v2
manifest + a second proof-less lemma to exercise optional content. render-stub
retired (tests use the real render/). Through-template PDFs offline: student 44KB,
teacher 56KB; proof-less lemma compiles clean (optional-content confirmed).
Workspace: fmt + clippy -D warnings + all tests green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
39 lines
911 B
TOML
39 lines
911 B
TOML
[project]
|
|
id = "mini"
|
|
name = "迷你课时"
|
|
|
|
[info]
|
|
title = "迷你示例课时"
|
|
author = "测试作者"
|
|
|
|
[[parts]]
|
|
kind = "segment"
|
|
path = "segments/开场对照导言"
|
|
|
|
[[parts]]
|
|
kind = "lemma"
|
|
path = "lemmas/量纲分析估计"
|
|
|
|
[[parts]]
|
|
kind = "lemma"
|
|
path = "lemmas/无证明引理"
|
|
|
|
[[parts]]
|
|
kind = "example"
|
|
path = "examples/自由落体"
|
|
|
|
# v2 target shape (ADR-0011): a typed artifact + an ordered list of typed steps.
|
|
# Each target's single `typst-compile` step names the template file to compile
|
|
# as main; the framework injects the augmented manifest into it.
|
|
[targets.student]
|
|
artifact = { type = "single-file", filepath = "build/student.pdf" }
|
|
[[targets.student.steps]]
|
|
type = "typst-compile"
|
|
template = "exports/student.typ"
|
|
|
|
[targets.teacher]
|
|
artifact = { type = "single-file", filepath = "build/teacher.pdf" }
|
|
[[targets.teacher.steps]]
|
|
type = "typst-compile"
|
|
template = "exports/teacher.typ"
|