mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-28 22:19:59 +02:00
@@ -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()
|
||||
|
Reference in New Issue
Block a user