aboutsummaryrefslogtreecommitdiff
path: root/templates/shortcodes/img.html
diff options
context:
space:
mode:
authorJieiku2023-09-20 00:25:21 -0700
committerJieiku2023-09-20 00:25:21 -0700
commit08f406c44c861a914c8b63fab454250f8a4c4b36 (patch)
treea636aa28e60b6b110138b378996ee2523c1e7bf0 /templates/shortcodes/img.html
parentb1be7cc6de3737ebbb1ae1485652e32a2888dbfc (diff)
downloadabridge-08f406c44c861a914c8b63fab454250f8a4c4b36.tar.gz
abridge-08f406c44c861a914c8b63fab454250f8a4c4b36.tar.bz2
abridge-08f406c44c861a914c8b63fab454250f8a4c4b36.zip
refactor nav, blocks, macros, templates. fix image shortcodes
Diffstat (limited to 'templates/shortcodes/img.html')
-rw-r--r--templates/shortcodes/img.html9
1 files changed, 5 insertions, 4 deletions
diff --git a/templates/shortcodes/img.html b/templates/shortcodes/img.html
index f5754ce..ac3ba6b 100644
--- a/templates/shortcodes/img.html
+++ b/templates/shortcodes/img.html
@@ -1,15 +1,16 @@
{%- set img = src | split(pat="/") | last %}
{%- set dirtest = src | trim_start_matches(pat="./") %}
{%- if dirtest is containing("/") %} {%- set reldir = true %} {%- endif %}
+{%- if page.path %}{%- set pagepath = page.path %}{%- elif section.path %}{%- set pagepath = section.path %}{%- endif %}
{%- if src is starting_with("./") and reldir %} {# Relative Path #}
{%- set path = src | trim_start_matches(pat="./") | split(pat="/") | slice(end=-1) | join(sep="/") | trim_start_matches(pat="/") %}
{%- set path = path ~ "/" %}
{%- if not w or not h %}
{%- if lang != config.default_language %}
- {%- set metapath = page.path ~ path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %}
+ {%- set metapath = pagepath ~ path ~ img | replace(from=pagepath | truncate(length=4, end=""), to="/") %}
{%- else %}
- {%- set metapath = page.path ~ path ~ img %}
+ {%- set metapath = pagepath ~ path ~ img %}
{%- endif %}
{%- set meta = get_image_metadata(path=metapath) %}
{%- set w = meta.width %}
@@ -30,9 +31,9 @@
{%- set path = "" %}
{%- if not w or not h %}
{%- if lang != config.default_language %}
- {%- set metapath = page.path ~ img | replace(from=page.path | truncate(length=4, end=""), to="/") %}
+ {%- set metapath = pagepath ~ img | replace(from=pagepath | truncate(length=4, end=""), to="/") %}
{%- else %}
- {%- set metapath = page.path ~ img %}
+ {%- set metapath = pagepath ~ img %}
{%- endif %}
{%- set meta = get_image_metadata(path=metapath) %}
{%- set w = meta.width %}