{# Shared template macros. #} {# Per-figure debug line: renders only when GLIDERTEST_REPORT_DEBUG is set (figdbg() then returns a non-empty string). Guarding on figdbg() rather than a debug flag means the macro needs no `with context` and is a true no-op when off. #} {% macro dbg(b64, slot) %}{% set d = figdbg(b64) %}{% if d %}
slot: {{ slot }} | {{ d }}
{% endif %}{% endmacro %} {# Render one resolved manifest panel. `|safe` appears once, gated by kind, so figure payloads (base64) are always escaped into an image src and only html/table markup is emitted raw — the autoescape boundary is this one branch. #} {% macro panel(p, slot=None) %} {%- set sl = slot or p.slot %} {%- if p.is_stub %}

{{ p.caption or p.id }} — {{ p.stub_reason }}

{%- elif p.kind == "figure" %}
{%- if p.caption %}
{{ p.caption }}
{% endif %} {{ p.caption or p.id }} {%- set src = figsource(p.payload) %}{% if src %}
source: glidertest/{% if ".py:" not in src %}plots.py:{% endif %}{{ src }}
{% endif %} {{- dbg(p.payload, sl) }}
{%- else %}{# html | table #} {# One full-width flex item so the panel's caption, headings and tables flow as normal blocks instead of becoming side-by-side flex items of the .fig-row. #}
{{ p.payload | safe }}
{%- endif %} {% endmacro %} {# Stacked QC distribution bar: segments are {key, width, title}; colour comes from the qc-seg-* class. The width % is the one allowed inline style. small=True selects the dashed diagnostics bar. #} {% macro dist_bar(segments, small=False) %}{% if segments %}
{% for s in segments %}
{% endfor %}
{% endif %}{% endmacro %} {# Expandable per-row attribute dropdown: the attrs dict minus those already shown as columns (the caller excludes them). Autoescape handles values; urlize linkifies URLs. Em dash when empty. #} {% macro attrs_details(attrs) %}{% if attrs %}
{{ attrs|length }} attrs{% for k, val in attrs.items() %}{% endfor %}
{{ k }}{{ val|urlize }}
{% else %}—{% endif %}{% endmacro %} {# The one place a section number + title is formatted: "(1) Overview", or just "Overview" when there is no number. Every page — the manifest-driven bodies AND the hand-authored casts/sections/timeseries listing pages — renders headings and jump-nav links through this, so the numbering style is chosen once. #} {% macro heading_text(number, title) %}{% if number %}({{ number }}) {% endif %}{{ title }}{% endmacro %} {# Render a resolved report body: the jump-nav plus every numbered section and its panels. Shared by every manifest-driven page (cast, section, and later timeseries / index) so section numbering, anchors and layout live in one place. Section numbers show as "(1) Title"; a section in `section_columns` stacks its trailing panels (from that index) into a right-hand fig-col. #} {% macro report_body(report, section_columns={}, center_sections=[]) %}
{% for s in report.sections %}{{ heading_text(s.number, s.title) }} {% endfor %}
{% for s in report.sections %}

{{ heading_text(s.number, s.title) }}

{% if s.intro %}
{{ s.intro | safe }}
{% endif %} {% set split = section_columns.get(s.id) %}
{# split only takes the fig-col path when the section actually has a panel at that index; a section whose panels dropped below it falls back to a flat row. #} {% if split is not none and s.panels|length > split %} {% for p in s.panels %}{% if loop.index0 < split %}{{ panel(p) }}{% endif %}{% endfor %}
{% for p in s.panels %}{% if loop.index0 >= split %}{{ panel(p, "full") }}{% endif %}{% endfor %}
{% else %} {% for p in s.panels %}{{ panel(p) }}{% endfor %} {% endif %}
{% endfor %} {% if not report.sections %}

No plottable data for this selection.

{% endif %} {% if report.not_applicable %}

Not applicable to this {% if report.sections %}selection{% else %}deployment{% endif %}: {{ report.not_applicable | join(", ") }}.

{% endif %} {% endmacro %}