From 0bb6f6ecdffeb86457b1d3d2cb49e2ba2925bf56 Mon Sep 17 00:00:00 2001 From: stormcow Date: Tue, 6 Aug 2024 11:25:29 +0200 Subject: [PATCH 1/2] made title func return a string Signed-off-by: stormcow --- 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 { From 6bdb00100066476c0fc07946ec4fba59b40b6c7a Mon Sep 17 00:00:00 2001 From: stormcow Date: Tue, 6 Aug 2024 11:27:17 +0200 Subject: [PATCH 2/2] removed commented line Signed-off-by: stormcow --- pkg/template/template.go | 1 - 1 file changed, 1 deletion(-) diff --git a/pkg/template/template.go b/pkg/template/template.go index 9f80ff9..ebfedea 100644 --- a/pkg/template/template.go +++ b/pkg/template/template.go @@ -38,7 +38,6 @@ var funcs = template.FuncMap{ "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 {