figure.html 1.2 KB

1234567891011121314151617181920212223242526272829
  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. <img src="{{ .Get "src" | relURL }}"
  6. {{- if or (.Get "alt") (.Get "caption") }}
  7. alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
  8. {{- end -}}
  9. {{- with .Get "width" }} width="{{ . }}"{{ end -}}
  10. {{- with .Get "height" }} height="{{ . }}"{{ end -}}
  11. /><!-- Closing img tag -->
  12. {{- if .Get "link" }}</a>{{ end -}}
  13. {{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
  14. <figcaption>
  15. {{ with (.Get "title") -}}
  16. <h4>{{ . }}</h4>
  17. {{- end -}}
  18. {{- if or (.Get "caption") (.Get "attr") -}}<p>
  19. {{- .Get "caption" | markdownify -}}
  20. {{- with .Get "attrlink" }}
  21. <a href="{{ . }}">
  22. {{- end -}}
  23. {{- .Get "attr" | markdownify -}}
  24. {{- if .Get "attrlink" }}</a>{{ end }}</p>
  25. {{- end }}
  26. </figcaption>
  27. {{- end }}
  28. </figure>