simplify macro logic

This commit is contained in:
Tom Kralidis
2020-04-20 17:40:46 -04:00
parent 0a2097713e
commit ed6c0d919d
+1 -3
View File
@@ -2,9 +2,7 @@
{# Optionally renders an img element, otherwise standard value or link rendering #}
{% macro render_item_value(v, width) -%}
{% set val = v | string | trim | lower %}
{% if val|length and
(val.endswith(".jpg") or val.endswith(".jpeg") or val.endswith(".png") or val.endswith(".gif") or val.endswith(".bmp"))
%}
{% if val|length and val.endswith(('.jpg', '.jpeg', '.png', '.gif', '.bmp')) %}
{# Ends with image extension: render img element with link to image #}
<a href="{{ val }}"><img src="{{ val }}" alt="" width="{{ width }}"/></a>
{% else %}