2023-08-02 17:16:30 -07:00
|
|
|
{{- $imgs := slice -}}
|
|
|
|
{{- if .Get "name" -}}
|
|
|
|
{{- $imgs = $imgs | append (.Page.Resources.GetMatch (.Get "name")) -}}
|
|
|
|
{{- else if .Get "names" -}}
|
|
|
|
{{- range (split (.Get "names") ",") -}}
|
2023-08-02 17:30:28 -07:00
|
|
|
{{- $imgs = $imgs | append ($.Page.Resources.GetMatch .) -}}
|
2023-08-02 17:16:30 -07:00
|
|
|
{{- end -}}
|
2025-08-19 10:03:50 -07:00
|
|
|
{{- else if .Get "global-asset-src" -}}
|
|
|
|
{{- with resources.Get (.Get "global-asset-src") -}}
|
|
|
|
{{- $imgs = $imgs | append . -}}
|
|
|
|
{{- end -}}
|
2023-08-02 17:16:30 -07:00
|
|
|
{{- else -}}
|
|
|
|
{{ errorf "Missing name or names parameter to figures/image" }}
|
|
|
|
{{- end -}}
|
|
|
|
|
|
|
|
{{- if lt (len $imgs) 0 -}}
|
|
|
|
{{ errorf "No images found for name(s) parameter" }}
|
|
|
|
{{- end -}}
|
|
|
|
|
2024-12-31 09:39:46 -08:00
|
|
|
{{- $class := .Get "class" -}}
|
2025-08-19 10:03:50 -07:00
|
|
|
{{- $shouldResize := .Get "shouldResize" | default true -}}
|
2024-12-31 09:39:46 -08:00
|
|
|
{{- $shouldShowTitle := (.Get "shouldShowTitle") | default true -}}
|
2025-08-19 10:03:50 -07:00
|
|
|
{{- $style := .Get "style" | default "included" -}}
|
2024-11-25 09:52:22 -08:00
|
|
|
{{- $size := .Get "size" | default "full" -}}
|
2024-10-12 11:27:38 -07:00
|
|
|
|
2025-08-19 10:03:50 -07:00
|
|
|
{{ 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 }}
|
2024-11-25 09:52:22 -08:00
|
|
|
{{
|
|
|
|
partial "page/figures/fullwidth.html" (dict
|
|
|
|
"page" $.Page
|
2025-08-19 10:03:50 -07:00
|
|
|
"images" $imgs
|
2024-11-25 09:52:22 -08:00
|
|
|
"size" $size
|
2024-12-31 09:39:46 -08:00
|
|
|
"class" $class
|
|
|
|
"shouldShowTitle" $shouldShowTitle
|
2024-11-25 09:52:22 -08:00
|
|
|
)
|
|
|
|
}}
|
|
|
|
{{ else if eq $size "small" }}
|
|
|
|
{{
|
|
|
|
partial "page/figures/small.html" (dict
|
|
|
|
"page" $.Page
|
2025-08-19 10:03:50 -07:00
|
|
|
"images" $imgs
|
2024-11-25 09:52:22 -08:00
|
|
|
"size" $size
|
2024-12-31 09:39:46 -08:00
|
|
|
"class" $class
|
|
|
|
"shouldShowTitle" $shouldShowTitle
|
2024-11-25 09:52:22 -08:00
|
|
|
)
|
|
|
|
}}
|
2024-10-31 08:06:05 -07:00
|
|
|
{{ end }}
|