Repository navigation
Conversation
…1392) PreTeXt 2.56 emits {{ ebook_config_override | safe }} after its own eBookConfig assignments. The server now fills it with the values only a Runestone server can know (the green items in #1392, plus isAuthor and isEditor), and bookfuncs.js merges it into eBookConfig before anything reads it, so the server rather than the book's template is the authority. - rsptx.templates.ebook_config builds the statement, HTML-safe JSON so a course attribute can't close the <script> tag. Author/editor group lookups run only for instructors, the only ones shown those links. - Book pages, the course home page, chooseAssignment and doAssignment provide it; the last three only when use_pretext_student_pages is on. - is_author returns False when no author group exists, like is_editor. - The Editor Dashboard link goes to the editor page, not the author one. - Bump pretext to 2.56.0 in uv.lock. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The course-home override enables a malformed reading tracker when an assignment remains in localStorage.
1 open issue
What changed in this PR
Moves Runestone-specific eBookConfig values to a shared server-generated override, supporting the migration in #1392 while preserving publisher settings.
Changes:
- Supplies and merges configuration overrides for book and PreTeXt student pages.
- Handles missing author groups and corrects the Editor Dashboard link.
- Adds override tests and updates PreTeXt to 2.56.0.
| File | Description |
|---|---|
uv.lock |
Updates PreTeXt to support the override marker. |
test/components/rsptx/templates/test_ebook_config.py |
Tests server configuration and safe serialization. |
components/rsptx/templates/ebook_config.py |
Adds the shared configuration helper. |
components/rsptx/db/crud/group.py |
Handles missing author groups. |
bases/rsptx/interactives/runestone/common/test/bookfuncs_config_override.test.js |
Tests configuration merging. |
bases/rsptx/interactives/runestone/common/js/bookfuncs.js |
Applies overrides and corrects the editor link. |
bases/rsptx/book_server_api/routers/course.py |
Supplies course-home overrides. |
bases/rsptx/book_server_api/routers/books.py |
Supplies book-page overrides. |
bases/rsptx/assignment_server_api/routers/student.py |
Supplies assignment-page overrides. |
Review effort: Balanced
| user=user, | ||
| user_is_instructor=user_is_instructor, | ||
| course_attrs=attrs, | ||
| readings=[], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Part of #1392: moves responsibility for the Runestone-specific
eBookConfigvalues from the PreTeXt template to the server.How it works
PreTeXt 2.56 emits
{{ ebook_config_override | safe }}after its owneBookConfigassignments. The server fills that withebook_config_override = {...}, andbookfuncs.jsmerges it intoeBookConfig(Object.assign) when the module loads, before anything else reads it. Values the override doesn't name, such asenableScratchAC,acDefaultLanguageandrunestone_version, keep the book's value.What the server sends
The green items in #1392:
useRunestoneServices,course,termStartDate,basecourse,isLoggedIn,email,isInstructor,logLevel,username,readings,activities,downloadsEnabled,allow_pairs,course_attrs, plusisAuthorandisEditor. These are real JSON booleans, not"true"/"false"strings.enableScratchACandacDefaultLanguageare also green in the issue, but they're publisher options with no server-side source, so the book keeps them.Where
rsptx.templates.ebook_config.ebook_config_override(), builds the object.htmlsafe_json_dumps, so a course attribute containing</script>can't break out of the script tag.serve_page) always send it;useRunestoneServicesisfalsein?mode=browsing.chooseAssignmentanddoAssignmentsend it only whenuse_pretext_student_pagesis on, since their PreTeXt_base.htmlis the one that emits the marker. As a side effect these pages now get the realusernameandemail, which used to be empty on some of them.Also
is_authorreturnsFalsewhen the DB has noauthorgroup, likeis_editoralready does. Without this, instructor page views would crash on such installs./admin/editor/manage_exercises(overridable witheBookConfig.editorServerUrl) instead of the author dashboard.uv.lockbumps pretext from 2.55.0 to 2.56.0, the version that emits the marker.Testing
bookfuncs_config_override.test.js(vitest) andtest/components/rsptx/templates/test_ebook_config.py.use_pretext_student_pages=false, the three student pages have no override.RST books are unaffected: their template doesn't emit the marker, and their JS ships from
legacy_support.🤖 Generated with Claude Code