{# Shared template macros. Import with: {% import "_macros.html" as m %} #} {# Figure-debug line (OCEANARRAY_REPORT_DEBUG=1): the display slot this template chose vs the render-side figsize/png, so a figsize≠slot mismatch is visible. Renders nothing unless debug capture recorded this figure (figdbg is a Jinja global returning "" when off), so it is a no-op in normal builds. #} {% macro dbg(b64, slot) %}{% set d = figdbg(b64) %}{% if d %}
slot: {{ slot }} | {{ d }}
{% endif %}{% endmacro %} {# Resolved-panel wrapper (section-manifest port): the single place a figure's "fig slot-*" class is emitted. Branches on the panel kind so |safe applies only to authored table/html markup — a "figure" payload is a base64 PNG escaped into an img src, and captions are plain text emitted escaped (they are a data field that will become user-editable via YAML, so they are never trusted markup). Captions render *above* the figure. A stub (payload is None) renders its reason as a .warn line so an applicable-but-unavailable panel is visible, not hidden. The collapse toggle is preserved for every figure. #} {# Full report body for a resolved report: the generated jump-nav, the numbered section loop, the not-applicable footer, the footer line, and the top-link script — one definition shared by every manifest-ported page. Section numbers render in parentheses, "(1) Files"; the "Jump to: " label comes from the .jump-nav::before CSS, so it is NOT written here (writing it duplicated the label). `na_scope` is the noun for the not-applicable line ("deployment" / "instrument"); `generated`/`proc_machine` are passed in because macros do not see the calling template's context. #} {% macro report_body(report, na_scope, generated, cruise, yaml_path="") %} {% for sec in report.sections %} {% if sec.number %}({{ sec.number }}) {% endif %}{{ sec.title }} {%- if sec.intro %}

{{ sec.intro }}

{%- endif %} {%- if sec.layout == "row" %} {{ panel_row(sec) }} {%- else %} {%- for p in sec.panels %} {{ panel(p) }} {%- endfor %} {%- endif %} {% endfor %} {% if report.not_applicable %}

Not applicable to this {{ na_scope }}: {{ report.not_applicable | join(", ") }}.

{% endif %} {% endmacro %} {% macro panel(p, bare=false) %} {%- if p.is_stub %}

{{ p.stub_reason }}

{%- elif p.kind == "figure" %} {% if p.caption %}

{{ p.caption }}

{% endif -%}
show / hide {{ p.id }} {{- dbg(p.payload, ("slot-" ~ p.slot) if p.slot else "full-canvas") }}
{%- else %} {% if p.caption %}

{{ p.caption }}

{% endif -%} {{ p.payload | safe }} {%- endif %} {%- endmacro %} {# Row layout for a section (Section.layout="row"): each panel sits in a flex cell sized by its slot (slot-half → ~50%, slot-full → 100% → wraps to its own line). The figure inside the cell is rendered *bare* (class="fig", 100% of the cell) so the cell — not the img — controls the display width. #} {% macro panel_row(sec) %}
{%- for p in sec.panels %}
{{- panel(p, bare=true) }}
{%- endfor %}
{% endmacro %}