diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-01-31 11:53:21 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-01-31 19:08:19 +0100 |
commit | c52045bbb38cbf64b9cb39352230060aa122cc9f (patch) | |
tree | 4fb593b4d9ffc02ba5ece270c86437d5d6ddf809 /tpl | |
parent | 8ed2a1caa9e0892d5bf97ed1b7279befa159f764 (diff) |
Fix some inline shortcode issues
Fixes #5645
Fixes #5653
Diffstat (limited to 'tpl')
-rw-r--r-- | tpl/tplimpl/template.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/tpl/tplimpl/template.go b/tpl/tplimpl/template.go index 144bafdd8..8efeb6ce9 100644 --- a/tpl/tplimpl/template.go +++ b/tpl/tplimpl/template.go @@ -366,7 +366,8 @@ func (t *htmlTemplates) addLateTemplate(name, tpl string) error { } type textTemplate struct { - t *texttemplate.Template + mu sync.RWMutex + t *texttemplate.Template } func (t *textTemplate) Parse(name, tpl string) (tpl.Template, error) { @@ -374,11 +375,17 @@ func (t *textTemplate) Parse(name, tpl string) (tpl.Template, error) { } func (t *textTemplate) Lookup(name string) (tpl.Template, bool) { + t.mu.RLock() + defer t.mu.RUnlock() + tpl := t.t.Lookup(name) return tpl, tpl != nil } func (t *textTemplate) parSeIn(tt *texttemplate.Template, name, tpl string) (*texttemplate.Template, error) { + t.mu.Lock() + defer t.mu.Unlock() + templ, err := tt.New(name).Parse(tpl) if err != nil { return nil, err |