1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-07-17 11:35:32 -04:00

support full HTML captions for image shortcode

This commit is contained in:
2019-12-17 11:39:23 -05:00
parent 1b97c6b2de
commit c87bfd7797
22 changed files with 111 additions and 113 deletions

View File

@@ -27,19 +27,15 @@
{{- $displayWidth := $setWidth -}}
{{- $displayHeight := (math.Ceil (mul $origRatio $setWidth)) -}}
{{- if .Get "caption" -}}
{{ with .Inner }}
<figure>
<picture>
{{- else -}}
<p>
{{- end -}}
<img src="{{ $image.Permalink }}" width="{{ $displayWidth }}" height="{{ $displayHeight }}"
{{- with .Get "alt" }} alt="{{ . }}"{{ end }}
{{- with .Get "caption" }} title="{{ . }}"{{ end }}>
{{- with .Get "caption" -}}
<img src="{{ $image.Permalink }}" width="{{ $displayWidth }}" height="{{ $displayHeight }}"
alt="{{ . | plainify | safeHTMLAttr }}" title="{{ . | plainify | safeHTMLAttr }}">
</picture>
<figcaption>{{ . }}</figcaption>
<figcaption>{{ . | safeHTML }}</figcaption>
</figure>
{{- else -}}
</p>
{{- end -}}
{{ else }}
<p><img src="{{ $image.Permalink }}" width="{{ $displayWidth }}" height="{{ $displayHeight }}"
{{- with .Get "alt" }} alt="{{ . | safeHTMLAttr }}" title="{{ . | safeHTMLAttr }}"{{ end }}></p>
{{ end }}