figure.html 1.0 KB

1234567891011121314151617
  1. <figure{{ with .Get "class" }} class="{{.}}"{{ end }}>
  2. {{ if .Get "link"}}<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>{{ end }}
  3. <img src="{{ .Get "src" }}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }}{{ with .Get "height" }}height="{{.}}" {{ end }}/>
  4. {{ if .Get "link"}}</a>{{ end }}
  5. {{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}}
  6. {{ $figure := split (i18n "figure" | default "Figure %d:") "%d" }}
  7. <figcaption data-pre="{{ index $figure 0 }}" data-post="{{ index $figure 1 }}" {{ if eq (.Get "numbered") "true" }}class="numbered"{{ end }}>{{ if isset .Params "title" }}
  8. <h4>{{ .Get "title" }}</h4>{{ end }}
  9. {{ if or (.Get "caption") (.Get "attr")}}<p>
  10. {{ .Get "caption" }}
  11. {{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }}
  12. {{ .Get "attr" }}
  13. {{ if .Get "attrlink"}}</a> {{ end }}
  14. </p> {{ end }}
  15. </figcaption>
  16. {{ end }}
  17. </figure>