| 1 |
<figure{{ with .Get "class" }} class="{{ . }}"{{ end }}> |
| 2 |
{{- if .Get "link" -}} |
| 3 |
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}> |
| 4 |
{{- end -}} |
| 5 |
|
| 6 |
{{- $u := urls.Parse (.Get "src") -}} |
| 7 |
{{- $src := $u.String -}} |
| 8 |
{{- if not $u.IsAbs -}} |
| 9 |
{{- with or (.Page.Resources.Get $u.Path) (resources.Get $u.Path) -}} |
| 10 |
{{- $src = .RelPermalink -}} |
| 11 |
{{- end -}} |
| 12 |
{{- end -}} |
| 13 |
|
| 14 |
<img src="{{ $src }}" |
| 15 |
{{- if or (.Get "alt") (.Get "caption") }} |
| 16 |
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify | plainify }}{{ end }}" |
| 17 |
{{- end -}}{{- with .Get "width" }} width="{{ . }}"{{ end -}}{{- with .Get "height" }} height="{{ . }}"{{ end -}}{{- with .Get "loading" }} loading="{{ . }}"{{ end -}}><!-- Closing img tag --> |
| 18 |
{{- if .Get "link" }}</a>{{ end -}} |
| 19 |
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}} |
| 20 |
<figcaption> |
| 21 |
{{ with (.Get "title") -}} |
| 22 |
<h4>{{ . }}</h4> |
| 23 |
{{- end -}} |
| 24 |
{{- if or (.Get "caption") (.Get "attr") -}}<p> |
| 25 |
{{- .Get "caption" | markdownify -}} |
| 26 |
{{- with .Get "attrlink" }} |
| 27 |
<a href="{{ . }}"> |
| 28 |
{{- end -}} |
| 29 |
{{- .Get "attr" | markdownify -}} |
| 30 |
{{- if .Get "attrlink" }}</a>{{ end }}</p> |
| 31 |
{{- end }} |
| 32 |
</figcaption> |
| 33 |
{{- end }} |
| 34 |
</figure> |