{# Render Method Macro Renders a single method as an information-rich collapsible card. Shows: icon, name, params, return type, description, full details on expand. Usage: {% from 'api-reference/partials/_macros/render-method.html' import render_method %} {{ render_method(method) }} Args: method: Method DocElement to render (required) #} {% macro render_method(method) %} {# Use normalized param_count and return_type filters #} {% set method_param_count = method | param_count %} {% set method_return_type = method | return_type %} {% set is_async = method.metadata.is_async | default(false) %} {% set is_property = method.metadata.is_property | default(false) %} {% set is_classmethod = method.metadata.is_classmethod | default(false) %} {% set is_staticmethod = method.metadata.is_staticmethod | default(false) %} {% set is_private = method.name.startswith('_') %} {% set first_sentence = ((method.description or '') | truncate(80, True, '…')) %}
{# Status dot indicator #} {# Name + return type #}
{{ method.name }} {# Parameter count badge (skip for properties) #} {% if not is_property %} {{ method_param_count }} {% endif %} {# Return type with arrow #} {{ method_return_type | truncate(20, True, '…') }} {# Toggle indicator #} {{ icon('caret-down', size=14) }}
{# Description preview #} {% if first_sentence %} {{ first_sentence }} {% endif %}
{# Inline badges #}
{% if is_async %}async{% endif %} {% if is_property %}property{% endif %} {% if is_classmethod %}classmethod{% endif %} {% if is_staticmethod %}staticmethod{% endif %}
{# Full signature #} {% set element = method %} {% include 'api-reference/partials/signature.html' %} {# Full description (markdown rendered) #} {% if method.description %}
{{ method.description | markdownify | safe }}
{% endif %} {# Parameters, Returns, Raises #} {% set element = method %} {% include 'api-reference/partials/parameters-table.html' %} {% set element = method %} {% include 'api-reference/partials/returns-section.html' %} {% set element = method %} {% include 'api-reference/partials/raises-list.html' %}
{% endmacro %}