mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-22 21:42:50 +02:00
@@ -155,6 +155,13 @@ func init() {
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.FirstUpper,
|
||||
nil,
|
||||
[][2]string{
|
||||
{`{{ "hugo rocks!" | strings.FirstUpper }}`, `Hugo rocks!`},
|
||||
},
|
||||
)
|
||||
|
||||
ns.AddMethodMapping(ctx.Truncate,
|
||||
[]string{"truncate"},
|
||||
[][2]string{
|
||||
|
@@ -325,6 +325,16 @@ func (ns *Namespace) Title(s interface{}) (string, error) {
|
||||
return ns.titleFunc(ss), nil
|
||||
}
|
||||
|
||||
// FirstUpper returns a string with the first character as upper case.
|
||||
func (ns *Namespace) FirstUpper(s interface{}) (string, error) {
|
||||
ss, err := cast.ToStringE(s)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return helpers.FirstUpper(ss), nil
|
||||
}
|
||||
|
||||
// ToLower returns a copy of the input s with all Unicode letters mapped to their
|
||||
// lower case.
|
||||
func (ns *Namespace) ToLower(s interface{}) (string, error) {
|
||||
|
Reference in New Issue
Block a user