diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-10-30 17:36:05 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-10-30 18:12:14 +0100 |
commit | 3a786a248d3eff6e732aa94e87d6e88196e5147a (patch) | |
tree | 8adae8d35ba7522cc91b0936bbbeb5888337b65d /hugolib | |
parent | 729593c842794eaf7127050953a5c2256d332051 (diff) |
tpl: Fix BOM issue in templates
Fixes #4895
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/template_test.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/hugolib/template_test.go b/hugolib/template_test.go index eed3ee8ed..9cc523cb0 100644 --- a/hugolib/template_test.go +++ b/hugolib/template_test.go @@ -212,3 +212,27 @@ Some content } } + +// https://github.com/gohugoio/hugo/issues/4895 +func TestTemplateBOM(t *testing.T) { + + b := newTestSitesBuilder(t).WithSimpleConfigFile() + bom := "\ufeff" + + b.WithTemplatesAdded( + "_default/baseof.html", bom+` + Base: {{ block "main" . }}base main{{ end }}`, + "_default/single.html", bom+`{{ define "main" }}Hi!?{{ end }}`) + + b.WithContent("page.md", `--- +title: "Page" +--- + +Page Content +`) + + b.CreateSites().Build(BuildCfg{}) + + b.AssertFileContent("public/page/index.html", "Base: Hi!?") + +} |