Don't render empty <dl> tags

This commit is contained in:
welpo 2025-04-04 23:56:35 +02:00
parent 2c578bd15b
commit 0862b2b31c
No known key found for this signature in database
GPG key ID: A2F978CF4EC1F5A6

View file

@ -56,15 +56,18 @@
</div> </div>
{# additional properties #} {# additional properties #}
<dl> {% set dl_started = false %}
{% for key, value in hcard %} {% for key, value in hcard %}
{# exclude all properties previously displayed #} {% if key not in ['enable', 'with_mail', 'with_social_links', 'homepage', 'full_name', 'avatar', 'biography', 'p_nickname'] %}
{% if key not in ['enable', 'with_mail', 'with_social_links', 'homepage', 'full_name', 'avatar', 'biography', 'p_nickname'] %} {% if not dl_started %}
<dl>
{% set dl_started = true %}
{% endif %}
<dt>{{ key | replace(from="p_", to="") | replace(from="u_", to="") | replace(from="dt_", to="") | replace(from="_", to=" ") | capitalize }}</dt> <dt>{{ key | replace(from="p_", to="") | replace(from="u_", to="") | replace(from="dt_", to="") | replace(from="_", to=" ") | capitalize }}</dt>
<dd class="{{ key | replace(from="_", to="-") }}">{{ value }}</dd> <dd class="{{ key | replace(from="_", to="-") }}">{{ value }}</dd>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</dl> {% if dl_started %}
</dl>
</div> {% endif %}
{% endif %} {% endif %}