mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
@@ -16,8 +16,9 @@ package inflect
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
_inflect "github.com/markbates/inflect"
|
||||
_inflect "github.com/gobuffalo/flect"
|
||||
"github.com/spf13/cast"
|
||||
)
|
||||
|
||||
@@ -53,7 +54,8 @@ func (ns *Namespace) Humanize(in interface{}) (string, error) {
|
||||
return _inflect.Ordinalize(word), nil
|
||||
}
|
||||
|
||||
return _inflect.Humanize(word), nil
|
||||
str := _inflect.Humanize(word)
|
||||
return _inflect.Humanize(strings.ToLower(str)), nil
|
||||
}
|
||||
|
||||
// Pluralize returns the plural form of a single word.
|
||||
|
@@ -26,6 +26,8 @@ func TestInflect(t *testing.T) {
|
||||
{ns.Humanize, int64(92), "92nd"},
|
||||
{ns.Humanize, "5.5", "5.5"},
|
||||
{ns.Humanize, t, false},
|
||||
{ns.Humanize, "this is a TEST", "This is a test"},
|
||||
{ns.Humanize, "my-first-Post", "My first post"},
|
||||
{ns.Pluralize, "cat", "cats"},
|
||||
{ns.Pluralize, "", ""},
|
||||
{ns.Pluralize, t, false},
|
||||
|
Reference in New Issue
Block a user