Purrx

Compile a whole deck

Compile a full <deck> of component slides into render plans and a .pptx: each slide on its own, problems collected per slide, and broken slides replaced with placeholders.

13 min+35 XPHands-on

Everything is in place: components, a library, themes, content-sized layout and text fitting. This lesson ties them into the the rest of the course relies on, and it ends the engine half of the project.

parseXml

the whole <deck>

expandAll

components → layout

applyTheme

$tokens → values

layoutSlide

boxes + fitted text

slides[]

one render plan per slide

problems[]

{ slide: 3, message: '<Card> needs a “title” prop' }

Each slide goes through the stages on its own. A slide that fails becomes a placeholder and a problem in the list, and the rest of the deck still builds.

compileDeck(xml, themeName)

  1. Parse the whole <deck>. If that fails, there's nothing to compile: return one deck-level problem (slide 0).
  2. Pick the theme: the argument, then the deck's theme attribute, then light.
  3. For each slide, in its own try: expand components, apply the theme, check it's a <slide>, and lay it out. Copy the layout's problems into the list with the slide number.
  4. If anything throws, record the problem and push a placeholder slide, so the deck still has the right number of slides and still opens.
A six-slide deck written with components and compiled by the course engine. This is the level of output the finished project produces.

Key takeaways

  • Each slide runs through expand, theme and layout on its own.
  • Problems are collected as { slide, message } instead of thrown, so one bad slide can't sink the deck.
  • A broken slide becomes a visible placeholder, and the problem list says exactly what to fix.

Sign in to run the exercise

Reading is free. Writing code here needs an account so we have somewhere to keep your Gemini key and the +35 XP you are about to earn.