Fix some inline shortcode issues

Fixes #5645
Fixes #5653
This commit is contained in:
Bjørn Erik Pedersen
2019-01-31 11:53:21 +01:00
parent 8ed2a1caa9
commit c52045bbb3
5 changed files with 66 additions and 23 deletions

View File

@@ -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