improve readability of figure.html

This commit is contained in:
loikein 2023-04-15 01:53:05 +01:00
parent cc8175f38b
commit 3922e52f50

View file

@ -1,5 +1,6 @@
{{ $type := .Get "type" }}
{{ $type := .Get "type" | default "normal" }}
<!-- begin figure tag -->
{{ if not (eq $type "margin") }}
{{ if eq $type "full" }}
<figure class="fullwidth">
@ -8,13 +9,14 @@
{{ end }}
{{ end }}
<!-- begin inner elements -->
{{ 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>
{{ else }}{{/* margin or normal */}}
<label for="{{ .Get "label" }}" class="margin-toggle">&#128172;</label>
<input type="checkbox" id="{{ .Get "label" }}" class="margin-toggle">
<span class="marginnote">
{{ if eq $type "margin" }}
@ -23,22 +25,27 @@
{{ 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 }}
{{ 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 -->
{{ if eq $type "full" }}
</figcaption>
{{ else }}
</span>
{{ end }}
{{ if and (not (eq $type "full")) (not (eq $type "margin")) }}
{{ if ( eq $type "normal" ) }}
{{ with .Get "link" }}<a href="{{ . }}">{{ end }}
<img src="{{ .Get "src" }}" {{ with .Get "alt"}}alt="{{ . }}"{{ end }}>
{{ if .Get "link" }}</a>{{ end }}
{{ end }}
<!-- end figure tag -->
{{ if not (eq $type "margin") }}
</figure>
{{ end }}