From 9c1f02f9099b0da48c0bec7f23fa8c0566a331f3 Mon Sep 17 00:00:00 2001 From: Jieiku Date: Mon, 30 May 2022 22:33:42 -0700 Subject: Whitespace Cleanup, Fix Recent --- templates/shortcodes/img.html | 51 +++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'templates/shortcodes') 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 %}
- - {% if caption %}
{{ caption | safe }}
{% endif %} + + {% if caption %}
{{ caption | safe }}
{% endif %}
-- cgit v1.3.1