Added toUpper and toLower formatting to templates
This commit is contained in:
parent
289e299eb5
commit
a8619111f3
|
@ -150,6 +150,8 @@ func NewTemplateExpander(text string, name string, data interface{}, timestamp m
|
||||||
},
|
},
|
||||||
"match": regexp.MatchString,
|
"match": regexp.MatchString,
|
||||||
"title": strings.Title,
|
"title": strings.Title,
|
||||||
|
"toUpper": strings.ToUpper,
|
||||||
|
"toLower": strings.ToLower,
|
||||||
"graphLink": strutil.GraphLinkForExpression,
|
"graphLink": strutil.GraphLinkForExpression,
|
||||||
"tableLink": strutil.TableLinkForExpression,
|
"tableLink": strutil.TableLinkForExpression,
|
||||||
"sortByLabel": func(label string, v queryResult) queryResult {
|
"sortByLabel": func(label string, v queryResult) queryResult {
|
||||||
|
|
|
@ -164,6 +164,16 @@ func TestTemplateExpansion(t *testing.T) {
|
||||||
text: "{{ \"aa bb CC\" | title }}",
|
text: "{{ \"aa bb CC\" | title }}",
|
||||||
output: "Aa Bb CC",
|
output: "Aa Bb CC",
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
// toUpper.
|
||||||
|
text: "{{ \"aa bb CC\" | toUpper }}",
|
||||||
|
output: "AA BB CC",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// toLower.
|
||||||
|
text: "{{ \"aA bB CC\" | toLower }}",
|
||||||
|
output: "aa bb cc",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
// Match.
|
// Match.
|
||||||
text: "{{ match \"a+\" \"aa\" }} {{ match \"a+\" \"b\" }}",
|
text: "{{ match \"a+\" \"aa\" }} {{ match \"a+\" \"b\" }}",
|
||||||
|
|
Loading…
Reference in New Issue