aboutsummaryrefslogtreecommitdiff
path: root/templates/shortcodes/img.html
diff options
context:
space:
mode:
authorJieiku2022-05-30 22:33:42 -0700
committerJieiku2022-05-30 22:33:42 -0700
commit9c1f02f9099b0da48c0bec7f23fa8c0566a331f3 (patch)
tree477e96531357223345fef18fb96383e40ddea7c5 /templates/shortcodes/img.html
parenta5a2e0ae482a5168781b4abf952885531bdc93cc (diff)
downloadabridge-9c1f02f9099b0da48c0bec7f23fa8c0566a331f3.tar.gz
abridge-9c1f02f9099b0da48c0bec7f23fa8c0566a331f3.tar.bz2
abridge-9c1f02f9099b0da48c0bec7f23fa8c0566a331f3.zip
Whitespace Cleanup, Fix Recent
Diffstat (limited to 'templates/shortcodes/img.html')
-rw-r--r--templates/shortcodes/img.html51
1 files changed, 27 insertions, 24 deletions
diff --git a/templates/shortcodes/img.html b/templates/shortcodes/img.html
index 94cb9fa..d003eeb 100644
--- a/templates/shortcodes/img.html
+++ b/templates/shortcodes/img.html
@@ -7,36 +7,39 @@
{% set figure_width = container_width - (40 * 2) %}
{% if path is starting_with("./") %}
- {% set relative_path = page.relative_path | split(pat="/") | slice(end=-1) | join(sep="/") %}
- {% set img_path = path | trim_start_matches(pat="./") %}
- {% set img_path = relative_path ~ "/" ~ img_path %}
+ {% set relative_path = page.relative_path | split(pat="/") | slice(end=-1) | join(sep="/") %}
+ {% set img_path = path | trim_start_matches(pat="./") %}
+ {% set img_path = relative_path ~ "/" ~ img_path %}
{% else %}
- {% set img_path = path %}
+ {% set img_path = path %}
{% endif %}
{% if path is not ending_with(".svg") %}
- {% set resize = true %}
- {% set image_quality = 90 %}
- {% if quality %}
- {% set image_quality = quality %}
- {% endif %}
- {% if extended_width_pct %}
- {% if extended_width_pct == -1 %}
- {# adjust extended width to container width #}
- {% set extended_width_pct = 0.042 %}
- {% endif %}
- {% set _width = config.extra.images.max_width - figure_width %}
- {% set extended_width = (extended_width_pct * _width + figure_width) | round | int %}
- {% if extended_width > config.extra.images.max_width %}
- {% set extended_width = config.extra.images.max_width %}
- {% endif %}
- {% set resized_image = resize_image(path=img_path, width=extended_width, op="fit_width", quality=image_quality) %}
- {% else %}
- {% set resized_image = resize_image(path=img_path, width=figure_width, op="fit_width", quality=image_quality) %}
+ {% set resize = true %}
+ {% set image_quality = 90 %}
+ {% if quality %}
+ {% set image_quality = quality %}
+ {% endif %}
+
+ {% if extended_width_pct %}
+
+ {% if extended_width_pct == -1 %}
+ {# adjust extended width to container width #}
+ {% set extended_width_pct = 0.042 %}
{% endif %}
+ {% set _width = config.extra.images.max_width - figure_width %}
+ {% set extended_width = (extended_width_pct * _width + figure_width) | round | int %}
+ {% if extended_width > config.extra.images.max_width %}
+ {% set extended_width = config.extra.images.max_width %}
+ {% endif %}
+ {% set resized_image = resize_image(path=img_path, width=extended_width, op="fit_width", quality=image_quality) %}
+
+ {% else %}
+ {% set resized_image = resize_image(path=img_path, width=figure_width, op="fit_width", quality=image_quality) %}
+ {% endif %}
{% endif %}
<figure>
- <img src="{% if resize %}{{ resized_image.url }}{% else %}{{ path }}{% endif %}" {% if alt %}alt="{{alt}}"{% endif %}/>
- {% if caption %}<figcaption>{{ caption | safe }}</figcaption>{% endif %}
+ <img src="{% if resize %}{{ resized_image.url }}{% else %}{{ path }}{% endif %}" {% if alt %}alt="{{alt}}"{% endif %}/>
+ {% if caption %}<figcaption>{{ caption | safe }}</figcaption>{% endif %}
</figure>