From dc538ae4516c4420c5d0bacfe81363e9fbf3ba6c Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson Date: Sun, 15 Jan 2023 11:52:20 +0100 Subject: [PATCH] MAke it possible to set empty alt attribute on figure, img and svg shortcodes. Do not use h4 for caption title in figure, use strong instead. --- assets/sass/_zen.scss | 1 - layouts/shortcodes/figure.html | 4 ++-- layouts/shortcodes/img.html | 2 +- layouts/shortcodes/svg.html | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/assets/sass/_zen.scss b/assets/sass/_zen.scss index 8f2d672..bd87493 100644 --- a/assets/sass/_zen.scss +++ b/assets/sass/_zen.scss @@ -175,7 +175,6 @@ figure { caption-side: bottom; } - h4, p { margin: 0; } diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index 9c2be30..518f81b 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -87,11 +87,11 @@
{{ with $link }}{{ end -}} -{{ . }} +{{ $alt }} {{- if $link }}{{ end }} {{ if or $title $caption $attr -}}
-{{ with $title }}

{{ . }}

{{ end -}} +{{ with $title }}{{ . }}
{{ end -}} {{- $caption | markdownify }}{{ if and $caption $attr }} {{ end -}} {{ with $attrlink }}{{ end }}{{ $attr | markdownify }}{{ if $attrlink }}{{ end -}}
diff --git a/layouts/shortcodes/img.html b/layouts/shortcodes/img.html index c972159..2cb3fc9 100644 --- a/layouts/shortcodes/img.html +++ b/layouts/shortcodes/img.html @@ -82,5 +82,5 @@ {{ end -}} {{ with $link }}{{ end -}} -{{ . }} +{{ $alt }} {{- if $link }}{{ end }} diff --git a/layouts/shortcodes/svg.html b/layouts/shortcodes/svg.html index c2e7f96..5c31cce 100644 --- a/layouts/shortcodes/svg.html +++ b/layouts/shortcodes/svg.html @@ -54,7 +54,7 @@ {{ if $inline -}}
{{ $src | safeHTML }}
{{ else -}} -{{ . }} +{{ $alt }} {{ end -}} {{- if $link }}{{ end }} {{ if $caption -}}