From f46f25933c799526b06fe0312be5e1419f27563b Mon Sep 17 00:00:00 2001 From: Dasemu Date: Mon, 19 Oct 2026 04:13:28 +0200 Subject: [PATCH] docs: document text-stage structure and new work.toml keys Co-Authored-By: Claude Opus 5.5 --- docs/work-config.md | 28 +++++++++++++++++++++++++-- src/vnpipe/schemas/parsed.schema.json | 2 +- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/docs/work-config.md b/docs/work-config.md index 65d5672..bd54801 100644 --- a/docs/work-config.md +++ b/docs/work-config.md @@ -9,13 +9,37 @@ A work is a directory containing `work.toml`, plus the folders the pipeline fill | `[work]` | `id`, `title`, `subtitle`, `author`, `translator`, `language` (`es`/`en`, used for the About text), `lyric_voice` (cast id for verse nobody speaks; default `poet_voice`), `end_text`, `menu_bg` (background asset id for the main menu; default: first staged `bg`). | | `[source]` | `gutenberg_id`, `url`, `raw_file` (cache path, relative to the work root, gitignored). | | `[scope]` | `start_marker`, `end_marker` (whole stripped lines), `end_occurrence` (1-based, searched after the start; the end marker itself is excluded). | -| `[speakers]` | Speaker heading as printed (upper case) → cast id. An unknown speaker is a parse error. | -| `[[scenes]]` | `heading` (as printed), `id`, `location`, `time_of_day`. | +| `[speakers]` | Speaker heading as printed (upper case, without its italic note) → cast id. Several headings may share one id (anonymous crowd speakers). A key with punctuation or markup (`"CORO, TUTTI"`) is matched against the whole printed line first. An unknown speaker is a parse error. | +| `[[scenes]]` | `heading` (as printed), `id`, `location`, `time_of_day`, optional `occurrence` and `format` (below). | +| `[parser]` | `direction_headings`: whole lines in capitals that are stage directions or section titles (`"ENTRA FAUSTO"`), not speakers. Each becomes a `direction` line once the scene's first speech has started (before it, the line is treated as cast/setting). | | `[cast.]` | `name` (shown in the dialogue box), `color`, `sprite` (default `true`; `false` = never drawn), `expressions` (annotation emotion → sprite expression; needs `neutral`). | | `[staging.]` | `bg` (background shown after the title card), `mode` (`adv` or `nvl`), `cast = { = "left\|center\|right" }` pins sprite characters for the whole scene. | | `[[cues]]` | `at` (line id; fires right before it) plus any of `bg`, `transition` (`dissolve`, `fade`, `flash`, `slow`), `tint` (`none`, `dark`, `red`), `mode`, `hide_all`, `shake`, `move = { = "" }`. | | `[[overrides]]` | `from`, `to` (inclusive line ids in one scene), `emotion`: forces the emotion before expression mapping. | +### Text structure + +`parse` cuts the scope, then drops noise: illustration markers (also multi-line), footnote +definitions (` [12] text` plus indented continuation lines) and footnote markers (`word[12]`). +Then, per line: + +- A scene heading starts a scene. A heading printed more than once needs one `[[scenes]]` + entry per appearance, each with `occurrence` (1-based, in order of appearance; default 1). + Two entries with the same heading and occurrence, or the same `id`, are config errors; an + appearance with no entry is a parse error. +- Before the first speech, unindented blocks are `cast` lines (cast list, setting in capitals; + an italic block is a `direction`). A speaker heading directly followed by an unindented line + belongs to such a block. +- A speaker heading is `NAME`, optionally followed by an italic note (`, _a_ FAUSTO`, + ` (_solo_)`, notes wrapped over two lines); the note is kept in `speaker_note`. It must be + followed by a blank line and verse, otherwise it is not a heading. +- `(...)` blocks, unindented `_italic_` blocks and `direction_headings` are `direction` lines. +- `format = "prose"` on a scene: unindented paragraphs (consecutive lines joined) become one + `verse` line each (`indent` 0, `stanza` = paragraph index in the speech). Unindented text + in a verse scene is a parse error. + +Anything else is a `ParseError` with the raw line number. + Emotions: `neutral`, `joyful`, `melancholic`, `solemn`, `ironic`, `angry`, `fearful`, `ecstatic`. Unknown line ids, characters, positions or emotions are errors at generation. See [adaptation-rules.md](adaptation-rules.md) for how these choices are meant to be used. diff --git a/src/vnpipe/schemas/parsed.schema.json b/src/vnpipe/schemas/parsed.schema.json index 90d4336..2463c7c 100644 --- a/src/vnpipe/schemas/parsed.schema.json +++ b/src/vnpipe/schemas/parsed.schema.json @@ -27,7 +27,7 @@ "additionalProperties": false, "properties": { "id": {"type": "string", "pattern": "^[a-z0-9_]+_[0-9]{4}$", "description": "_<4-digit index within scene>"}, - "kind": {"enum": ["verse", "direction", "cast"], "description": "verse = spoken/recited text line; direction = stage direction (parenthesised or italic setting text); cast = list of characters under a scene heading"}, + "kind": {"enum": ["verse", "direction", "cast"], "description": "verse = spoken/recited text line (one paragraph in a prose scene); direction = stage direction (parenthesised or italic setting text); cast = list of characters under a scene heading"}, "speaker": {"type": ["string", "null"], "description": "Cast id from work.toml [speakers], null when nobody speaks (e.g. Dedicatoria, directions)"}, "speaker_note": {"type": ["string", "null"], "description": "Inline note in the speaker heading, e.g. 'solo', 'aterrado'"}, "speech": {"type": "integer", "minimum": 0, "description": "Index of the speech (speaker turn) within the scene; directions get the index of the speech they occur in or precede"},