func makeFuncMap() template.FuncMap {
	return template.FuncMap{
		"title": strings.Title,
		"lower": strings.ToLower,
		"upper": strings.ToUpper,
		"yesno": func(yes string, no string, value ...bool) string {
			if len(value) > 0 && value[0] {
				return yes
			}
			return no
		},
		"firstLower": func(s string) RichString {
			return RichString(s).FirstLower()
		},
		"firstUpper": func(s string) RichString {
			return RichString(s).FirstUpper()
		},
		// splitDotFirst returns the first part of a string split on a "."
		// Useful for the case in which you want the package name from a passed value
		// like "package.Type"
		"splitDotFirst": func(s string) RichString {
			first, _ := RichString(s).DivideLastOr0('.')
			return first
		},
		// splitDotLast returns the last part of a string split on a "."
		// Useful for the case in which you want the type name from a passed value
		// like "package.Type"
		"splitDotLast": func(s string) RichString {
			_, second := RichString(s).DivideLastOr0('.')
			return second
		},
	}
}
// Set up some text munging functions that will be available in the templates.
Set up some text munging functions that will be available in the templates.
// Set up some text munging functions that will be available in the templates .
func makeFuncMap() template.FuncMap {
	return template.FuncMap{
		"title": strings.Title,
		"lower": strings.ToLower,
		"upper": strings.ToUpper,
		"yesno": func(yes string, no string, value ...bool) string {
			if len(value) > 0 && value[0] {
				return yes
			}
			return no
		},
		"firstLower": func(s string) RichString {
			return RichString(s).FirstLower()
		},
		"firstUpper": func(s string) RichString {
			return RichString(s).FirstUpper()
		},
		"splitDotFirst": func(s string) RichString {
			first, _ := RichString(s).DivideLastOr0('.')
			return first
		},
		"splitDotLast": func(s string) RichString {
			_, second := RichString(s).DivideLastOr0('.')
			return second
		},
	}
}
func makeFuncMap ( ) template . FuncMap { return template . FuncMap { " " : strings . Title , " " : strings . ToLower , " " : strings . ToUpper , " " : func ( yes string , no string , value ... bool ) string { if len ( value ) > 0 && value [ 0 ] { return yes } return no } , " " : func ( s string ) RichString { return RichString ( s ) . FirstLower ( ) } , " " : func ( s string ) RichString { return RichString ( s ) . FirstUpper ( ) } , " " : func ( s string ) RichString { first , _ := RichString ( s ) . DivideLastOr0 ( '.' ) return first } , " " : func ( s string ) RichString { _ , second := RichString ( s ) . DivideLastOr0 ( '.' ) return second } , } }
Set up some text munging functions that will be available in the templates.
Set up some text munging functions that will be available in the templates .
// splitDotFirst returns the first part of a string split on a "." // Useful for the case in which you want the package name from a passed value // like "package.Type" // splitDotLast returns the last part of a string split on a "." // Useful for the case in which you want the type name from a passed value // like "package.Type"