diff --git a/grammar.go b/grammar.go index 889a15d..b77948f 100644 --- a/grammar.go +++ b/grammar.go @@ -163,6 +163,16 @@ func IrregularNouns() map[string]string { return result } +// Lower returns the lowercase form of s. +func Lower(s string) string { + return core.Lower(s) +} + +// Upper returns the uppercase form of s. +func Upper(s string) string { + return core.Upper(s) +} + func getVerbForm(lang, verb, form string) string { data := GetGrammarData(lang) if data == nil || data.Verbs == nil { @@ -782,8 +792,8 @@ func definiteArticleFromGrammarForms(data *GrammarData, lowerWord, originalWord, func TemplateFuncs() template.FuncMap { return template.FuncMap{ "title": Title, - "lower": core.Lower, - "upper": core.Upper, + "lower": Lower, + "upper": Upper, "past": PastTense, "gerund": Gerund, "plural": Pluralize, diff --git a/grammar_test.go b/grammar_test.go index 59dfd37..0ee4bf2 100644 --- a/grammar_test.go +++ b/grammar_test.go @@ -474,6 +474,15 @@ func TestQuote(t *testing.T) { } } +func TestCaseHelpers(t *testing.T) { + if got := Lower("HELLO"); got != "hello" { + t.Fatalf("Lower(%q) = %q, want %q", "HELLO", got, "hello") + } + if got := Upper("hello"); got != "HELLO" { + t.Fatalf("Upper(%q) = %q, want %q", "hello", got, "HELLO") + } +} + func TestArticlePhrase(t *testing.T) { tests := []struct { word string