-
Notifications
You must be signed in to change notification settings - Fork 45
/
utils.go
34 lines (29 loc) · 977 Bytes
/
utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package mermaid
import (
"strings"
"github.com/anz-bank/sysl/pkg/parse"
"github.com/anz-bank/sysl/pkg/syslutil"
)
const GeneratedHeader = "%% AUTOGENERATED CODE -- DO NOT EDIT!\n\n"
const ProjectDir = "../../../"
//cleanString replaces certain characters in the string suitable for mermaid
func CleanString(temp string) string {
temp = parse.MustUnescape(temp)
temp = strings.ReplaceAll(temp, " ", "")
temp = strings.ReplaceAll(temp, "{", "_")
temp = strings.ReplaceAll(temp, "}", "_")
temp = strings.ReplaceAll(temp, "[", "_")
temp = strings.ReplaceAll(temp, "]", "_")
temp = strings.ReplaceAll(temp, "\"", "")
temp = strings.ReplaceAll(temp, "~", "")
temp = strings.ReplaceAll(temp, ":", "_")
temp = strings.ReplaceAll(temp, "<", "")
return temp
}
func CleanAppNames(appNames []string) []string {
var cleanedAppNames []string
for _, a := range appNames {
cleanedAppNames = append(cleanedAppNames, syslutil.CleanAppName(a))
}
return cleanedAppNames
}