hugolib: Fix error for non-renderable HTML content with shortcodes

This commit re-introduces template lookup order that was accidently removed as
part of the template nonglobal refactoring.

Fixes #3021
This commit is contained in:
Bjørn Erik Pedersen
2017-02-10 17:26:28 +07:00
parent 25bfa7e12f
commit 2618cfbeaa
2 changed files with 10 additions and 1 deletions

View File

@@ -141,7 +141,6 @@ func (t *GoHTMLTemplate) initFuncs(d *deps.Deps) {
// Hacky, but we need to make sure that the func names are in the global map.
amber.FuncMap[k] = func() string {
panic("should never be invoked")
return ""
}
}
@@ -197,12 +196,18 @@ func (t *GoHTMLTemplate) ExecuteTemplateToHTML(context interface{}, layouts ...s
func (t *GoHTMLTemplate) Lookup(name string) *template.Template {
if templ := t.Template.Lookup(name); templ != nil {
return templ
}
if t.overlays != nil {
if templ, ok := t.overlays[name]; ok {
return templ
}
}
// The clone is used for the non-renderable HTML pages (p.IsRenderable == false) that is parsed
// as Go templates late in the build process.
if t.clone != nil {
if templ := t.clone.Lookup(name); templ != nil {
return templ