{# Folders drawn inside folders, each by its last part with a count. One shape for a collection's documents and for what a pack contains, so the two read alike. Every fold starts closed unless the window's `folders` preference says open (Brian, 2026-11-04); `fold()` writes the attribute. #} {% macro fold() %}{% if folders_open(request) %} open{% endif %}{% endmacro %} {% macro folder_head(name, count) %}{{ icon("chevron-right") }}{{ icon("folder") }}{{ name }}{{ count }}{% endmacro %} {# A collection's branch, as `shown_tree` builds it for the pane. An unreadable document has no identifier to open, so it is not a link. #} {% macro branch(tree_branch, collection) %} {% for entry in tree_branch.entries %}
  • {% if entry.document_id %}{{ icon("file-text") }}{{ entry.title }}{% else %}{{ icon("file-text") }}{{ entry.title }}{% endif %}
  • {% endfor %} {% for child in tree_branch.children %}
  • {{ folder_head(child.name, child.count) }}
  • {% endfor %} {% endmacro %} {# A pack's folder of items: each marked by what it is, its name, and what there is to say of it beneath. #} {% macro contents(folder) %} {% set item_icons = {"paper": "file-text", "site": "globe", "address": "globe", "file": "file-text"} %} {% for item in folder.items %}
  • {{ icon(item_icons[item.kind]) }}
    {{ item.name }}{% if item.detail %}{{ item.detail }}{% endif %}
  • {% endfor %} {% for inner in folder.folders %}
  • {{ folder_head(inner.name, inner.count) }}
  • {% endfor %} {% endmacro %} {% macro section(shown) %}
    {{ icon("chevron-right") }}{{ icon(collection_icons.get(shown.kind, "folder")) }}{{ shown.heading }}
    {% endmacro %} {# A pack's buttons: its own page unless this is it, and uninstalling it. Buttons with a symbol, never a line of link text (Brian, 2026-11-04). #} {% macro pack_actions(pack, own_page=False) %}
    {% if not own_page %}{{ icon("arrow-up-right") }}{{ pack_own_page }}{% endif %} {{ icon("x") }}{{ uninstall_pack }}
    {% endmacro %} {% macro pack_body(pack) %} {% if pack.description %}

    {{ pack.description }}

    {% endif %} {% if pack.unread %}

    {{ pack.unread }}

    {% endif %} {% for shown in pack.sections %}{{ section(shown) }}{% endfor %} {% endmacro %} {# A pack as a card that opens on what it contains: on the corpus page and on the Packs page alike. #} {% macro pack_card(pack) %}
    {{ icon("chevron-right") }}{{ icon("package") }}{{ pack.name }}{{ pack.summary }}
    {{ pack_actions(pack) }} {{ pack_body(pack) }}
    {% endmacro %}