Skip to content

Commit

Permalink
made title func return a string
Browse files Browse the repository at this point in the history
  • Loading branch information
stormcow committed Aug 6, 2024
1 parent d43cbab commit 48ea439
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down

0 comments on commit 48ea439

Please sign in to comment.