forked from bai/curriculum-project-hub
3ebe4b754d
Remove filler/redundant patterns: 钉死/钉, 本模块, likec4 画不出/画得出, 臆造, 散文, 分歧点测试, 纯 plumbing, 恰好, 留白, 宪法第N条, 刻意. No code definitions changed, only doc comments.
45 lines
2.6 KiB
Lean4
45 lines
2.6 KiB
Lean4
/-!
|
|
# RichContent —— 富内容(ADR-0006 的母本)
|
|
|
|
ADR-0006:element schema 的"叶子"可以是 `content` 类型,其值是一段**源文本**,
|
|
按其 **format** 决定语义(ADR-0015)。两种 format:
|
|
- **typst** —— 一段 typst 源,语义取该源作为 module 求值后的 body content(讲义/教案面)。
|
|
- **markdown** —— 一段**原样**的 markdown + KaTeX 源,**不经 typst 求值**(slides 大纲面 / 逐字稿口播面;
|
|
ADR-0015)。直接以 markdown 撰写**绕开** typst→markdown 的公式转换难题(ADR-0014 R2):公式一开始就是
|
|
KaTeX 源(`$…$`),没有"把 typst 公式转成 md"这一步。
|
|
|
|
关键约束(均 ADR-0006,源自 typst 源码事实):**typst** format 的富内容**不可无主**——typst 的源必须有
|
|
`FileId`,否则 span 脱锚、相对 import 报"cannot access file system from here"。故每段 typst 富内容是 World 里
|
|
的一等文件,坐落在一个**虚拟路径**上;相对 import 限本工程路径结构内 + `@package`(不跨工程)。markdown format
|
|
的富内容不参与 typst 求值,但同样由一个虚拟路径定位(供 markdown 装配 step 按序读取,见 `Export/Render`)。
|
|
|
|
只立锚点 + 最小抽象签名:typst 的 `Content`/`Module` 内部结构、JSON Schema 形状、format 的
|
|
具体判别属实现细节,不进 Lean,只承诺"富内容由一个虚拟路径定位"+"叶子带 format"这两条关系。
|
|
-/
|
|
|
|
namespace Spec.Courseware
|
|
|
|
/-- 富内容在工程文件路径结构中的**虚拟路径**(`OPEN` 表示, ADR-0006)。把一段富内容
|
|
定位为 World 里的一等文件(span 可解析、相对 import 可锚定)。落盘后即真实相对路径
|
|
(ADR-0007),不在本层承诺,故 opaque。 -/
|
|
opaque VPath : Type
|
|
|
|
/-- 富内容的 **format**(`PINNED`, ADR-0015)。`content` 叶子带 format:typst 叶子被 typst 求值;
|
|
markdown 叶子原样保留(markdown+KaTeX 源,不经求值)。 -/
|
|
inductive ContentFormat where
|
|
/-- typst 源:求值为 typst `Content`(讲义/教案面)。 -/
|
|
| typst
|
|
/-- markdown + KaTeX 源:原样保留,不经 typst 求值(slides 大纲面 / 逐字稿口播面;ADR-0015)。 -/
|
|
| markdown
|
|
|
|
/-- 对一段富内容的**引用**:它坐落在某个虚拟路径上(`PINNED` 关系, ADR-0006),并带一个
|
|
**format**(`PINNED`, ADR-0015)。不建模源文本、不建模求值出的 `Content`(那是实现侧的事);
|
|
"富内容经由一个 `VPath` 定位 + 带 format",作为 `Primitives.ElementData` 里 `content` 叶子的语义锚点。 -/
|
|
structure RichContentRef where
|
|
/-- 该富内容所在的虚拟路径(ADR-0006;落盘后为真实相对路径, ADR-0007)。 -/
|
|
vpath : VPath
|
|
/-- 该富内容的 format(ADR-0015)。 -/
|
|
format : ContentFormat
|
|
|
|
end Spec.Courseware
|