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,3 @@
== LennardJones 对势积分
缺键模型把分子间作用力简化为最近邻间存在的离散键。若代之以连续对势函数 $u(r)$、对表面分子与下半空间所有分子之间的相互作用直接积分,得到的标度律应当与缺键模型一致,并与最初的量纲分析 @量纲估计 互为印证。本节以 LennardJones 6-12 势为例完成这一积分。
@@ -0,0 +1 @@
kind = "segment"
@@ -0,0 +1,7 @@
前一节得到的关系
$ sigma = ("每个表面分子的亏损能") times ("单位面积分子数") $ <骨架公式>
适用于所有以"分子搬到表面要付出键能代价"为出发点的微观模型。两个因子分别对应两类物理:前者衡量把一个分子从体相搬到表面的能量代价,后者衡量单位面积上有多少这种亏损分子。不同模型的差异只在于这两个因子的估法。
接下来的几个模型都可以视为对 @骨架公式 的不同填法。量纲分析直接用单键能 $epsilon$ 与分子间距 $d$ 给出两因子的标度;缺键模型把亏损能精细化为"缺键数 $times$ 单键能"、把面密度精细化为 $(rho N_A \/ mu)^(2\/3)$LJ 模型用 6-12 对势对半空间积分得到两因子的标度。同一骨架在固气界面也会被原样套用,仅把摩尔汽化热替换为摩尔升华热。
@@ -0,0 +1 @@
kind = "segment"
@@ -0,0 +1,3 @@
= 液气界面 $sigma_(L G)$ 的微观建模
液气界面的微观建模是表面张力理论的主菜。以下沿着"假设由少到多"的方向给出几个模型:从仅由量纲组合给出标度的量纲分析,到带一个自由参数 $zeta$ 的缺键模型,再到用真实势函数对半空间积分的 LennardJones 模型。每个模型给出 $sigma_(L G)$ 的一个表达式,依次接受更多的物理输入。
@@ -0,0 +1 @@
kind = "segment"
@@ -0,0 +1,3 @@
== 缺键模型
缺键模型在 @骨架公式 的两个因子上各加一层物理输入。亏损能由"表面分子比体相分子缺多少根键"乘以"每根键的能量"给出,单键能由摩尔汽化热反推;面密度由"每个分子占的体积"开 2/3 次方给出。模型只保留一个无量纲参数 $zeta$——表面分子近邻数与体相近邻数之比。下面给出一般式,再讨论它的两个特例:$zeta = 1\/2$ 对应不带任何晶格信息的 Stefan 估算,立方格子下 $zeta$ 可以精确取到 $5\/6$$3\/4$ 等具体数值。