mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
@@ -40,6 +40,10 @@ func (templateFinder) LookupVariant(name string, variants tpl.TemplateVariants)
|
||||
return nil, false, false
|
||||
}
|
||||
|
||||
func (templateFinder) LookupVariants(name string) []tpl.Template {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (templateFinder) LookupLayout(d output.LayoutDescriptor, f output.Format) (tpl.Template, bool, error) {
|
||||
return nil, false, nil
|
||||
}
|
||||
|
@@ -68,6 +68,7 @@ type TemplateLookupVariant interface {
|
||||
// We are currently only interested in output formats, so we should improve
|
||||
// this for speed.
|
||||
LookupVariant(name string, variants TemplateVariants) (Template, bool, bool)
|
||||
LookupVariants(name string) []Template
|
||||
}
|
||||
|
||||
// Template is the common interface between text/template and html/template.
|
||||
|
@@ -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