forked from EduCraft/curriculum-project-hub
feat(model): author 是有序列表;Info(canonical) vs RawInfo(授权 surface) 入契约
一节课可多人署名(教研组),故 canonical author 是**有序列表**而非单值。on-disk 形式接受裸字符串(单作者)或数组(多作者),但此"字符串或数组"二态**只活在加载边界**: RawInfo 经归一化折叠成 canonical Info,其后系统只见 List。 Lean 母本(ADR-0008 范围):新增 Model/Info.lean,把 Info(canonical,authors: List String)与 RawInfo/RawAuthor(授权便利 surface)+ 归一化 RawInfo.toInfo 钉死—— canonical 接收端恒为列表,raw 形式不泄漏。ADR-0008 [info] 块补 author-as-list 决策。 impl 对齐:cph-model Info.author: Option<String> → authors: Vec<String>;RawAuthor untagged enum(One|Many)+ into_vec 归一化;augmented manifest 发射 author 数组 (typst document(author:) 与模板已接受 string/array)。doc 两端互引 spec。 测试:load.rs 单作者→单元素列表;target-configs fixture 加数组作者断言多作者。 验证:lake build 绿(25 jobs);cargo test 全绿;clippy 静默;TH-141(单字符串作者) check+build PDF 无回归。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -45,7 +45,7 @@ name = "…" # folder/display name
|
||||
|
||||
[info] # passed through to render targets verbatim
|
||||
title = "…"
|
||||
author = "…"
|
||||
author = "…" # one author; or a list: author = ["…", "…"]
|
||||
|
||||
[[parts]] # ORDER OF THIS ARRAY IS THE LESSON ORDER (ADR-0005)
|
||||
kind = "segment" # one of the known kinds (ADR-0006 / stdlib set)
|
||||
@@ -63,6 +63,18 @@ that imports elements in order is a *generated build artifact* derived from the
|
||||
manifest (see ADR-0007's note that the on-disk encoding of `Lesson` is separate
|
||||
from "it's a tree"), never the canonical order.
|
||||
|
||||
### `[info].author` is a list; the on-disk single-string form is sugar
|
||||
|
||||
A lesson can be authored by several people (a teaching group), so the canonical
|
||||
`author` is an **ordered list**, not a single value. For authoring convenience the
|
||||
on-disk form accepts **either** a bare string (`author = "…"`, one author) **or** an
|
||||
array (`author = ["…", "…"]`). That "string-or-array" union lives **only at the load
|
||||
boundary**: the loader normalizes a bare string to a one-element list, and
|
||||
everything downstream sees a list. Absent `author` ⇒ empty list. This raw-vs-
|
||||
canonical split is pinned in the Lean master as `RawInfo` (the authoring surface)
|
||||
vs `Info` (the canonical model whose `authors` is always a list) — see
|
||||
`spec/Spec/Courseware/Model/Info.lean`.
|
||||
|
||||
### An element folder is self-describing via `element.toml`
|
||||
|
||||
Each element folder carries an **`element.toml`** declaring its kind and its
|
||||
|
||||
Reference in New Issue
Block a user