Tracking a language idiosyncrasy in the build that the language-axis refactor's tag-threading does not cover, found while reviewing #1217.
Context
We are generalizing the build so it can produce a Python edition ("SICPy", from xml_py/) alongside the JavaScript edition ("SICP JS"), sharing one tooling codebase, via a language descriptor in javascript/editions.ts.
Most JS-specifics are just XML tag names (JAVASCRIPT*), handled by the descriptor. Two surface strings — the line-comment marker (//) and the edition title (SICP JS) — are now also in the descriptor (commentPrefix, displayName; Python: #, SICPy), done in #1217.
The remaining idiosyncrasy: the Source Academy playground link
Each runnable snippet is turned into a "open in playground" link whose program is compressed into the URL with Source-JavaScript-specific parameters:
chap=<1..4>&variant=<...>&prgrm=<compressed program>
Sites:
processSnippetJson.js (chap= + &prgrm=, the implicit_chap === "5" ? "4" remap)
processSnippetHtml.js (/playground#chap=...&prgrm=...)
processSnippetPdf.js (/playground\#chap=...&prgrm=...)
processSnippetJs.js (chapter=/variant= annotation)
chap=1..4 selects the Source §1–4 sublanguage levels, which are specific to the JavaScript editions. Source Academy runs Python differently (it is not selected via chap=1..4), so this is not a simple string swap — it needs a per-language playground-link strategy.
What's needed
- Decide how SICPy snippets should link into the playground (which URL scheme / language selector Source Academy's Python mode uses).
- Add the necessary fields/among the language descriptor (e.g. a
playgroundLink(program, chap, variant) builder, or a playgroundLanguage parameter) and route the four sites through it.
- Verify the JavaScript edition output stays byte-identical (golden-diff harness).
Related
Tracking a language idiosyncrasy in the build that the language-axis refactor's tag-threading does not cover, found while reviewing #1217.
Context
We are generalizing the build so it can produce a Python edition ("SICPy", from
xml_py/) alongside the JavaScript edition ("SICP JS"), sharing one tooling codebase, via a language descriptor injavascript/editions.ts.Most JS-specifics are just XML tag names (
JAVASCRIPT*), handled by the descriptor. Two surface strings — the line-comment marker (//) and the edition title (SICP JS) — are now also in the descriptor (commentPrefix,displayName; Python:#,SICPy), done in #1217.The remaining idiosyncrasy: the Source Academy playground link
Each runnable snippet is turned into a "open in playground" link whose program is compressed into the URL with Source-JavaScript-specific parameters:
Sites:
processSnippetJson.js(chap=+&prgrm=, theimplicit_chap === "5" ? "4"remap)processSnippetHtml.js(/playground#chap=...&prgrm=...)processSnippetPdf.js(/playground\#chap=...&prgrm=...)processSnippetJs.js(chapter=/variant=annotation)chap=1..4selects the Source §1–4 sublanguage levels, which are specific to the JavaScript editions. Source Academy runs Python differently (it is not selected viachap=1..4), so this is not a simple string swap — it needs a per-language playground-link strategy.What's needed
playgroundLink(program, chap, variant)builder, or aplaygroundLanguageparameter) and route the four sites through it.Related
processSnippetHtml/processSnippetJsheaders, the "Interactive SICP JS" chrome inversions/split.tsx) are not blockers — they use the existingcommentPrefix/displayNamedescriptor fields and are threaded as those files are generalized.