using § marker - Closes #347

dev
Mzack9999 2020-10-11 19:37:34 +02:00
parent 83aef7e468
commit 236f3b2dfb
1 changed files with 8 additions and 1 deletions

View File

@ -8,10 +8,17 @@ import (
"strings"
)
const (
MARKER_PARENTHESIS_OPEN = "{{"
MARKER_PARENTHESIS_CLOSE = "}}"
MARKER_GENERAL = "§"
)
func newReplacer(values map[string]interface{}) *strings.Replacer {
var replacerItems []string
for k, v := range values {
replacerItems = append(replacerItems, fmt.Sprintf("{{%s}}", k), fmt.Sprintf("%s", v), k, fmt.Sprintf("%s", v))
replacerItems = append(replacerItems, fmt.Sprintf("%s%s%s", MARKER_PARENTHESIS_OPEN, k, MARKER_PARENTHESIS_CLOSE), fmt.Sprintf("%s", v))
replacerItems = append(replacerItems, fmt.Sprintf("%s%s%s", MARKER_GENERAL, k, MARKER_GENERAL), fmt.Sprintf("%s", v))
}
return strings.NewReplacer(replacerItems...)