{# Shared pieces. Markers and help text come from the spec field catalog (UI_WIREFRAMES design principles). #}
{% macro marker(path) -%}
{%- set f = field(path) -%}
{%- if f and f.tag == "mandatory" %} *
{%- elif f and f.tag == "conditional" %} *
{%- endif -%}
{%- endmacro %}
{% macro help(path) -%}
{%- set f = field(path) -%}
{%- if f %}{{ f.description | md }}{% if f.tag == "optional" and f.default_text %} · optional, default {{ f.default_text }}{% elif f.tag == "conditional" %} · required {{ f.condition }}{% endif %}{% endif -%}
{%- endmacro %}
{% macro result_box(r) -%}
{% if r %}
{% if r.ok %}✔{% elif r.ok is sameas false %}✖{% endif %} {{ r.title }}
{% if r.lines %}
{% for line in r.lines %}- {{ line }}
{% endfor %}
{% endif %}
{% if r.checks %}
| check | status | detail |
{% for c in r.checks %}| {{ c.name }} | {{ c.status }} | {{ c.message }} |
{% endfor %}
{% endif %}
{% if r.table and r.table.rows %}
{% for c in r.table.columns %}| {{ c }} | {% endfor %}
{% for row in r.table.rows %}{% for v in row %}| {{ cell(v) }} | {% endfor %}
{% endfor %}
{% endif %}
{% endif %}
{%- endmacro %}
{% macro status_of(code) -%}
{{ '● ok' if code == 0 else '✖ exit ' ~ code }}
{%- endmacro %}