{#
macros/layout.html - Layout component macros for APEP.
Only macros with real logic live here. Pure layout is handled by custom tags in custom_tags.css.
Macros:
split_group(items)
Author: sora7672
#}
{% from "apep/macros/helper.html" import alert %}
{#
Renders a horizontal split layout using the split-group and split custom tags.
Each item occupies an equal share of the available width.
Dividers are handled via pos-divider on , which maps directly to
base_custom_tags.css. One position per split item.
@param items {list} - list of {content, pos_divider} dicts. Required.
content {string} - pre-rendered HTML string (use {% set %} block pattern).
pos_divider {string} - "right" | "left" | "top" | "bottom" | "none". Default "none".
@param gap {string} - "sm" | "md" | "lg". Default "md".
#}
{% macro split_group(items, gap="md") %}
{% if not items %}
{{ alert("split_group: items is required", "Pass a non-empty list of {content, pos_divider} dicts.") }}
{% elif gap not in ["sm", "md", "lg"] %}
{{ alert("split_group: invalid gap \"" ~ gap ~ "\"", "Allowed values: \"sm\", \"md\", \"lg\".") }}
{% else %}
{% for item in items %}
{% set _pos_divider = item.pos_divider if item.pos_divider is defined else "none" %}
{% if _pos_divider not in ["right", "left", "top", "bottom", "none"] %}
{{ alert("split_group: invalid pos_divider \"" ~ _pos_divider ~ "\" on item " ~ loop.index, "Allowed values: \"right\", \"left\", \"top\", \"bottom\", \"none\".") }}
{% else %}
{{ item.content | safe }}
{% endif %}
{% endfor %}
{% endif %}
{% endmacro %}