{# ================================================================================ Autodoc Examples Partial (Kida-Native) ================================================================================ Renders code examples for API elements and CLI commands. TEMPLATE VARIABLES: - element: DocElement with examples list - examples: Override list of examples (optional) - language: str, default based on element type KIDA FEATURES USED: - Optional chaining (?.) for safe attribute access - Null coalescing (??) for defaults - {% let %} for template-scoped caching - {% match %} for type dispatch ================================================================================ #} {% let elem_type = element?.element_type ?? 'module', is_cli = elem_type in ['command', 'command-group'], default_lang = 'bash' if is_cli else 'python', lang = language ?? default_lang, examples_list = examples ?? element?.examples ?? [] %} {% if examples_list | length > 0 %}

Examples

{% for example in examples_list %}
{% if example is mapping and example.title %}

{{ example.title }}

{{ example.code }}
{% elif example is mapping and example.code %}
{{ example.code }}
{% else %}
{{ example }}
{% end %}
{% end %}
{% end %}