[GH-ISSUE #879] LUA filter for injecting quizzes automatically #1611

Closed
opened 2026-04-11 07:58:30 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @profvjreddi on GitHub (Jun 27, 2025).
Original GitHub issue: https://github.com/harvard-edge/cs249r_book/issues/879

I need to find a way to improve the quizzes and how they are integrated into the book.

Currently, the quizzes are stored in a JSON file, and a Python preprocessor generates an updated markdown when the quiz is inserted. See quizzes.pyThis setup is okay but creates redundancy because, once the quizzes are injected, there are two copies of the questions—one inside the JSON file and another inside the actual Quarto markdown file.

One way to avoid this is to focus solely on updating the JSON file and then use a Lua filter to automatically check at the end of each section in a specific chapter if there's a corresponding quiz for that section ID, and if so, insert it automatically.

Something to think about 🤔

Originally created by @profvjreddi on GitHub (Jun 27, 2025). Original GitHub issue: https://github.com/harvard-edge/cs249r_book/issues/879 I need to find a way to improve the quizzes and how they are integrated into the book. Currently, the quizzes are stored in a JSON file, and a Python preprocessor generates an updated markdown when the quiz is inserted. See `quizzes.py`This setup is okay but creates redundancy because, once the quizzes are injected, there are two copies of the questions—one inside the JSON file and another inside the actual Quarto markdown file. One way to avoid this is to focus solely on updating the JSON file and then use a Lua filter to automatically check at the end of each section in a specific chapter if there's a corresponding quiz for that section ID, and if so, insert it automatically. Something to think about 🤔
GiteaMirror added the area: booktype: improvementarea: tools labels 2026-04-11 07:58:30 -05:00
Author
Owner

@profvjreddi commented on GitHub (Jul 1, 2025):

I pushed this into this PR https://github.com/harvard-edge/cs249r_book/pull/881 which I merged.

<!-- gh-comment-id:3024034007 --> @profvjreddi commented on GitHub (Jul 1, 2025): I pushed this into this PR https://github.com/harvard-edge/cs249r_book/pull/881 which I merged.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/cs249r_book#1611