{#-
Module Aliases Component

Renders alias definitions for the module.
Uses safe rendering to handle missing or malformed alias data.
-#}

{% from 'macros/safe_macros.md.jinja2' import safe_section, safe_render, safe_for %}

{% set aliases = element.children | selectattr('element_type', 'equalto', 'alias') | list %}

{% if aliases %}
{% call safe_section("aliases") %}
## Aliases

{% call(current_item) safe_for(aliases, "*No aliases found.*") %}
{% call safe_render("alias", current_item) %}
### `{{ current_item.name }}` 🔗

:::{info} Alias
This is an alias of [`{{ current_item.metadata.alias_of | default('Unknown') }}`](#{{ current_item.metadata.alias_of.split('.')[-1] | lower | default('unknown') }})
:::

Defined at line {{ current_item.line_number | default('Unknown') }} in `{{ current_item.source_file | project_relative | default('Unknown') }}`

{% endcall %}
{% endcall %}
{% endcall %}
{% endif %}
