mirror of
https://github.com/Threnklyn/jira.git
synced 2026-06-06 04:58:30 +02:00
add regexReplace template function
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -131,6 +132,10 @@ func TemplateProcessor() *template.Template {
|
|||||||
"color": func(color string) string {
|
"color": func(color string) string {
|
||||||
return ansi.ColorCode(color)
|
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 {
|
"split": func(sep string, content string) []string {
|
||||||
return strings.Split(content, sep)
|
return strings.Split(content, sep)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user