Expand description
The .kernsetzer project file: a zip archive with
meta.json { "format_version": 2, "created_with": "kernsetzer 0.1.0", "modified": "…" }
book.json the Book, pretty-printed
assets/<id> images, referenced by id from book.jsonplus book.json (de)serialization with schema migrations, and the
autosave sidecar <name>.kernsetzer.autosave next to the project.
Saving writes a temporary sibling and renames it over the project, so a crash mid-save never leaves a half-written project behind.
Structs§
- Meta
- Contents of
meta.json: facts about the file, not about the book. - Project
- A book with its images and file metadata: what a
.kernsetzerholds.
Enums§
Constants§
- CREATED_
WITH - The build that writes a file, as recorded in
meta.json. - EXTENSION
- The project file’s extension, without the dot.
- MAX_
ASSET_ BYTES - Largest single asset accepted (same limit as the .docx importer).
- MAX_
JSON_ BYTES - Largest
book.json/meta.jsonaccepted (a 100k-word novel is ~2 MB). - MIGRATIONS
- OLD_
EXTENSION - The extension of project files from before the rename. Files with it are still opened.
Functions§
- autosave_
path - The autosave sidecar for a project:
Roman.kernsetzer→Roman.kernsetzer.autosave, in the same folder. If it exists when a project is opened, the last session ended without a clean save. - book_
from_ json - Parse
book.json, migrating older formats to the current one. - book_
to_ json - discard_
autosave - Remove the autosave sidecar, if there is one.
- migrate
- Bring a
book.jsonvalue of any supported version to the current format, applying the migrations in order. - now_
rfc3339 - The current time as RFC 3339 in UTC, to the second.
Type Aliases§
- Migration
- One schema step:
MIGRATIONS[i]turns a versioni + 1book.jsoninto versioni + 2. Each step is a plain function on JSON, written once and never changed afterwards (old files stay old). When the schema changes incompatibly: bumpFORMAT_VERSION, append the step, and commit a fixture of the old version undertests/fixtures/.