feat: add full-width image option to shortcodes

Closes #85
This commit is contained in:
welpo
2023-07-05 02:43:07 +02:00
parent 8c5f30556a
commit fd50204e32
9 changed files with 89 additions and 4 deletions

View File

@@ -1,2 +1,8 @@
{% set meta = get_image_metadata(path=src, allow_missing=true) %}
{% if full_width | default(value=false) %}
<div class="full-width">
{% endif %}
<img class="dimmable-image" src="{{ get_url(path=src) }}" {% if alt %}alt="{{ alt }}" {% endif %} {% if meta.width %}width="{{ meta.width }}" {% endif %} {% if meta.height %}height="{{ meta.height }}" {% endif %}/>
{% if full_width | default(value=false) %}
</div>
{% endif %}

View File

@@ -1,4 +1,10 @@
{% set light_meta = get_image_metadata(path=light_src, allow_missing=true) %}
{% set dark_meta = get_image_metadata(path=dark_src, allow_missing=true) %}
{% if full_width | default(value=false) %}
<div class="full-width">
{% endif %}
<img src="{{ get_url(path=light_src) }}" {% if alt %}alt="{{ alt }}" {% endif %} {% if light_meta.width %}width="{{ light_meta.width }}" {% endif %} {% if light_meta.height %}height="{{ light_meta.height }}" {% endif %} class="img-light">
<img src="{{ get_url(path=dark_src) }}" {% if alt %}alt="{{ alt }}" {% endif %} {% if dark_meta.width %}width="{{ dark_meta.width }}" {% endif %} {% if dark_meta.height %}height="{{ dark_meta.height }}" {% endif %} class="img-dark">
{% if full_width | default(value=false) %}
</div>
{% endif %}

View File

@@ -0,0 +1,4 @@
{% set meta = get_image_metadata(path=src, allow_missing=true) %}
<div class="full-width">
<img {% if src %}src="{{ get_url(path=src) }}" {% endif %} {% if alt %}alt="{{ alt }}" {% endif %} {% if meta.width %}width="{{ meta.width }}" {% endif %} {% if meta.height %}height="{{ meta.height }}" {% endif %}/>
</div>

View File

@@ -1,2 +1,8 @@
{% set meta = get_image_metadata(path=src, allow_missing=true) %}
{% if full_width | default(value=false) %}
<div class="full-width">
{% endif %}
<img class="invertible-image" {% if src %}src="{{ get_url(path=src) }}" {% endif %} {% if alt %}alt="{{ alt }}" {% endif %} {% if meta.width %}width="{{ meta.width }}" {% endif %} {% if meta.height %}height="{{ meta.height }}" {% endif %}/>
{% if full_width | default(value=false) %}
</div>
{% endif %}