{#- The kit's patterns as macros (meridian-ui's README, "Patterns"; ruled 2026-10-02, spec/plugins-share-one-framework-in-code Q1; "Facts" from spec/plugin-pages-follow-their-role). Each writes exactly its pattern's markup, and none is required: a page written as plain kit HTML is as good. {% import "meridian/kit.html" as kit %} A value with `state`, `label`, `text` and the like is read by attribute or key alike, so a dataclass or a dict will do. -#} {%- macro _sentence(text) -%}{{ text }}{% if text and text[-1] not in ".!?" %}.{% endif %}{%- endmacro -%} {#- The plugin's status for the head: `s.state` (ok, busy, warn or error), `s.label`, and `s.detail`, `s.at` and `s.at_label` where it has them. -#} {%- macro status(s) -%} {%- set at = om_moment(s.at) if s.at else ("", "") -%} {{- [_sentence(s.label), _sentence(s.detail) if s.detail else "", _sentence(s.at_label ~ " " ~ at[1]) if at[0] else ""]|select|join(" ") -}} {%- endmacro -%} {#- A one-button form posting to the page's own server with its token. -#} {%- macro action(path, said, kind="", fields={}, header="", icon="", label="") -%}
{%- for name, value in fields.items() %}{% endfor -%}
{%- endmacro -%} {#- What an action came to: `n.text`, `n.tone` (info, good, warn or bad) and `n.items`. -#} {%- macro notice(n) -%} {%- set tone = n.tone or "info" -%}
{{ n.text }} {%- if n["items"] %}{% endif -%}
{%- endmacro -%} {%- macro badge(label, tone="") -%} {{ label }} {%- endmacro -%} {#- Figures at the head of the content: each `label`, `value`, and `delta` with its `ink` where it has one. -#} {%- macro tiles(items) -%}
{%- for item in items %}
{{ item.label }}
{{ item.value }}
{%- if item.delta %}
{{ item.delta }}
{% endif -%}
{%- endfor %}
{%- endmacro -%} {#- A moment to read: in UTC to the minute, or a date as it is; none, the faint words given. -#} {%- macro when(moment, empty="not reported") -%} {%- set at = om_moment(moment) -%} {%- if at[0] -%} {%- else -%}{{ empty }}{%- endif -%} {%- endmacro -%} {%- macro _cell(column, row) -%} {%- set value = row[column.key] if column.key in row else "" -%} {%- if value in ("", none) -%}{% if column.blank %}{{ column.blank }}{% endif -%} {%- elif column.type == "code" -%}{{ value }} {%- elif column.type == "badge" -%}{{ badge(value, row[column.tone.field] if column.tone and column.tone.field in row else "") }} {%- elif column.strong -%}{{ value }} {%- else -%}{{ value }}{%- endif -%} {%- if column.hint and row[column.hint] %} {{ row[column.hint] }}{% endif -%} {%- endmacro -%} {#- Records in an om-grid, its columns and rows as JSON, and the same table beside them for a browser without the kit. -#} {%- macro grid(id, columns, rows, key, caption="", empty="", narrow="cards") -%}
{%- for column in columns %}{{ column.label }}{% endfor -%} {%- for row in rows %} {% for column in columns %}{{ _cell(column, row) }}{% endfor %} {%- else %} {%- endfor %}
{{ empty }}
{%- endmacro -%} {#- The whole content for somebody who may read none of the accounts the plugin reaches: `what`, the plugin's sentence saying what it does. -#} {%- macro nothing_here(what) -%}

Nothing here for you

{{ _sentence(what)[:-1] }}, and you may read none of them. If you should, ask whoever administers this deployment.

{%- endmacro -%} {%- macro empty(title, text="") -%}
{{ title }}{% if text %}

{{ text }}

{% endif %}
{%- endmacro -%} {#- Facts: a section's label, value and note on one line, the whole a click away. Each row's `label`, `value`, and `note` and `detail` where it has them; `name` keeps one detail open. -#} {%- macro facts(rows, name="facts") -%} {%- for row in rows %} {%- endfor %}
{{ row.label }}{{ row.value }}{% if row.note %} {{ row.note }}{% endif %}
…

{{ row.label }}

{{ row.label }}
{{ row.value }}
{% if row.note %}

{{ row.note }}

{% endif %}{% if row.detail %}

{{ row.detail }}

{% endif %}
{%- endmacro -%}