From 5bc5ce9a5805b7e34b7bafdbe743ce9b85fb3c68 Mon Sep 17 00:00:00 2001 From: Fredrik Jonsson Date: Fri, 11 Apr 2025 18:31:55 +0200 Subject: [PATCH] Chomp trailing newline in shortcodes. --- layouts/_shortcodes/button.html | 1 + layouts/_shortcodes/file.html | 1 + layouts/_shortcodes/img.html | 2 +- layouts/_shortcodes/math.html | 1 + layouts/_shortcodes/reflink.html | 2 +- 5 files changed, 5 insertions(+), 2 deletions(-) diff --git a/layouts/_shortcodes/button.html b/layouts/_shortcodes/button.html index a733166..d96f1a0 100644 --- a/layouts/_shortcodes/button.html +++ b/layouts/_shortcodes/button.html @@ -3,3 +3,4 @@ {{ $src := .Get "src" -}} {{ $text := .Get "text" -}} {{ $text }} +{{- /* chomp trailing newline */ -}} diff --git a/layouts/_shortcodes/file.html b/layouts/_shortcodes/file.html index c8d7e57..b1dd692 100644 --- a/layouts/_shortcodes/file.html +++ b/layouts/_shortcodes/file.html @@ -34,3 +34,4 @@ {{ end -}} {{ $text }} +{{- /* chomp trailing newline */ -}} diff --git a/layouts/_shortcodes/img.html b/layouts/_shortcodes/img.html index dde693f..315926a 100644 --- a/layouts/_shortcodes/img.html +++ b/layouts/_shortcodes/img.html @@ -91,4 +91,4 @@ {{ with $link }}{{ end -}} {{ $alt }} -{{- if $link }}{{ end }} +{{- if $link }}{{ end -}} diff --git a/layouts/_shortcodes/math.html b/layouts/_shortcodes/math.html index 7ca55f7..459b8ff 100644 --- a/layouts/_shortcodes/math.html +++ b/layouts/_shortcodes/math.html @@ -1 +1,2 @@ ${{ .Inner }}$ +{{- /* chomp trailing newline */ -}} diff --git a/layouts/_shortcodes/reflink.html b/layouts/_shortcodes/reflink.html index f2bf2b3..62613e9 100644 --- a/layouts/_shortcodes/reflink.html +++ b/layouts/_shortcodes/reflink.html @@ -1 +1 @@ -{{ with site.GetPage (.Get 0) }}{{ .Title }}{{ end }} +{{ with site.GetPage (.Get 0) }}{{ .Title }}{{ end -}}