mirror of
https://github.com/gohugoio/hugo.git
synced 2025-04-20 11:13:07 +00:00
parent
d9bc233f1f
commit
adf405496e
2 changed files with 8 additions and 0 deletions
|
@ -1703,6 +1703,11 @@ func humanize(in interface{}) (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if word == "" {
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
|
||||||
return inflect.Humanize(word), nil
|
return inflect.Humanize(word), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1805,8 +1805,11 @@ func TestInflect(t *testing.T) {
|
||||||
expected string
|
expected string
|
||||||
}{
|
}{
|
||||||
{humanize, "MyCamel", "My camel"},
|
{humanize, "MyCamel", "My camel"},
|
||||||
|
{humanize, "", ""},
|
||||||
{pluralize, "cat", "cats"},
|
{pluralize, "cat", "cats"},
|
||||||
|
{pluralize, "", ""},
|
||||||
{singularize, "cats", "cat"},
|
{singularize, "cats", "cat"},
|
||||||
|
{singularize, "", ""},
|
||||||
} {
|
} {
|
||||||
|
|
||||||
result, err := this.inflectFunc(this.in)
|
result, err := this.inflectFunc(this.in)
|
||||||
|
|
Loading…
Add table
Reference in a new issue