{# ================================================================================ Track Helper Macros (Kida-Native) ================================================================================ Reusable PRESENTATIONAL macros for the data-file track pillar page. WHY NO get_track_id()/get_track() VALUE-RETURNING MACROS: Kida `{% def %}` emits TEXT, not Python objects. A macro that "returns" a track id or dict via `{{ track_id }}` yields rendered whitespace, not a usable value. Resolve track state INLINE in the consuming template with `{% let %}` + null-coalescing instead: {% let track_id = params?.track_id ?? page?.slug ?? '' %} {% let tracks = site?.data?.tracks ?? {} %} {% let track = tracks[track_id] if (track_id and track_id in tracks) else none %} {% let track_items = track?.items ?? [] %} This file therefore exports HTML-emitting macros only. They are the shared visual vocabulary consumed by tracks/single.html and the CSS/JS waves (see the DOM contract documented at the top of tracks/single.html). EXPORTS: track_progress_indicator(total_steps, current_step) — stepped progress rail track_section_block(item_page, index, is_last) — one embedded lesson track_section_missing(item_slug, index) — placeholder for a slug with no page USAGE: {% from 'partials/track-helpers.html' import track_progress_indicator, track_section_block, track_section_missing %} ================================================================================ #} {% from "chirpui/badge.html" import badge %} {# ============================================================================= PROGRESS INDICATOR Stepped rail showing how many sections a track contains. `current_step` marks the section a reader has reached (defaults to the first). DOM contract: .chirp-theme-track-progress[role="progressbar"] ============================================================================= #} {% def track_progress_indicator(total_steps, current_step=1) %} {% let total = total_steps ?? 0 %} {% if total > 0 %}
{{ item_lede }}
{% end %}This lesson has no inline content yet.
{{ badge('Open full page', variant='primary', icon='arrow-right', href=item_href) }}No page matches {{ item_slug }}.