theater-reader/AGENTS.md
agent 2608d10dd2 Add theater reader web app with the 1931 play transcription
Static app (no build step) served by unprivileged nginx in a container:
choose a font, size and theme, pick a character to highlight their lines
and step through them, read in a distraction-free mode, or export a PDF
via the print dialog (one page per original page).

Includes the transcription of typescript pages 5-27 (pages 1-4 and 7
are missing in the original), a parser with node:test tests, and
self-hosted OFL fonts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HA82gVRDXpoukzgMFumoJt
2026-10-29 23:14:19 +00:00

42 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# AGENTS.md — theater-reader
A static web app (plain HTML/CSS/ES modules, no build step) served by unprivileged nginx in a container.
## Layout
- `public/index.html`, `app.js`, `app.css` — the app. UI language is Czech.
- `public/parse.js` — parser for the play markup, also used by the tests.
- `public/plays/index.json` — list of plays (`id`, `file`, `title`, `note`); a play selector appears once there is more than one.
- `public/plays/*.txt` — play texts in the markup below.
- `public/fonts/` — self-hosted woff2 (latin + latin-ext) and their OFL licences, generated by `tools/fetch_fonts.py`.
- `deploy/` — nginx config. `Dockerfile` at the root.
## Run / test
- Dev port: **3010** on loopback. `podman build -t theater-reader . && podman run -d --name theater-reader -p 127.0.0.1:3010:8080 theater-reader`.
The admin previews with `ssh -p 14922 -L 3010:localhost:3010 <host>`.
- Tests (parser): `podman run --rm -v "$PWD":/app:ro,Z -w /app docker.io/library/node:22-alpine npm test`.
- Fonts: `python3 tools/fetch_fonts.py` re-downloads them; edit `FAMILIES` there and the `FONTS` list in `app.js` together.
## Play markup
One directive per line; blank lines are ignored.
| Line | Meaning |
|-----------------|---------|
| `=N` | start of original page N |
| `!N` / `!N-M` | page(s) missing from the original (shown as a notice) |
| `@Name` | new speech by Name |
| `>(text` | stage direction; a following `> text` (one leading space) continues it |
| `> text` | verse/song line (two or more spaces after `>`) |
| `#text` | scene description at the left margin |
| `~text` | centred line (scene title, "O p o n a") |
| `.` | blank line; also ends the current speech, so a following `>` is a standalone direction |
| anything else | dialogue; at the top of a page, or after a standalone direction, it continues the last speaker |
The text keeps the typescript's line breaks, spelling and missing spaces ("dobře.Ale"). The "running text" mode joins
hyphenated words (`nepří-` / `jemné`, also the typist's `ne -` / `spokojenců`) and adds the missing spaces. **A dash that
really is punctuation at the end of a line must be typed as `–` (en dash)**, or it gets joined to the next word.
To add a missing page, e.g. page 7, replace the `!7` line in `hra.txt` with `=7` and its content; the speaker on page 8's first
lines comes from whatever speech page 7 ends with.