hugo-tufte/layouts/shortcodes/figure.html
2016-01-14 20:41:16 -08:00

44 lines
1.4 KiB
HTML

{{ $type := .Get "type" }}
{{ if not (eq $type "margin") }}
{{ if eq $type "full" }}
<figure class="fullwidth">
{{ else }}
<figure {{ with .Get "class" }} class="{{ . }}"{{ end }}>
{{ end }}
{{ end }}
{{ if eq $type "full" }}
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
<img src="{{ .Get "src" }}" {{ with .Get "alt"}}alt="{{ . }}"{{ end }}>
{{ if .Get "link" }}</a>{{ end }}
<figcaption>
{{ else }}
<label for="{{ .Get "label" }}" class="margin-toggle"></label>
<input type="checkbox" id="{{ .Get "label" }}" class="margin-toggle">
<span class="marginnote">
{{ if eq $type "margin" }}
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
<img src="{{ .Get "src" }}" {{ with .Get "alt"}}alt="{{ . }}"{{ end }}>
{{ if .Get "link" }}</a>{{ end }}
{{ end }}
{{ end }}
{{ with .Get "title"}}<strong>{{ . }} </strong>{{ end}}
{{ with .Get "caption"}}{{ . }}{{ end }}
{{ with .Get "attrlink"}}<a href="{{ .}}">{{ end }}
{{ with .Get "attr" }}{{ . }}{{ end }}
{{ if .Get "attrlink" }}</a>{{ end }}
{{ if eq $type "full" }}
</figcaption>
{{ else }}
</span>
{{ end }}
{{ if and (not (eq $type "full")) (not (eq $type "margin")) }}
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
<img src="{{ .Get "src" }}" {{ with .Get "alt"}}alt="{{ . }}"{{ end }}>
{{ if .Get "link" }}</a>{{ end }}
{{ end }}
{{ if not (eq $type "margin") }}
</figure>
{{ end }}