"cardsort": proposed one-off XML for Runestone ingestion

Open
#2,972 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Quiet
Tech stack
html, javascript, xml
Domain
frontend

Research direction

The issue names no file paths, so start by locating how the existing matching component emits its <script type="text/xml"> island inside a <div data-component="matching">, then mirror that path for cardsort. Use the sample payload as the acceptance target, checking empty feedback-correct/feedback-incorrect elements and many-to-one answer pairings. Done when the generated output contains the cardsort XML island and the existing rendering/tests still pass.

Written by the indexing model from the issue text.

Description

We're moving the PreTeXt cardsort interactive off the dragndrop HTML representation and onto a one-off XML island, mirroring how matching already works: a <div data-component="cardsort"> containing a <script type="text/xml"> payload for the Runestone JS to parse (as HTML, per the same convention as matching).

Here's the full emitted payload for a sample cardsort (countries → confederations), which exercises every part of the format:

<script type="text/xml">
  <cardsort>
    <statement>
      <div class="para" id="cardsort-soccer-3-1">Sort each national team into the continental confederation it competes in.<div class="autopermalink" aria-hidden="true" data-description="Paragraph"><a tabindex="-1" href="#cardsort-soccer-3-1" title="Copy heading and permalink for Paragraph" aria-label="Copy heading and permalink for Paragraph">🔗</a></div>
</div>
    </statement>
    <feedback>
      <div class="para" id="cardsort-soccer-4-1">Each country belongs to exactly one continental confederation.</div>
    </feedback>
    <premise>
      <id>cardsort-soccer-p1</id>
      <label>
        <div class="para" id="cardsort-soccer-5-1-1-1">England</div>
      </label>
      <feedback-correct>Correct—England competes in <em class="emphasis">UEFA</em>.</feedback-correct>
      <feedback-incorrect>
        <div class="para" id="cardsort-soccer-5-1-1-3-1">Not quite.</div>
        <div class="para" id="cardsort-soccer-5-1-1-3-2">Of the <span class="process-math">\(6\)</span> FIFA confederations, England belongs to <em class="emphasis">UEFA</em>.</div>
      </feedback-incorrect>
    </premise>
    <premise>
      <id>cardsort-soccer-p2</id>
      <label>
        <div class="para" id="cardsort-soccer-5-1-2-1">France</div>
      </label>
      <feedback-correct/>
      <feedback-incorrect>France is European—look to <em class="emphasis">UEFA</em>.</feedback-incorrect>
    </premise>
    <premise>
      <id>cardsort-soccer-p3</id>
      <label>
        <div class="para" id="cardsort-soccer-5-2-1-1">USA</div>
      </label>
      <feedback-correct>Right! The United States plays in <em class="emphasis">CONCACAF</em>.</feedback-correct>
      <feedback-incorrect/>
    </premise>
    <premise>
      <id>cardsort-soccer-p4</id>
      <label>Egypt</label>
      <feedback-correct/>
      <feedback-incorrect/>
    </premise>
    <response>
      <id>cardsort-soccer-r1</id>
      <label>UEFA</label>
    </response>
    <response>
      <id>cardsort-soccer-r2</id>
      <label>CONCACAF</label>
    </response>
    <response>
      <id>cardsort-soccer-r3</id>
      <label>CAF</label>
    </response>
    <answer premise="cardsort-soccer-p1" response="cardsort-soccer-r1"/>
    <answer premise="cardsort-soccer-p2" response="cardsort-soccer-r1"/>
    <answer premise="cardsort-soccer-p3" response="cardsort-soccer-r2"/>
    <answer premise="cardsort-soccer-p4" response="cardsort-soccer-r3"/>
  </cardsort>
</script>

Structure:

  • statement, feedback — the exercise prompt and overall feedback (rendered HTML).
  • premise — one per card: a stable id, a label (rendered HTML), and per-premise feedback-correct / feedback-incorrect that are always present but may be empty (shown when the card is placed correctly / incorrectly). p2/p3 show the one-sided cases; p4 shows none.
  • response — one per drop category: id + label.
  • answer — the correct pairings, by id. Many-to-one is supported: p1 and p2 both map to r1 (UEFA).

Claude Opus 4.8, acting as a coding assistant for Rob Beezer

Dominant language
XSLT
Stars
466
Forks
251
Avg merge
4m
Merged PRs (30d)
13

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PreTeXtBook/pretext

All issues in PreTeXtBook/pretext

Similar issues

More Web Dev issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.