Fix base template handling with preceding comments

Fixes #6816
This commit is contained in:
Bjørn Erik Pedersen
2020-01-30 20:02:26 +01:00
parent 49ef647203
commit f45cb31728
3 changed files with 66 additions and 9 deletions

View File

@@ -398,6 +398,27 @@ title: The Page
}
// https://github.com/gohugoio/hugo/issues/6816
func TestTemplateBaseWithComment(t *testing.T) {
t.Parallel()
b := newTestSitesBuilder(t).WithSimpleConfigFile()
b.WithTemplatesAdded(
"baseof.html", `Base: {{ block "main" . }}{{ end }}`,
"index.html", `
{{/* A comment */}}
{{ define "main" }}
Bonjour
{{ end }}
`)
b.Build(BuildCfg{})
b.AssertFileContent("public/index.html", `Base:
Bonjour`)
}
func TestTemplateLookupSite(t *testing.T) {
t.Run("basic", func(t *testing.T) {
t.Parallel()