From 1f2de30c609b0097e48e234cab909ec65a08c2ff Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Tue, 19 Aug 2025 10:03:50 -0700 Subject: [PATCH] Pass the list of images generated by the figures/image template to the partials that actually render the figure This template was doing a bunch of work to look up resources, but then discarding it and passing just the "name" to the partial. Instead, pass the $imgs list. Add a "global-asset-src" parameter to the shortcode that takes an asset path. Update the termlite submodule commit. --- layouts/shortcodes/figures/image.html | 24 +++++++++++++++++++----- themes/termlite | 2 +- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/layouts/shortcodes/figures/image.html b/layouts/shortcodes/figures/image.html index 50cb620..6811601 100644 --- a/layouts/shortcodes/figures/image.html +++ b/layouts/shortcodes/figures/image.html @@ -1,12 +1,14 @@ {{- $imgs := slice -}} -{{- $shouldResize := .Get "shouldResize" | default true -}} - {{- if .Get "name" -}} {{- $imgs = $imgs | append (.Page.Resources.GetMatch (.Get "name")) -}} {{- else if .Get "names" -}} {{- range (split (.Get "names") ",") -}} {{- $imgs = $imgs | append ($.Page.Resources.GetMatch .) -}} {{- end -}} +{{- else if .Get "global-asset-src" -}} + {{- with resources.Get (.Get "global-asset-src") -}} + {{- $imgs = $imgs | append . -}} + {{- end -}} {{- else -}} {{ errorf "Missing name or names parameter to figures/image" }} {{- end -}} @@ -16,14 +18,26 @@ {{- end -}} {{- $class := .Get "class" -}} +{{- $shouldResize := .Get "shouldResize" | default true -}} {{- $shouldShowTitle := (.Get "shouldShowTitle") | default true -}} +{{- $style := .Get "style" | default "included" -}} {{- $size := .Get "size" | default "full" -}} -{{ if in (slice "full" "main") $size }} +{{ if eq $style "inline" }} + {{ + partial "page/figures/inline-image.html" (dict + "page" $.Page + "name" (.Get "name") + "size" $size + "class" $class + "shouldShowTitle" $shouldShowTitle + ) + }} +{{ else if in (slice "full" "main") $size }} {{ partial "page/figures/fullwidth.html" (dict "page" $.Page - "name" (.Get "name") + "images" $imgs "size" $size "class" $class "shouldShowTitle" $shouldShowTitle @@ -33,7 +47,7 @@ {{ partial "page/figures/small.html" (dict "page" $.Page - "name" (.Get "name") + "images" $imgs "size" $size "class" $class "shouldShowTitle" $shouldShowTitle diff --git a/themes/termlite b/themes/termlite index a395d26..3248ac5 160000 --- a/themes/termlite +++ b/themes/termlite @@ -1 +1 @@ -Subproject commit a395d26bc4fa025335489845ed8c0dd988b4252d +Subproject commit 3248ac51d13b1ecf221f3c9ba453cb3da30b9bf3