{%- macro code(content, language, dedent) -%}

        {%- if dedent -%}
            {%- set ns = namespace(skip=none) -%}
            {%- for line in content.splitlines() -%}
                {%- if ns.skip is none and loop.index < 3 and line -%}
                    {%- set ns.skip = line|length - line.lstrip(" ")|length -%}
                {%- endif -%}
                {{ line[ns.skip or 0:] ~ "\n" if line or not loop.first}}
            {%- endfor -%}
        {%- else -%}
            {{ content }}
        {%- endif -%}
    
{%- endmacro %} {%- macro chart(content, type, data, labels) -%} {# Documentation: https://chartist.dev/ #} {%- if data -%} {%- set id = ui.util.id() -%} {%- set payload = {"series": data or [], "labels": labels or []} -%}
{{ content }}
{%- else -%}
{{ _("No data provided") }}
{%- endif %} {%- endmacro %} {%- macro table_head(content) -%} {{ content }} {%- endmacro %} {%- macro table_body(content) -%} {{ content }} {%- endmacro %} {%- macro table_row(content) -%} {{ content }} {%- endmacro %} {%- macro table_cell(content, header) -%} {{ ui.util.tag(content, "th" if header else "td", **kwargs) }} {%- endmacro %} {%- macro datetime(dt, date_format, with_hours, relative, empty="") -%} {%- endmacro %} {%- macro divider(content) -%}
{%- endmacro %} {%- macro heading(content, level=1) -%} {{ ui.util.tag(content, "h" ~ level, **kwargs) }} {%- endmacro %} {%- macro image(src, alt, height, width) -%} {%- set defaults = {"src": src, "alt": alt, "height": height, "width": width} -%} {%- if not alt -%} {%- do defaults.update({"role": "presentation"}) -%} {%- endif -%} {%- endmacro %} {%- macro link(content, href, blank) -%} {%- set defaults = {"target": "_blank", "rel": "noopener"} if blank else {} -%} {{ content }} {%- endmacro %} {%- macro video(src, controls, autoplay) -%} {%- endmacro %} {%- macro confirm_modal(content, title, id, form_id, cancel_label, confirm_label, href) -%} {%- if not form_id -%} {% set form_id = ui.util.id() %} {{ ui.form(method="POST", attrs={"id": form_id}, action=href) }} {%- endif %} {%- set close_button = ui.modal_close_handle(cancel_label or _("Close"), id=id, style="secondary") %} {%- set confirm_button = ui.modal_close_handle(confirm_label or _("Confirm"), id=id, type="submit", attrs={"form": form_id}) %} {{ ui.modal(content, title=title or _("Confirm"), id=id, footer=close_button ~ confirm_button, **kwargs) }} {%- endmacro %} {%- macro form(content, method, action, enctype, include_csrf=true) -%} {{ ui.form_start(method=method, action=action, enctype=enctype, **kwargs) }} {{ h.csrf_input() if include_csrf and method and method|upper != "GET" }} {{ content }} {{ ui.form_end() }} {%- endmacro %} {%- macro form_start(content, method, action, enctype) -%}
{{ content }} {%- endmacro %} {%- macro form_end(content) -%} {%- do kwargs -%} {{ content }}
{%- endmacro %} {%- macro form_actions(content) -%}
{{ content }}
{%- endmacro %} {%- macro hidden_input(name, value) -%} {%- endmacro %} {%- macro fieldset(content, legend, description) -%}
{%- if legend -%} {{ legend }} {{ description }} {%- endif %} {{ content }}
{%- endmacro %} {%- macro select_option(content, value, selected) -%} {%- endmacro %} {%- macro subtitle_item(content, initial) -%} {%- do kwargs -%} {{ content }} {%- if not initial %} {{ g.template_title_delimiter }} {% endif %} {%- endmacro %} {%- macro search_advanced_controls() -%} {%- do kwargs -%} {%- endmacro %} {%- macro autocomplete(content, source, options, allow_multiple, allow_new, selected, min_chars, debounce, joined, separator, id_key, label_key) -%} {%- set selected = [selected] if selected and selected is string else selected -%} {%- set container_id = ui.util.id() if 1 or allow_multiple else undefined -%} {%- set defaults = { "data-module": "theming-autocomplete", "data-module-allow-new": "true" if allow_new else "false", "data-module-joined": "true" if joined else "false", "data-module-allow-multiple": "true" if allow_multiple else "false", "data-module-source": source, "data-module-container-id": container_id, "data-module-debounce": debounce, "data-module-min-chars": min_chars, "data-module-separator": separator, "data-module-id-key": id_key, "data-module-label-key": label_key, "data-module-options": options and options|tojson, "data-module-selected": selected and selected|tojson, } -%} {%- do ui.util.augment_attrs(kwargs, defaults) -%}
{%- call ui.util.call(ui.input, **kwargs) -%} {{ content }} {%- if container_id -%}
{%- endif %} {%- endcall %}
{%- endmacro %}