From 99dc05c76ea80fb39c7713e7308586c120dd01d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Vogel?= <104342347+cedricvogel-leo@users.noreply.github.com> Date: Mon, 26 Oct 2026 22:15:26 +0100 Subject: [PATCH] Define the shared code once in @onload instead of in every block MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LiaScript expands a macro into every slide that uses it. With the whole session logic in the run-once block, every glpython block added about 37k characters, and slides with a choice quiz hung in Chrome when opened directly (e.g. course/?…README.md#18): LiaScript's parser computes the column against the original text, the expansions push it far past the end, the quiz parser builds an indentation regex of ~39k spaces, and V8 throws "Regular expression too large" (Safari's engine accepts it). The session logic is now window.__glpythonMount in @onload. The run-once block only passes its arguments and send; a block that runs before @onload waits in window.__glpythonPending. One expansion is now ~3k characters. check-macro also checks the @onload block. Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 2 +- README.md | 69 +++++++++++++++++++++++++---------------- scripts/check-macro.mjs | 7 ++++- 3 files changed, 50 insertions(+), 28 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 5323b8d..e8731d6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co ## What this is -The LiaScript macro that embeds glpython in courses. `README.md` is both the documentation and the macro itself: its header comment defines `@GLPython.eval`, `@GLPython.turtle` and `@GLPython.visual` and holds two ` - - + +