diff options
| author | Jieiku | 2022-05-31 02:34:04 -0700 |
|---|---|---|
| committer | Jieiku | 2022-05-31 02:34:04 -0700 |
| commit | 49f72d5d171e84b2f2c18825dac6128b81fbd348 (patch) | |
| tree | efe0749370c0e1abcb46dc1e2e2ca30064aadb06 /templates/shortcodes | |
| parent | 4a9fa05e5aa4f977dba1a17b130fd6d6cd1f64ab (diff) | |
| download | abridge-49f72d5d171e84b2f2c18825dac6128b81fbd348.tar.gz abridge-49f72d5d171e84b2f2c18825dac6128b81fbd348.tar.bz2 abridge-49f72d5d171e84b2f2c18825dac6128b81fbd348.zip | |
Update Example Content
Diffstat (limited to 'templates/shortcodes')
| -rw-r--r-- | templates/shortcodes/imghover.html | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/templates/shortcodes/imghover.html b/templates/shortcodes/imghover.html index 8063378..4bda6da 100644 --- a/templates/shortcodes/imghover.html +++ b/templates/shortcodes/imghover.html @@ -34,14 +34,6 @@ {%- endfor %} -{%- if w and h and p %} - {%- set padding = h / w * p %} -{%- elif w and h %} - {%- set padding = h / w * 50 %} -{%- else %} - {%- set padding = 50 %} -{%- endif %} - <style> {%- for source in src %} @@ -67,6 +59,22 @@ {%- set sourcepath = source | split(pat="/") | last %} {%- set sourcename = pathtype ~ sourcepath | split(pat=".") | first %} + {%- set sourcetype = pathtype ~ sourcepath | split(pat=".") | last %} + + {%- if w and h and p %} + {%- set padding = h / w * p %} + {%- elif w and h %} + {%- set padding = h / w * 50 %} + {%- elif p %} + {%- set metafile = page.path ~ path ~ sourcepath %} + {%- set meta = get_image_metadata(path=metafile) %} + {%- set padding = meta.height / meta.width * p %} + /* height={{meta.height}} width={{meta.width}} (THIS IS BACKWARDS!?) */ + {%- else %} + {%- set padding = 50 %} + {%- endif %} + + {%- if not loop.first %} #{{ sourcename | safe }}image { @@ -76,6 +84,7 @@ width: {{ p | default(value=50) }}%; height: 0; padding-top: {{ padding }}%; + } #{{ sourcename | safe }}image:hover { background-image: url('{{ path | safe }}{{ sourcepath | safe }}'); |
