Welcome to mirror list, hosted at ThFree Co, Russian Federation.

image.html « shortcodes « layouts - github.com/kakawait/hugo-tranquilpeak-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2e92509761c4301b84f32cac5aaafac8d67f6754 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{{ $.Scratch.Set "i-classes" (split (.Get "classes") " ") }}
{{ if in ($.Scratch.Get "i-classes") "clear" }} 
  {{ $.Scratch.Set "i-clear" 1 }}
  {{ $classes := $.Scratch.Get "i-classes" }}
  {{ $.Scratch.Set "i-classes" (slice) }}
  {{ range $classes }}
    {{ if ne . "clear" }}
      {{ $.Scratch.Add "i-classes" . }}
    {{ end }}
  {{ end }}
{{ end }}
{{ if in ($.Scratch.Get "i-classes") "fancybox" }} 
  {{ $.Scratch.Set "i-fancybox" 1 }}
  {{ $classes := $.Scratch.Get "i-classes" }}
  {{ $.Scratch.Set "i-classes" (slice) }}
  {{ range $classes }}
    {{ if ne . "fancybox" }}
      {{ $.Scratch.Add "i-classes" . }}
    {{ end }}
  {{ end }}
{{ end }}
<div class="figure {{ delimit ($.Scratch.Get "i-classes") " " }}" {{ with (.Get "thumbnailWidth") }}style="width:{{ . }};"{{ end }}>
  {{ if eq ($.Scratch.Get "i-fancybox") 1 }}
    <a class="fancybox" href="{{ .Get "src" }}"{{ with (.Get "title") }} title="{{ . }}"{{ end }} data-fancybox="{{ with (.Get "group") }}{{ . }}{{ end }}">
  {{ end }}
    <img class="fig-img" src="{{ with (.Get "thumbnail") }}{{ . }}{{ else }}{{ .Get "src" }}{{ end }}" {{ if or (.Get "thumbnail-width") (.Get "thumbnail-height") }}style="{{ with (.Get "thumbnail-width") }}width: {{ . }};{{ end }}{{ with (.Get "thumbnail-height") }}height: {{ . }};{{ end }}"{{ end }}{{ with (.Get "title") }} alt="{{ . }}"{{ end }}>
  {{ if eq ($.Scratch.Get "i-fancybox") 1 }}
    </a>
  {{ end }}
  {{ if and (.Get "title") (not (in ($.Scratch.Get "i-classes") "nocaption")) }} 
    <span class="caption">{{ .Get "title" }}</span>
  {{ end }}
</div>
{{ if eq ($.Scratch.Get "i-clear") 1 }}
  <div style="clear:both;"></div>
{{ end }}