Skip to content

QR codes for interactive programs v2#2831

Open
ascholerChemeketa wants to merge 7 commits intoPreTeXtBook:masterfrom
ascholerChemeketa:qr-interactive-programs-new
Open

QR codes for interactive programs v2#2831
ascholerChemeketa wants to merge 7 commits intoPreTeXtBook:masterfrom
ascholerChemeketa:qr-interactive-programs-new

Conversation

@ascholerChemeketa
Copy link
Copy Markdown
Contributor

Update based on #2676 and recent changes


This pull request enhances support for interactive program elements (activecode and codelens) in static output formats, especially regarding QR code generation and linking to interactive versions. It introduces publisher configuration for QR code inclusion, improves documentation, and ensures consistent treatment of interactive programs across the pipeline. The most important changes are summarized below.

Improvements to QR code generation and static output for interactive programs:

  • QR codes and in-context links for static program listings:
    Static representations of interactive programs (activecode and codelens) can now include a QR code and "In Context" link to the interactive HTML version, if a base URL is configured. This is controlled via the publisher variable common/program/@static-qrcodes, which defaults to "yes" but can be set to "no" to disable QR code generation. [1] [2] [3] [4] [5]

  • Consistent sidecar file and URL handling:
    The extraction and assembly XSLT and Python scripts are updated so that interactive programs do not get standalone URLs in their sidecar files; instead, the in-context page URL is used for QR code generation. This prevents broken links and ensures QR codes point to the correct location. [1] [2] [3] [4] [5]

Documentation updates:

  • Expanded author guide for interactive programs:
    The documentation now explains the new QR code and link behavior for static program listings, describes how to configure or disable these features, and clarifies fallback behavior when interactive output is not supported. [1] [2]

Pipeline and template adjustments:

  • Unified representation handling:
    The XSLT pipeline now routes program elements through the representations mode, ensuring static builds treat them like other interactive objects and can attach QR codes and links as needed. This also affects how program elements are handled inside problem statements. [1] [2]

These changes collectively improve the usability and configurability of interactive code examples in static outputs, making it easier for readers to access interactive versions via QR codes and links.

@rbeezer
Copy link
Copy Markdown
Collaborator

rbeezer commented Apr 14, 2026

I need to spend more time with this one, but here are some initial thoughts.

  • We are replacing one object (program) with two (program, sidebyside). Nervous about the inmplications for the various id's in use during assembly. Attempting to create a problematic example would help me understand my fears.
  • A program can live
    • among a bunch of p
    • just after a exercise/statement (moves for static version)
    • inside a listing

The latter is a problem, since a listing should only hold program and console. So I'm having a hard time seeing how best to make legal PreTeXt for the static case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants