mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-01 18:58:26 +02:00
Add a 'join' func to the template engine
I needed this so that I can display JIRA labels in my 'list' template.
This commit is contained in:
@@ -161,6 +161,13 @@ func runTemplate(templateContent string, data interface{}, out io.Writer) error
|
|||||||
"split": func(sep string, content string) []string {
|
"split": func(sep string, content string) []string {
|
||||||
return strings.Split(content, sep)
|
return strings.Split(content, sep)
|
||||||
},
|
},
|
||||||
|
"join": func(sep string, content []interface{}) string {
|
||||||
|
vals := make([]string, len(content))
|
||||||
|
for i, v := range content {
|
||||||
|
vals[i] = v.(string)
|
||||||
|
}
|
||||||
|
return strings.Join(vals, sep)
|
||||||
|
},
|
||||||
"abbrev": func(max int, content string) string {
|
"abbrev": func(max int, content string) string {
|
||||||
if len(content) > max {
|
if len(content) > max {
|
||||||
var buffer bytes.Buffer
|
var buffer bytes.Buffer
|
||||||
|
|||||||
Reference in New Issue
Block a user