From 48ea43995212f15d9ab25984c535977b206dcebb Mon Sep 17 00:00:00 2001 From: stormcow Date: Tue, 6 Aug 2024 11:25:29 +0200 Subject: [PATCH] made title func return a string --- pkg/template/template.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/template/template.go b/pkg/template/template.go index 648ae7d..9f80ff9 100644 --- a/pkg/template/template.go +++ b/pkg/template/template.go @@ -24,6 +24,7 @@ import ( "github.com/go-kit/log/level" "github.com/pkg/errors" "golang.org/x/text/cases" + "golang.org/x/text/language" ) type Template struct { @@ -34,7 +35,10 @@ type Template struct { var funcs = template.FuncMap{ "toUpper": strings.ToUpper, "toLower": strings.ToLower, - "title": cases.Title, + "title": func(title string) string { + return cases.Title(language.AmericanEnglish).String(title) + }, + // cases.Title, // join is equal to strings.Join but inverts the argument order // for easier pipelining in templates. "join": func(sep string, s []string) string {