Skip to content

An AI skill that turns books into animated, narrated, interactive web experiences

fix(skill): stale links after the restructure; new_book.py removes a half-made book

yzree458c1e96d4
diff --git a/.claude/skills/papermorph/scripts/items.py b/.claude/skills/papermorph/scripts/items.py
index e421970..85c53dd 100644
--- a/.claude/skills/papermorph/scripts/items.py
+++ b/.claude/skills/papermorph/scripts/items.py
@@ -5,7 +5,7 @@
The bank is the source of truth for the chapter's choice questions: write and lint it with the
mcq-item-writer skill, then build. The page loads items.js after engine.js and asks with
-mcq('ID') (engine.md, Questions). Lint first; this script only refuses what the engine can't show:
+mcq('ID') (references/lessons/questions.md). Lint first; this script only refuses what the engine can't show:
- multiple-response items, data tables and media (draw data in the picture and ask about it);
- an item without exactly one correct option.
diff --git a/.claude/skills/papermorph/scripts/new_book.py b/.claude/skills/papermorph/scripts/new_book.py
index 9a64555..3508ecd 100644
--- a/.claude/skills/papermorph/scripts/new_book.py
+++ b/.claude/skills/papermorph/scripts/new_book.py
@@ -9,6 +9,7 @@
Run it from the folder that holds site/, books/, content/ and tools/ (or pass --root). It refuses a book that
already has a site/<book>/ folder, so it never overwrites work; resume an existing book from its own files.
+When a step fails (engine.py without network or a local engine/), the new site/<book>/ is removed, so a rerun works.
The engine comes from engine.py (the repository's engine/ when at hand, else the latest compatible release).
It copies and creates files only; the voice, effects and baking steps it prints come next.
"""
@@ -45,11 +46,19 @@ def main():
sys.exit(f'{site} exists: resume from its own files, or choose another slug')
if a.maps and a.kind not in ('documentary', 'shorts'):
sys.exit('--maps is for documentaries and shorts')
+ try:
+ start(a, root, ch, site, work, content)
+ except BaseException:
+ shutil.rmtree(site, ignore_errors=True) # a half-made site/<book>/ would block the rerun
+ raise
+
+def start(a, root, ch, site, work, content):
for d in (site / 'lib', site / 'img', site / ch, content, root / 'tools' / a.book):
d.mkdir(parents=True, exist_ok=True)
# engine.py first: it refuses a lib/ that already holds files but no engine
- subprocess.run([sys.executable, str(HERE / 'engine.py'), str(site)], check=True)
+ if subprocess.run([sys.executable, str(HERE / 'engine.py'), str(site)]).returncode:
+ sys.exit(f'engine.py failed; {site} removed, rerun once the engine is reachable')
narration = content / f'narration.{a.lang}.json'
if a.kind == 'lesson':
diff --git a/engine/vendor/mathjax/README.md b/engine/vendor/mathjax/README.md
index 9dcca44..eb3e45c 100644
--- a/engine/vendor/mathjax/README.md
+++ b/engine/vendor/mathjax/README.md
@@ -9,6 +9,6 @@
Source: `https://registry.npmjs.org/mathjax/-/mathjax-3.2.2.tgz`, also `https://cdn.jsdelivr.net/npm/[email protected]/es5/tex-svg-full.js`. The repository's `.gitattributes` keeps this folder byte-exact (`-text`), so the checksums hold on every OS.
-`engine.py <book> --latex` copies `tex-svg-full.js` to the book's `lib/mathjax.js` and `LICENSE` to `lib/mathjax-LICENSE.txt` ([site.md](../../../.claude/skills/papermorph/references/site.md#start-a-book-folder)); its chapters load `../lib/mathjax.js` right after `engine.js`, which sets the MathJax configuration.
+`engine.py <book> --latex` copies `tex-svg-full.js` to the book's `lib/mathjax.js` and `LICENSE` to `lib/mathjax-LICENSE.txt` ([lessons.md](../../../.claude/skills/papermorph/references/lessons/lessons.md#latex)); its chapters load `../lib/mathjax.js` right after `engine.js`, which sets the MathJax configuration.
To update, replace both files from a newer 3.x release, update the version and checksums here, and run `engine/check_latex.py`. MathJax 4 splits extensions and fonts into separate files and needs a different setup.