hugo-tufte/layouts/shortcodes/figure.html

52 lines
1.5 KiB
HTML
Raw Normal View History

2023-04-15 02:53:05 +02:00
{{ $type := .Get "type" | default "normal" }}
2016-01-15 05:41:16 +01:00
2023-04-15 02:53:05 +02:00
<!-- begin figure tag -->
2016-01-15 05:41:16 +01:00
{{ if not (eq $type "margin") }}
{{ if eq $type "full" }}
<figure class="fullwidth">
{{ else }}
<figure {{ with .Get "class" }} class="{{ . }}"{{ end }}>
{{ end }}
{{ end }}
2023-04-15 02:53:05 +02:00
<!-- begin inner elements -->
2016-01-15 05:41:16 +01:00
{{ 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>
2023-04-15 02:53:05 +02:00
{{ else }}{{/* margin or normal */}}
2023-04-15 16:31:10 +02:00
<label for="{{ .Get "label" }}" class="margin-toggle marginnote-ind">{{ .Site.Params.marginNoteInd }}</label>
<input type="checkbox" id="{{ .Get "label" }}" class="margin-toggle"/>
2016-01-15 05:41:16 +01:00
<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 }}
2023-04-15 02:53:05 +02:00
{{ 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 }}
<!-- end inner elements -->
2016-01-15 05:41:16 +01:00
{{ if eq $type "full" }}
</figcaption>
{{ else }}
</span>
{{ end }}
2023-04-15 02:53:05 +02:00
{{ if ( eq $type "normal" ) }}
2016-01-15 05:41:16 +01:00
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
<img src="{{ .Get "src" }}" {{ with .Get "alt"}}alt="{{ . }}"{{ end }}>
{{ if .Get "link" }}</a>{{ end }}
{{ end }}
2023-04-15 02:53:05 +02:00
<!-- end figure tag -->
2016-01-15 05:41:16 +01:00
{{ if not (eq $type "margin") }}
</figure>
{{ end }}