{# Pieces shared by every wiki template. Import with: {% import "macros.html" as ui %} #} {# Attributes of a link that opens a page inside the content panel (htmx) and updates the URL. #} {% macro nav_url(url) -%} href="{{ url }}" hx-get="{{ url }}" hx-target="#content" hx-push-url="true" {%- endmacro %} {# The same, for the wiki page of an entity. #} {% macro nav(path) -%} {{ nav_url("/wiki/" ~ path) }} {%- endmacro %} {# Icon of an entity role: folder/file emoji for packages and modules, colored symbol for the rest. #} {% macro icon(role, symbol="") -%} {{ symbol }} {%- endmacro %} {# Header of a graph view page. #} {% macro view_header(view, title, text) -%} {%- endmacro %} {# Drawing area of a graph view, with its bar on top (highlight, zoom, fit); static/graph.js draws data_url with the style of `view` and selects `focus` (an entity path) when given. #} {% macro view_canvas(view, data_url, focus="") -%}
{# Bar on top of the drawing: highlight, zoom and fit. #}

Loading…

{%- endmacro %} {# Collapsible section: a badge sitting on the top border; clicking the badge folds the section. kind: color of the section (an entity role or a docstring section kind). name: identifies the section (data-section); defaults to kind. divider: only the top line (entity pages) instead of a box (module pages). attrs: extra attributes of the
element (e.g. htmx loading). #} {% macro section(kind, label, count=none, name=none, divider=false, open=true, attrs="") -%} {%- set kind = kind | replace(' ', '-') -%}
{{ label }}{% if count is not none %} {{ count }}{% endif %} {{ caller() }}
{%- endmacro %}