From 9818724b5bcba42205c107e5aa1765359516598f Mon Sep 17 00:00:00 2001 From: Andreas Deininger Date: Fri, 10 Mar 2023 18:41:17 +0100 Subject: [PATCH] Improve error message for unclosed shortcode with inner content --- hugolib/shortcode.go | 2 +- hugolib/shortcode_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hugolib/shortcode.go b/hugolib/shortcode.go index 0a10d47eb0d..1c0dfaade1b 100644 --- a/hugolib/shortcode.go +++ b/hugolib/shortcode.go @@ -689,7 +689,7 @@ Loop: case currItem.IsDone(): if !currItem.IsError() { if !closed && sc.needsInner() { - return sc, fmt.Errorf("%s: unclosed shortcode %q", errorPrefix, sc.name) + return sc, fmt.Errorf("%s: shortcode %q must be closed or self-closed", errorPrefix, sc.name) } } // handled by caller diff --git a/hugolib/shortcode_test.go b/hugolib/shortcode_test.go index eac3de2ce2c..67c83f44e45 100644 --- a/hugolib/shortcode_test.go +++ b/hugolib/shortcode_test.go @@ -1274,5 +1274,5 @@ Inner: {{ .Get 0 }}: {{ len .Inner }} ).BuildE() b.Assert(err, qt.Not(qt.IsNil)) - b.Assert(err.Error(), qt.Contains, `p1.md:5:1": failed to extract shortcode: unclosed shortcode "sc"`) + b.Assert(err.Error(), qt.Contains, `p1.md:5:1": failed to extract shortcode: shortcode "sc" must be closed or self-closed`) }