{% extends "base.html" %} {# ================================================================================ API Reference Module Template (Kida-Native) ================================================================================ Renders a Python module's API documentation using the unified autodoc skeleton. Extends base.html to inherit theme navigation, sidebars, and styling. TEMPLATE VARIABLES: - element: DocElement for the module (required) - page: PageContext proxy with title, metadata, tags, _path - config: Autodoc configuration - site: Site instance - section: Parent section (for navigation) KIDA FEATURES USED: - Optional chaining (?.) for safe attribute access - Null coalescing (??) for defaults - {% def %} macros for DRY component reuse - {% match %} for element type dispatch - {% let %} for template-scoped caching ================================================================================ #} {% from 'partials/navigation-components.html' import breadcrumbs, page_navigation, toc %} {% from 'autodoc/partials/_macros/class-member.html' import class_member %} {% from 'autodoc/partials/_macros/function-member.html' import function_member %} {% block content %} {# Template-scoped caching of computed values #} {% let element_children = element?.children ?? [] %} {% let classes = element_children | selectattr('element_type', 'eq', 'class') | list %} {% let functions = element_children | selectattr('element_type', 'eq', 'function') | list %} {% let page_tags = page?.tags ?? [] %} {# Three-column documentation layout #}
{# Left Sidebar: Navigation #} {# Main Content #}
{# Page Hero: Use direct macro call with explicit context #} {% from 'partials/page-hero.html' import hero_element %} {{ hero_element(element, page, config) }} {# Article Content - Unified autodoc skeleton #}
{# Optional member summary table (autosummary-style) #} {% set show_summary = config?.autodoc?.python?.show_member_summary ?? false %} {% if show_summary and (classes | length + functions | length) > 0 %}

Summary

{% for cls in classes %} {% end %} {% for func in functions %} {% end %}
NameTypeDescription
{{ cls.name }}class{{ (cls.description ?? '') | first_sentence }}
{{ func.name }}function{{ (func.description ?? '') | first_sentence }}
{% end %} {# Classes Section #} {% if classes | length > 0 %}

Classes

{% for cls in classes %} {{ class_member(cls, is_first=loop.first) }} {% end %}
{% end %} {# Functions Section #} {% if functions | length > 0 %}

Functions

{% for func in functions %} {{ function_member(func, is_first=loop.first) }} {% end %}
{% end %} {# Tags - with null-safe access #} {% if page_tags | length > 0 %} {% end %}
{# Page navigation (prev/next) at bottom - null-safe #} {% if page %} {{ page_navigation(page) }} {% end %}
{# Right Sidebar: Contextual Graph + TOC + Metadata #} {% include 'partials/docs-toc-sidebar.html' %}
{# Mobile sidebar toggle button #} {# Sidebar overlay for mobile #} {% end %}