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,3 @@
不同晶面的表面原子缺键数不同,故 $gamma_(S G)$ 随晶面指数 $(h k l)$ 而变。以简单立方为例:(100) 1 键、(110) 2 键、(111) 3 键,从而
$ gamma_(S G)^((100)) < gamma_(S G)^((110)) < gamma_(S G)^((111)) . $ <晶面各向异性>
@@ -0,0 +1 @@
kind = "lemma"
@@ -0,0 +1,9 @@
设固体体积 $V$、表面积 $A$,应变 $epsilon$ 为均匀小量。体相单位体积的自由能 $f_b = Y epsilon^2 \/ 2$,表面单位面积的自由能 $gamma(epsilon)$,总自由能
$ F = V f_b + A gamma(epsilon) . $
对均匀拉伸 $V epsilon$ 求导得单位横截面承担的应力
$ sigma_("tot") = (partial F) / (partial (V epsilon)) = Y epsilon + A / V dot (dif gamma) / (dif epsilon) , $
@总应力。
@@ -0,0 +1,5 @@
对横截面被均匀拉伸的固体,单位横截面承担的总应力为
$ sigma_("tot") = Y epsilon + A / V dot (dif gamma) / (dif epsilon) , $ <总应力>
其中 $Y$ 为杨氏模量、$epsilon$ 为应变、$A \/ V$ 为表面积与体积之比。第一项为体相弹性贡献,第二项为表面贡献。
@@ -0,0 +1 @@
kind = "lemma"
@@ -0,0 +1,5 @@
固气界面 $gamma_(S G)$ 的缺键模型公式由 @缺键一般式 直接迁移,只把摩尔汽化热 $L_m$ 替换为摩尔升华热 $L_s$
$ gamma_(S G) = (1 - zeta) thin L_s thin rho^(2\/3) / (mu^(2\/3) thin N_A^(1\/3)) . $ <固气缺键式>
物理来源也只是把"把分子从液体里拉出来"换成"把原子从晶格里拉出来",骨架公式 @骨架公式 与单键计数过程不变。
@@ -0,0 +1,26 @@
[group]
title = "固气界面"
[[children]]
kind = "segment"
path = "segments/固气界面导言"
[[children]]
kind = "segment"
path = "segments/表面能γ与表面应力f"
[[children]]
kind = "lemma"
path = "lemmas/拉伸固体的总应力"
[[children]]
kind = "lemma"
path = "lemmas/缺键模型迁移到固气"
[[children]]
kind = "lemma"
path = "lemmas/固体表面能的晶面各向异性"
[[children]]
kind = "segment"
path = "segments/不同物质γ量级对比"
@@ -0,0 +1 @@
kind = "segment"
@@ -0,0 +1,16 @@
不同物质的表面张力系数差异可达两个量级。
#figure(
table(
columns: (auto, auto),
align: (left, left),
table.header[*物质*][*$gamma$ ($"J/m"^2$)*],
[水(液气界面)], [$approx 0.072$],
[分子晶体], [$0.05 thin "—" thin 0.1$],
[离子晶体], [$0.2 thin "—" thin 1$],
[金属(Au、Fe、W], [$1 thin "—" thin 3$],
),
caption: [常见物质表面张力系数的典型量级]
) <γ量级表>
该量级谱可由缺键模型 @固气缺键式 解释。分子晶体的键合主要是范德瓦尔斯力,$L_s$ 小、$gamma$ 小;离子晶体的键合包含库仑作用,$L_s$ 上升一个量级,$gamma$ 也随之上升;金属内部的金属键键合最强,$L_s$ 最大、$gamma$ 最大。同一公式横跨四个数量级的物理体系都给出对的量级。
@@ -0,0 +1 @@
kind = "segment"
@@ -0,0 +1,3 @@
= 固气界面 $sigma_(S G)$ 的微观建模
固体表面没有"流动补缺"这条退路。从物理上讲,"创造新表面"与"拉伸已存在表面"在固体中是两件独立的事,对应两个不同的物理量——表面能 $gamma$ 与表面应力 $f$。本节先把这二者分清,再把缺键模型 @缺键一般式 中的摩尔汽化热替换为摩尔升华热,得到固气界面的 $gamma_(S G)$。最后讨论 $gamma_(S G)$ 的晶面各向异性以及不同物质的 $gamma$ 量级谱。
@@ -0,0 +1 @@
kind = "segment"
@@ -0,0 +1,9 @@
液体的 $sigma$ 同时描述两件事:创造单位新表面要付出的能量代价,以及拉伸单位已有表面的弹性反应。它们在液体里合二为一——液体可自由流动,"拉伸"等价于"补充新分子"。
固体不能流动,这两件事必须分开。设单位面积的表面能为 $gamma$,其定义为创造单位新表面所需的可逆功。再设单位长度的表面应力为 $f$,其定义为把已有的单位面积表面拉伸应变 $epsilon$ 所需的功面密度。两者之间的关系由 Shuttleworth 给出
$ f = gamma + (dif gamma) / (dif epsilon) , $
其中右端第二项反映 $gamma$ 本身随应变变化的部分。一般有 $f eq.not gamma$
本节及之后所有讨论以 $gamma$ 为对象。$f$ 仅在真正"拉固体"的场景下登场,例如薄膜应力、纳米颗粒形变,本节不展开。