mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-23 21:53:09 +02:00
Fix crash for closing shortcode with no .Inner set
Fixes #6857 Closes #7330
This commit is contained in:
@@ -1316,3 +1316,23 @@ title: "Hugo Rocks!"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// https://github.com/gohugoio/hugo/issues/6857
|
||||
func TestShortcodeNoInner(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
b := newTestSitesBuilder(t)
|
||||
|
||||
b.WithContent("page.md", `---
|
||||
title: "No Inner!"
|
||||
---
|
||||
{{< noinner >}}{{< /noinner >}}
|
||||
|
||||
|
||||
`).WithTemplatesAdded(
|
||||
"layouts/shortcodes/noinner.html", `No inner here.`)
|
||||
|
||||
err := b.BuildE(BuildCfg{})
|
||||
b.Assert(err.Error(), qt.Contains, `failed to extract shortcode: shortcode "noinner" has no .Inner, yet a closing tag was provided`)
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user