-
Notifications
You must be signed in to change notification settings - Fork 2
/
marginfigure.html
19 lines (19 loc) · 959 Bytes
/
marginfigure.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{{- $path := .Get "src" }}
{{- $original := resources.Get $path }}
{{- $alt := default "" (.Get "alt") }}
{{- $imageResize := default "360x" (.Get "resize") }}
{{- with .Get "rotate" }}{{- $imageResize = (printf "%s r%s" $imageResize .) }}{{- end }}
{{- $result := $original.Resize $imageResize }}
<figure {{ if (or (isSet .Params "hidden") (eq (len $alt) 0)) }}aria-hidden="true" {{ end }} role="note">
<img src="{{ $result.RelPermalink }}"
alt="{{ $alt }}"
width="{{ $result.Width }}"
height="{{ $result.Height }}"
{{- with .Get "title" }}title="{{ . }}"{{ end }}
data-original-url="{{ $original.RelPermalink}}"
data-original-width="{{ $original.Width }}"
data-original-height="{{ $original.Height }}"
data-width="{{ $result.Width }}"
data-height="{{ $result.Height }}" />
{{ with .Get "caption" }}<figcaption>{{ partial "unparagraphy.html" . }}</figcaption>{{ end }}
</figure>