feat(cph): implement nested outline manifest and batch/combined export

ADR-0029 — nested outline manifest, supersedes ADR-0008's flat [[parts]]:
- cph-model: recursive loader over manifest.toml containers / element.toml
  leaves; Lesson.parts (pure elements, DFS order) + Lesson.outline (elements
  interleaved with section headings at their DFS-open position); rejects
  ambiguous/incomplete folders and root-vs-container table misplacement
- cph-diag: new DiagCode::ManifestMalformed for carrier-document structure
  errors (discharges an existing TODO)
- cph-typst: augmented manifest now serializes the outline (element/section
  entries) instead of a flat parts array
- render/lib.typ: render-lesson renders section headings at their depth
- examples/TH-141 migrated to 5 nested section containers + 3 root segments,
  byte-identical element order; smoke-verified via cph check/build + pdftotext

ADR-0030 — batch & combined export, extends ADR-0009/0011:
- cph build with no --target batches every declared target (repeatable
  --target for an explicit subset); any target failure => non-zero exit,
  per-target ledger, independent per-target execution
- cph-model: bundle.toml loader (directory + [info]/[targets.*]/ordered
  lessons with per-lesson target overrides)
- cph-typst: augmented bundle manifest (path-prefixed member outlines),
  Engine::{compile_check_bundle,build_bundle_pdf}
- render/lib.typ: render-bundle assembles member lessons under per-lesson
  headings, depth-shifts their own section headings, resets example/lemma
  counters at each lesson boundary by default
- cph-cli: `cph bundle <path> --target <name>` subcommand, same batching
  contract as `cph build`
- new bundle fixtures/tests (cph-model unit + cph-typst through-template PDF
  compile), smoke-verified via a real 2-lesson merged PDF

Verification: cargo fmt/clippy/test clean across the workspace (68 tests);
real cph check/build/bundle runs against TH-141 and a bundle fixture, PDF
content inspected via pdftotext.
This commit is contained in:
2026-08-04 20:31:05 +08:00
committed by 洪佳荣
parent e0bd6120ec
commit 9927d38c18
165 changed files with 2638 additions and 691 deletions
@@ -0,0 +1 @@
kind = "segment"
@@ -0,0 +1,5 @@
GirifalcoGood 公式 @GG公式 建立在纯色散力假设上,对水这类强极性或氢键液体已不够精确。Fowkes 给出的修正路径是把表面能 $gamma$ 拆为色散分量 $gamma^d$ 与极性分量 $gamma^p$,分别做几何平均:
$ W_(S L) = 2 sqrt(gamma_(S G)^d thin gamma_(L G)^d) + 2 sqrt(gamma_(S G)^p thin gamma_(L G)^p) . $
工程实际计算中水、聚合物等强极性体系的接触角分析走的就是这条路。本节只列出公式作为知识地图的一站,不要求会用。
@@ -0,0 +1 @@
kind = "segment"
@@ -0,0 +1,3 @@
= 三相接触:Young 方程与浸润
把三种界面能 $gamma_(L G)$$gamma_(S G)$$gamma_(S L)$ 放在固体表面上一滴液体的三相接触线处,用能量极小化条件可得到接触角 $theta$ 的表达式,即 Young 方程。把 Berthelot 估计 @GG公式 代回 Young 方程,$theta$ 进一步退化为只依赖比值 $gamma_(S G) \/ gamma_(L G)$ 的形式,由此得到浸润判据并把"什么液体在什么固体上铺得开"翻译成一个无量纲数的取值。
@@ -0,0 +1 @@
kind = "segment"
@@ -0,0 +1,3 @@
= 固液界面 $sigma_(S L)$ 的微观建模
固液界面的能量由两件事的净结果决定:固体表面原子失去固–固近邻、同时获得固–液异种近邻。前者可继续沿用缺键模型,后者引入新的物理——异种相互作用强度怎么估。本节先用 Dupré 思想实验把 $gamma_(S L)$ 改写为粘附功 $W_(S L)$,再用 Berthelot 几何平均估计 $W_(S L)$,最终给出 GirifalcoGood 公式。
@@ -0,0 +1 @@
kind = "segment"
@@ -0,0 +1,3 @@
把固体与液体贴在一起形成固液界面时,固体表面原子损失部分同种近邻(固–固键),同时获得异种近邻(固–液相互作用)。$gamma_(S L)$ 是这两个效应的净结果:若异种作用恰好补偿同种损失,则 $gamma_(S L) = 0$;若异种作用很弱,则 $gamma_(S L)$ 大。
仅有缺键模型 @缺键一般式 已不够用——它只算了"损失同种键"那一半,没算"获得异种键"那一半。固液界面建模真正的难点在于异种相互作用怎么估。下面用 Dupré 关系把 $gamma_(S L)$ 改写为粘附功 $W_(S L)$,再用 Berthelot 规则估 $W_(S L)$,从而绕过对异种相互作用的直接计算。
@@ -0,0 +1 @@
kind = "segment"
@@ -0,0 +1,17 @@
@GGZ判据 $r equiv gamma_(S G) \/ gamma_(L G)$ 切段:
#figure(
table(
columns: (auto, auto, auto),
align: (left, left, left),
table.header[*比值范围*][*接触角*][*现象*],
[$r > 1$], [无解], [完全铺展(superwetting],
[$r = 1$], [$theta = 0$], [临界完全浸润],
[$1\/4 < r < 1$], [$0 < theta < pi\/2$], [部分浸润],
[$r = 1\/4$], [$theta = pi\/2$], [临界不浸润],
[$r < 1\/4$], [$theta > pi\/2$], [不浸润、成珠状],
),
caption: [浸润全谱]
) <浸润全谱表>
@γ量级表 与浸润全谱并置就得到日常现象的解释。高能表面如金属、清洁玻璃,$gamma_(S G) tilde.op 1 thin "J/m"^2$,远大于水的 $gamma_(L G) tilde.op 0.072 thin "J/m"^2$$r >> 1$,水在其上完全铺展。低能表面如石蜡、Teflon,$gamma_(S G) tilde.op 0.02 thin "J/m"^2$ 小于水的 $gamma_(L G)$$r < 1\/4$,水在其上不浸润、成珠状。"水在玻璃上铺、在荷叶上成珠"这两件日常现象就是 $r$ 取值在 @GGZ判据 中位于 $r >> 1$ $r < 1\/4$ 两端的直接体现。