From 3922e52f504ec3c4efc1fb91c2a93ee0450e59e7 Mon Sep 17 00:00:00 2001 From: loikein Date: Sat, 15 Apr 2023 01:53:05 +0100 Subject: [PATCH] improve readability of figure.html --- layouts/shortcodes/figure.html | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index 907d2cb..956e8ad 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -1,5 +1,6 @@ -{{ $type := .Get "type" }} +{{ $type := .Get "type" | default "normal" }} + {{ if not (eq $type "margin") }} {{ if eq $type "full" }}
@@ -8,13 +9,14 @@ {{ end }} {{ end }} + {{ if eq $type "full" }} {{ with .Get "link" }}{{ end }} {{ if .Get "link" }}{{ end }}
-{{ else }} - +{{ else }}{{/* margin or normal */}} + {{ if eq $type "margin" }} @@ -23,22 +25,27 @@ {{ if .Get "link" }}{{ end }} {{ end }} {{ end }} - {{ with .Get "title"}}{{ . }} {{ end}} - {{ with .Get "caption"}}{{ . }}{{ end }} - {{ with .Get "attrlink"}}{{ end }} - {{ with .Get "attr" }}{{ . }}{{ end }} - {{ if .Get "attrlink" }}{{ end }} + +{{ with .Get "title"}}{{ . }} {{ end}} +{{ with .Get "caption"}}{{ . }}{{ end }} +{{ with .Get "attrlink"}}{{ end }} +{{ with .Get "attr" }}{{ . }}{{ end }} +{{ if .Get "attrlink" }}{{ end }} + + {{ if eq $type "full" }}
{{ else }} {{ end }} -{{ if and (not (eq $type "full")) (not (eq $type "margin")) }} + +{{ if ( eq $type "normal" ) }} {{ with .Get "link" }}{{ end }} {{ if .Get "link" }}{{ end }} {{ end }} + {{ if not (eq $type "margin") }}
{{ end }}