mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-18 20:23:28 +02:00
add regexReplace template function
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -131,6 +132,10 @@ func TemplateProcessor() *template.Template {
|
||||
"color": func(color string) string {
|
||||
return ansi.ColorCode(color)
|
||||
},
|
||||
"regReplace": func(search string, replace string, content string) string {
|
||||
re := regexp.MustCompile(search)
|
||||
return re.ReplaceAllString(content, replace)
|
||||
},
|
||||
"split": func(sep string, content string) []string {
|
||||
return strings.Split(content, sep)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user