Skip to content

Commit e199eb2

Browse files
committed
plan 163: align with landed schema syntax — no-heading section, no preamble key
Plan 156 entry-unification landed in main (PR #295): the standalone preamble: key is gone, replaced by heading: null. Project the no-heading section's content into the enclosing object instead of a preamble wrapper key. https://claude.ai/code/session_01Ar54BuJr8fFB9KzJGvLvYR
1 parent 4c98526 commit e199eb2

1 file changed

Lines changed: 37 additions & 20 deletions

File tree

plan/163_schema-driven-data-extraction.md

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,15 @@ the validated match and mirrors the hierarchy:
6060
field** (both the placeholder name and its value
6161
survive), plus the element's own child scopes and
6262
content.
63-
- **Preamble** (content before the first heading, when
64-
the schema declares a preamble scope) → projected under
65-
a `preamble` key. Wildcard slots and unlisted/closed
66-
headings are skipped: the output is a faithful
67-
projection of the *declared* schema only.
63+
- **No-heading section** (`heading: null` — content
64+
before the first child heading) has no heading text and
65+
therefore no slug. Its content entries project
66+
**directly into the enclosing object** (root, or the
67+
parent section) beside the headed-section keys — there
68+
is no `preamble` wrapper key. Wildcard slots
69+
(`regex: '.+'`) and unlisted/closed headings are
70+
skipped: the output is a faithful projection of the
71+
*declared* schema only.
6872
- **`code-block`** → string under `code` (raw body);
6973
multiple blocks get `code`, `code-2`, …
7074
- **`list`** → array of item strings under `items`.
@@ -80,16 +84,23 @@ are omitted rather than emitted as null.
8084

8185
## Sequencing
8286

83-
The schema engine is mid-rework. This plan lands after,
84-
and consumes the outputs of, that work — not the legacy
85-
single-source model.
86-
87+
This plan consumes the reworked schema engine, not the
88+
legacy single-source model.
89+
90+
- **Entry-shape unification (`156_schema-entry-unification`
91+
/ PR #295) — landed in main.** Every `sections:` entry
92+
is discriminated by its `heading:` value: a string or
93+
`{regex, repeat?, sequential?}` mapping for headed
94+
sections, and `heading: null` for the no-heading section
95+
(content before the first child heading). There is no
96+
standalone `preamble:` key. The projection rules above
97+
target this shape directly.
8798
- **[Plan 156 — kind-schema
8899
composition](156_kind-schema-composition.md) / PR
89100
#288.** (Disambiguation: two plan files share id 156;
90-
this dependency is the composition one, not
91-
`156_schema-entry-unification.md`.) A file can resolve
92-
to multiple kinds whose schemas compose via
101+
this dependency is the composition one, not the
102+
now-landed `156_schema-entry-unification`.) A file can
103+
resolve to multiple kinds whose schemas compose via
93104
`schema.Compose()`. The extractor consumes the composed
94105
`Schema`. Default keys derive from heading text, so
95106
identical headings from two kinds merge to the same key
@@ -126,12 +137,13 @@ partial data.
126137
3. **Default scope projection.** Walk the scope tree and
127138
build the nested structure per the rules above:
128139
`frontmatter` plus sections at the root, literal scopes
129-
keyed by slug, preamble under `preamble`, wildcard /
140+
keyed by slug, the `heading: null` no-heading section's
141+
content hoisted into the enclosing object, wildcard /
130142
unlisted skipped. Route every key through one
131143
`keyFor(node)` function — the single seam a future
132144
custom-binding plan overrides. Reuse the existing
133-
anchor slugifier. Unit-test literal, nested, preamble,
134-
and optional-omitted scopes.
145+
anchor slugifier. Unit-test literal, nested,
146+
no-heading-section, and optional-omitted scopes.
135147
4. **Repeating scopes and placeholders.** Project scopes
136148
with a `repeat: {min, max}` cardinality as arrays; each
137149
element retains
@@ -178,8 +190,10 @@ partial data.
178190
become arrays; each element retains every captured
179191
placeholder as a `name: value` field plus its child
180192
scopes/content.
181-
- [ ] Preamble is projected under `preamble`; wildcard
182-
and unlisted/closed headings are skipped.
193+
- [ ] A `heading: null` no-heading section's content
194+
projects into its enclosing object (no `preamble`
195+
wrapper key); wildcard and unlisted/closed headings
196+
are skipped.
183197
- [ ] Code-block, list, table, and paragraph entries
184198
project under their default keys; sibling key
185199
collisions are reported as schema diagnostics.
@@ -207,9 +221,12 @@ partial data.
207221
`frontmatter` object and the projected sections beside
208222
it at the same level. Grouping front matter avoids
209223
collisions with section slugs.
210-
- **Non-listed nodes.** Preamble is projected under
211-
`preamble`; wildcard slots and unlisted/closed headings
212-
are skipped.
224+
- **No-heading section.** A `heading: null` entry has no
225+
slug; its content projects directly into the enclosing
226+
object rather than under a `preamble` wrapper key. The
227+
sibling-collision rule covers any clash with a section
228+
slug. Wildcard slots and unlisted/closed headings are
229+
skipped.
213230
- **Lua deferred.** Ship json, yaml, and msgpack. A Lua
214231
encoder can be added later behind the same `Format`
215232
enum.

0 commit comments

Comments
 (0)