mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-26 21:51:02 +03:00
parent
a13199fd8c
commit
71925b27c7
2 changed files with 20 additions and 0 deletions
|
@ -262,3 +262,20 @@ Line 3.
|
||||||
b.Assert(err, qt.IsNotNil)
|
b.Assert(err, qt.IsNotNil)
|
||||||
b.Assert(err.Error(), qt.Contains, filepath.FromSlash(` "/layouts/home.html:2:11": execute of template failed`))
|
b.Assert(err.Error(), qt.Contains, filepath.FromSlash(` "/layouts/home.html:2:11": execute of template failed`))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestPartialReturnPanicIssue13600(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- hugo.toml --
|
||||||
|
-- layouts/home.html --
|
||||||
|
Partial: {{ partial "p1.html" . }}
|
||||||
|
-- layouts/_partials/p1.html --
|
||||||
|
P1.
|
||||||
|
{{ return ( delimit . ", " ) | string }}
|
||||||
|
`
|
||||||
|
|
||||||
|
b, err := hugolib.TestE(t, files)
|
||||||
|
b.Assert(err, qt.IsNotNil)
|
||||||
|
b.Assert(err.Error(), qt.Contains, "wrong number of args for string: want 1 got 0")
|
||||||
|
}
|
||||||
|
|
|
@ -175,6 +175,9 @@ func (c *templateTransformContext) applyTransformations(n parse.Node) (bool, err
|
||||||
}
|
}
|
||||||
|
|
||||||
case *parse.CommandNode:
|
case *parse.CommandNode:
|
||||||
|
if x == nil {
|
||||||
|
return true, nil
|
||||||
|
}
|
||||||
c.collectInner(x)
|
c.collectInner(x)
|
||||||
keep := c.collectReturnNode(x)
|
keep := c.collectReturnNode(x)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue