|
@@ -3,27 +3,34 @@
|
|
{{ if .Get "library" }}
|
|
{{ if .Get "library" }}
|
|
{{ $image_src = printf "img/%s" $image_src | relURL }}
|
|
{{ $image_src = printf "img/%s" $image_src | relURL }}
|
|
{{ end }}
|
|
{{ end }}
|
|
|
|
+
|
|
|
|
+{{/* Disallow user from opening image in the lightbox? */}}
|
|
{{ $lightbox := eq (.Get "lightbox" | default "true") "true" }}
|
|
{{ $lightbox := eq (.Get "lightbox" | default "true") "true" }}
|
|
|
|
+
|
|
|
|
+{{/* Get lightbox group for showing multiple images in a lightbox. */}}
|
|
{{ $group := .Get "lightbox-group" | default "" }}
|
|
{{ $group := .Get "lightbox-group" | default "" }}
|
|
|
|
|
|
|
|
+{{/* Get caption. Support legacy `title` option. */}}
|
|
|
|
+{{ $caption := .Get "title" | default (.Get "caption") | default "" }}
|
|
|
|
+
|
|
<figure{{ with .Get "class" }} class="{{.}}"{{ end }}>
|
|
<figure{{ with .Get "class" }} class="{{.}}"{{ end }}>
|
|
|
|
+
|
|
{{ if $lightbox }}
|
|
{{ if $lightbox }}
|
|
- <a data-fancybox="{{$group}}" href="{{$image_src}}" {{ with .Get "caption"}}data-caption="{{ .|markdownify|emojify }}"{{ end }}>
|
|
|
|
|
|
+ <a data-fancybox="{{$group}}" href="{{$image_src}}" {{ with $caption }}data-caption="{{ .|markdownify|emojify }}"{{ end }}>
|
|
{{ else if .Get "link"}}
|
|
{{ else if .Get "link"}}
|
|
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{.}}"{{ end }}{{ with .Get "rel" }} rel="{{.}}"{{ end }}>
|
|
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{.}}"{{ end }}{{ with .Get "rel" }} rel="{{.}}"{{ end }}>
|
|
|
|
+{{ end -}}
|
|
|
|
+
|
|
|
|
+<img src="{{$image_src}}" alt="{{ with .Get "alt" }}{{.}}{{end}}" {{ with .Get "width" }}width="{{.}}" {{end}}{{ with .Get "height" }}height="{{.}}" {{end}}>
|
|
|
|
+
|
|
|
|
+{{- if or $lightbox (.Get "link") }}</a>{{ end }}
|
|
|
|
+
|
|
|
|
+{{ if $caption }}
|
|
|
|
+ {{/* Localize the figure numbering (if enabled). */}}
|
|
|
|
+ {{ $figure := split (i18n "figure" | default "Figure %d:") "%d" }}
|
|
|
|
+ <figcaption{{ if eq (.Get "numbered") "true" }} data-pre="{{ index $figure 0 }}" data-post="{{ index $figure 1 }}" class="numbered"{{ end }}>
|
|
|
|
+ {{ $caption | markdownify | emojify }}
|
|
|
|
+ </figcaption>
|
|
{{ end }}
|
|
{{ end }}
|
|
-<img src="{{$image_src}}" alt="{{ if or (.Get "alt") (.Get "caption") }}{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}{{ end }}" {{ with .Get "width" }}width="{{.}}" {{ end }}{{ with .Get "height" }}height="{{.}}" {{ end }}>
|
|
|
|
-{{ if or $lightbox (.Get "link") }}</a>{{ end }}
|
|
|
|
-{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
|
|
|
|
-{{ $figure := split (i18n "figure" | default "Figure %d:") "%d" }}
|
|
|
|
-<figcaption data-pre="{{ index $figure 0 }}" data-post="{{ index $figure 1 }}" {{ if eq (.Get "numbered") "true" }}class="numbered"{{ end }}>
|
|
|
|
- {{ if isset .Params "title" }}<h4>{{ .Get "title" | markdownify | emojify }}</h4>{{ end }}
|
|
|
|
- {{ if or (.Get "caption") (.Get "attr")}}<p>
|
|
|
|
- {{ .Get "caption" | markdownify | emojify }}
|
|
|
|
- {{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }}
|
|
|
|
- {{ .Get "attr" }}
|
|
|
|
- {{ if .Get "attrlink"}}</a> {{ end }}
|
|
|
|
- </p> {{ end }}
|
|
|
|
-</figcaption>
|
|
|
|
-{{ end }}
|
|
|
|
|
|
+
|
|
</figure>
|
|
</figure>
|