{#
  Reference Documentation Metadata Box

  Unified metadata display component for all reference documentation types.
  Displays key-value pairs in a styled box (source file, module, endpoint, etc.)

  Parameters:
    - metadata: Dictionary of metadata items to display
                Format: { 'Label': 'value', 'Source': 'path/to/file.py' }
                Only items with non-empty values will be displayed

  Usage:
    {% include 'partials/reference-metadata.html' with {
      metadata: {
        'Module': page.metadata.get('module_path', ''),
        'Source': page.metadata.get('source_file', '')
      }
    } %}

  Example Output:
    ┌─────────────────────────┐
    │ Module: bengal.core     │
    │ Source: bengal/core.py  │
    └─────────────────────────┘
#}

{% if metadata %}
{# Filter out empty values #}
{% set filtered_metadata = {} %}
{% for label, value in metadata.items() %}
  {% if value %}
    {% set _ = filtered_metadata.update({label: value}) %}
  {% endif %}
{% endfor %}

{# Only render box if we have data to show #}
{% if filtered_metadata %}
<div class="reference-metadata">
  {% for label, value in filtered_metadata.items() %}
  <div class="reference-metadata-item">
    <strong>{{ label }}:</strong>
    <code>{{ value }}</code>
  </div>
  {% endfor %}
</div>
{% endif %}
{% endif %}
