Fix server reload when non-HTML shortcode changes

Fixes #7448
This commit is contained in:
Bjørn Erik Pedersen
2020-07-03 18:02:32 +02:00
parent 028b356787
commit 42e150fbfa
6 changed files with 83 additions and 13 deletions

View File

@@ -354,6 +354,23 @@ func (t *templateHandler) LookupVariant(name string, variants tpl.TemplateVarian
}
// LookupVariants returns all variants of name, nil if none found.
func (t *templateHandler) LookupVariants(name string) []tpl.Template {
name = templateBaseName(templateShortcode, name)
s, found := t.shortcodes[name]
if !found {
return nil
}
variants := make([]tpl.Template, len(s.variants))
for i := 0; i < len(variants); i++ {
variants[i] = s.variants[i].ts
}
return variants
}
func (t *templateHandler) HasTemplate(name string) bool {
if _, found := t.baseof[name]; found {
@@ -966,6 +983,10 @@ func (t *textTemplateWrapperWithLock) LookupVariant(name string, variants tpl.Te
panic("not supported")
}
func (t *textTemplateWrapperWithLock) LookupVariants(name string) []tpl.Template {
panic("not supported")
}
func (t *textTemplateWrapperWithLock) Parse(name, tpl string) (tpl.Template, error) {
t.Lock()
defer t.Unlock()