summaryrefslogtreecommitdiffstats
path: root/tpl/tplimpl/embedded/templates
diff options
context:
space:
mode:
authorJoe Mooring <joe.mooring@veriphor.com>2024-03-13 22:38:15 -0700
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2024-03-14 10:21:40 +0200
commit48a0fea87afd706efbe3021c332444116af80c97 (patch)
treebd95720562c5e212a2021d76145c5c84ff32649d /tpl/tplimpl/embedded/templates
parent9ca1de09dd397a84dd13e528d8d09930d913d885 (diff)
tpl/tplimpl: Modify figure shortcode to look for page resource
Closes #12244 Closes #12245
Diffstat (limited to 'tpl/tplimpl/embedded/templates')
-rw-r--r--tpl/tplimpl/embedded/templates/shortcodes/figure.html61
1 files changed, 35 insertions, 26 deletions
diff --git a/tpl/tplimpl/embedded/templates/shortcodes/figure.html b/tpl/tplimpl/embedded/templates/shortcodes/figure.html
index afe784c19..a0b93a437 100644
--- a/tpl/tplimpl/embedded/templates/shortcodes/figure.html
+++ b/tpl/tplimpl/embedded/templates/shortcodes/figure.html
@@ -1,29 +1,38 @@
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}>
- {{- if .Get "link" -}}
- <a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
+ {{- if .Get "link" -}}
+ <a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
+ {{- end -}}
+
+ {{- $u := urls.Parse (.Get "src") -}}
+ {{- $src := $u.String -}}
+ {{- if not $u.IsAbs -}}
+ {{- with or (.Page.Resources.Get $u.Path) (resources.Get $u.Path) -}}
+ {{- $src = .RelPermalink -}}
{{- end -}}
- <img src="{{ .Get "src" }}"
- {{- if or (.Get "alt") (.Get "caption") }}
- alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
- {{- end -}}
- {{- with .Get "width" }} width="{{ . }}"{{ end -}}
- {{- with .Get "height" }} height="{{ . }}"{{ end -}}
- {{- with .Get "loading" }} loading="{{ . }}"{{ end -}}
- /><!-- Closing img tag -->
- {{- if .Get "link" }}</a>{{ end -}}
- {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
- <figcaption>
- {{ with (.Get "title") -}}
- <h4>{{ . }}</h4>
- {{- end -}}
- {{- if or (.Get "caption") (.Get "attr") -}}<p>
- {{- .Get "caption" | markdownify -}}
- {{- with .Get "attrlink" }}
- <a href="{{ . }}">
- {{- end -}}
- {{- .Get "attr" | markdownify -}}
- {{- if .Get "attrlink" }}</a>{{ end }}</p>
- {{- end }}
- </figcaption>
- {{- end }}
+ {{- end -}}
+
+ <img src="{{ $src }}"
+ {{- if or (.Get "alt") (.Get "caption") }}
+ alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
+ {{- end -}}
+ {{- with .Get "width" }} width="{{ . }}"{{ end -}}
+ {{- with .Get "height" }} height="{{ . }}"{{ end -}}
+ {{- with .Get "loading" }} loading="{{ . }}"{{ end -}}
+ ><!-- Closing img tag -->
+ {{- if .Get "link" }}</a>{{ end -}}
+ {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
+ <figcaption>
+ {{ with (.Get "title") -}}
+ <h4>{{ . }}</h4>
+ {{- end -}}
+ {{- if or (.Get "caption") (.Get "attr") -}}<p>
+ {{- .Get "caption" | markdownify -}}
+ {{- with .Get "attrlink" }}
+ <a href="{{ . }}">
+ {{- end -}}
+ {{- .Get "attr" | markdownify -}}
+ {{- if .Get "attrlink" }}</a>{{ end }}</p>
+ {{- end }}
+ </figcaption>
+ {{- end }}
</figure>