2
0
mirror of https://github.com/codl/forget synced 2024-12-12 16:41:05 +01:00
forget-cancellare-vecchi-toot/templates/lib/picture.html
2017-08-24 15:40:03 +02:00

19 lines
525 B
HTML

{% macro picture(st, basename, widths, formats, sizes=None, alt='') -%}
{% if not sizes %}
{% set sizes = '{}px'.format(widths[0]) %}
{% endif %}
<picture>
{%- for format in formats %}
<source type='image/{{format}}' sizes='{{sizes}}' srcset="
{%- for width in widths -%}
{{ st('{}-{}.{}'.format(basename, width, format)) }} {{width}}w,
{%- endfor -%}
"/>
{% endfor %}
<img src="{{ st('{}-{}.{}'.format(basename, widths[0], formats[-1])) }}" alt="{{alt}}" />
</picture>
{%- endmacro %}