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