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.
This commit is contained in:
parent
cc405e6ca9
commit
1f2de30c60
2 changed files with 20 additions and 6 deletions
|
@ -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
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit a395d26bc4fa025335489845ed8c0dd988b4252d
|
||||
Subproject commit 3248ac51d13b1ecf221f3c9ba453cb3da30b9bf3
|
Loading…
Add table
Add a link
Reference in a new issue