Adapter: chapter quiz pages
Status: VERIFIED. Proven by learning-record-store/docs/js/quiz-xapi.js against the
real Material-rendered chapter 1 quiz (10 questions), plus a fixture test.
Applies when: the target is a chapter's quiz.md generated by quiz-generator,
with numbered #### N. Question headings, a <div class="upper-alpha"> list of options,
and a ??? question "Show Answer" block containing "The correct answer is X" and
"Concept Tested: …".
This is a site page, not a sim
No iframe and no
metadata.json. The runtime loads site-wide frommkdocs.yml:extra_javascript: - js/lrs-config.js - js/lrs-xapi.js - js/lrs-lite-sim.js - js/lrs-sim.js - js/xapi-json-viewer.js - js/quiz-xapi.js extra_css: - css/lrs-xapi.cssOrder matters: config first,
quiz-xapi.jslast.Don't write a per-quiz script. Copy
quiz-xapi.jsinto the book'sdocs/js/unchanged. It no-ops on pages without a quiz, parses the answer key from the rendered page (soquiz.mdstays the single source of truth), and emits throughlrs.question().The policy comes from
lrs-config.jsquizzes.teaching. It'strueonly in books that teach xAPI. Every quiz statement is an answer, and answers pass through in both modes, so there is no Full/Compact switch (modeControls: false).
What it emits
- One
answeredper question:…/chapters/<ch>/quiz/#q{N}, one-based and matching the displayed number (the order is fixed);success,response= the letter, anddurationMssince load. - The first choice is the evidence. Later changes are review; the options lock.
- A peeked answer is not evidence. Opening "Show Answer" before choosing suppresses the statement, and the page says so.
Open follow-up: quiz concept ids
quiz-xapi.js still derives concept_id as a slug of the "Concept Tested" label,
not a namespaced learning-graph id. Only about 65% of labels match a ConceptLabel
exactly. Until that is fixed, quiz concept ids won't join to Concept vertices.
If the user asks for quiz instrumentation in a new book, say so and offer one of two
fixes: a label → ConceptID table, or a quiz-generator change that writes the
ConceptID. Don't silently ship the slug as if it were a real id.
Verifying
check-xapi.py works on sims, not on rendered site pages. Build the site
(mkdocs build -d <scratch>/site), open a quiz page from the build, and read
LRSLite.statements after answering. Alternatively, reuse the fixture approach in
learning-record-store/tests/test_microsim_compact_xapi.py
(test_quiz_answers_pass_through_with_a_log_but_no_mode_switch).