Remove the trailing new line in .Code

Fixes #9572
This commit is contained in:
Bjørn Erik Pedersen
2022-02-26 10:42:21 +01:00
parent afd63bf7d5
commit 10928a4f78
7 changed files with 74 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ import (
"strings"
"unicode/utf8"
"github.com/gohugoio/hugo/common/text"
"github.com/gohugoio/hugo/deps"
"github.com/gohugoio/hugo/helpers"
@@ -119,7 +120,7 @@ func (ns *Namespace) Chomp(s interface{}) (interface{}, error) {
return "", err
}
res := strings.TrimRight(ss, "\r\n")
res := text.Chomp(ss)
switch s.(type) {
case template.HTML:
return template.HTML(res), nil