File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -81,9 +81,6 @@ func StripANSI(input string) string {
8181 return ansiRegex .ReplaceAllString (input , "" )
8282}
8383
84- // titleCaser is a reusable title caser for English
85- var titleCaser = cases .Title (language .English )
86-
8784// smallWords are words that should remain lowercase in titles (unless first word)
8885var smallWords = map [string ]bool {
8986 "of" : true ,
@@ -95,14 +92,16 @@ var smallWords = map[string]bool{
9592// CapitalizeResourceName converts hyphenated resource names to title case
9693// Example: "strong-jaw" -> "Strong Jaw", "sword-of-ruin" -> "Sword of Ruin"
9794func CapitalizeResourceName (name string ) string {
95+ caser := cases .Title (language .English )
96+
9897 name = strings .ReplaceAll (name , "-" , " " )
9998 words := strings .Split (name , " " )
10099
101100 for i , word := range words {
102101 if _ , found := smallWords [strings .ToLower (word )]; found && i != 0 {
103102 words [i ] = strings .ToLower (word )
104103 } else {
105- words [i ] = titleCaser .String (word )
104+ words [i ] = caser .String (word )
106105 }
107106 }
108107
You can’t perform that action at this time.
0 commit comments