wezm.net/v2/templates/shortcodes/figure.html

36 lines
1.3 KiB
HTML
Raw Permalink Normal View History

2023-03-20 00:21:13 +00:00
{% set figure_class = ["text-center"] %}
2022-04-19 20:48:54 +00:00
{% if border %}
2023-03-20 00:21:13 +00:00
{% set figure_class = figure_class | concat(with="figure-border") %}
2022-04-19 20:48:54 +00:00
{% endif %}
2023-03-20 00:21:13 +00:00
{% if pixelated %}
{% set figure_class = figure_class | concat(with="figure-pixelated") %}
{% endif %}
<figure class="{{ figure_class | join(sep=" ") }}">
2024-05-04 06:43:31 +00:00
{% if link is matching("^https?:") %}
<a href="{{ link }}">
{% else %}
2021-10-08 22:57:04 +00:00
<a href="{{ config.base_url }}/{{ link }}">
2024-05-04 06:43:31 +00:00
{% endif %}
2021-10-08 22:57:04 +00:00
{% if resize_width %}
{% set image = resize_image(path=image, width=resize_width, op="fit_width", quality=quality | default(value=75)) %}
2022-04-19 20:48:54 +00:00
{% if width %}
<img src="{{ image.url }}" width="{{ width }}" alt="{{ alt }}" />
{% else %}
<img src="{{ image.url }}" alt="{{ alt }}" />
{% endif %}
{% elif resize_height %}
{% set image = resize_image(path=image, height=resize_height, op="fit_height", quality=quality | default(value=75)) %}
{% if height %}
<img src="{{ image.url }}" style="max-height: {{ height }}px" alt="{{ alt }}" />
{% else %}
<img src="{{ image.url }}" alt="{{ alt }}" />
{% endif %}
2021-10-08 22:57:04 +00:00
{% elif width %}
<img src="{{ config.base_url }}/{{ image }}" width="{{ width }}" alt="{{ alt }}" />
{% else %}
2021-10-08 22:57:04 +00:00
<img src="{{ config.base_url }}/{{ image }}" alt="{{ alt }}" />
{% endif %}
2021-10-08 22:57:04 +00:00
</a>
2020-03-21 03:51:11 +00:00
<figcaption>{{ caption }}</figcaption>
</figure>