shithub: hugo

Download patch

ref: 0bdc0d62d4f5d117032e4c09f2438e9df4a9c18b
parent: 198efc89ca537a859f93cd775ea221d5032f1ac8
author: Bjørn Erik Pedersen <[email protected]>
date: Thu Jul 21 11:30:12 EDT 2016

Add shortcode null param variant

See #2294

--- a/hugolib/shortcode_test.go
+++ b/hugolib/shortcode_test.go
@@ -124,6 +124,13 @@
 	CheckShortCodeMatch(t, "{{< video 47238zzb >}}", "Playing Video error: index out of range for positional param at position 1", tem)
 }
 
+// Issue #2294
+func TestPositionalParamNil(t *testing.T) {
+	tem := tpl.New()
+	tem.AddInternalShortcode("div.html", `<div data='{{ .Get 0 }}'>{{ .Inner }}</div>`)
+	CheckShortCodeMatch(t, "{{% div %}}**foo**{{% /div %}}", "<div data=''><strong>foo</strong></div>", tem)
+}
+
 // some repro issues for panics in Go Fuzz testing
 func TestShortcodeGoFuzzRepros(t *testing.T) {
 	tt := tpl.New()