File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -98,11 +98,11 @@ type regTplFunc struct {
98
98
99
99
var regTplFuncs = []regTplFunc {
100
100
// Regular expression for matching {{ TrackLink "http://link.com" }} in the template
101
- // and substituting it with {{ Track "http://link.com" . }} (the dot context)
101
+ // and substituting it with {{ TrackLink "http://link.com" . }} (the dot context)
102
102
// before compilation. This is to make linking easier for users.
103
103
{
104
- regExp : regexp .MustCompile (`{{(\s+)? TrackLink( \s+)?(.+?)(\s+)? }}` ),
105
- replace : `{{ TrackLink $3 . }}` ,
104
+ regExp : regexp .MustCompile (`{{\s* TrackLink\s+"([^"]+)"\s* }}` ),
105
+ replace : `{{ TrackLink "$1" . }}` ,
106
106
},
107
107
108
108
// Convert the shorthand https://google.com@TrackLink to {{ TrackLink ... }}.
@@ -543,6 +543,7 @@ func (c *Campaign) CompileTemplate(f template.FuncMap) error {
543
543
for _ , r := range regTplFuncs {
544
544
body = r .regExp .ReplaceAllString (body , r .replace )
545
545
}
546
+
546
547
baseTPL , err := template .New (BaseTpl ).Funcs (f ).Parse (body )
547
548
if err != nil {
548
549
return fmt .Errorf ("error compiling base template: %v" , err )
You can’t perform that action at this time.
0 commit comments