|
|
@ -213,6 +213,7 @@ func (e Engine) renderWithReferences(tpls, referenceTpls map[string]renderable)
|
|
|
|
// We want to parse the templates in a predictable order. The order favors
|
|
|
|
// We want to parse the templates in a predictable order. The order favors
|
|
|
|
// higher-level (in file system) templates over deeply nested templates.
|
|
|
|
// higher-level (in file system) templates over deeply nested templates.
|
|
|
|
keys := sortTemplates(tpls)
|
|
|
|
keys := sortTemplates(tpls)
|
|
|
|
|
|
|
|
referenceKeys := sortTemplates(referenceTpls)
|
|
|
|
|
|
|
|
|
|
|
|
for _, filename := range keys {
|
|
|
|
for _, filename := range keys {
|
|
|
|
r := tpls[filename]
|
|
|
|
r := tpls[filename]
|
|
|
@ -223,8 +224,9 @@ func (e Engine) renderWithReferences(tpls, referenceTpls map[string]renderable)
|
|
|
|
|
|
|
|
|
|
|
|
// Adding the reference templates to the template context
|
|
|
|
// Adding the reference templates to the template context
|
|
|
|
// so they can be referenced in the tpl function
|
|
|
|
// so they can be referenced in the tpl function
|
|
|
|
for filename, r := range referenceTpls {
|
|
|
|
for _, filename := range referenceKeys {
|
|
|
|
if t.Lookup(filename) == nil {
|
|
|
|
if t.Lookup(filename) == nil {
|
|
|
|
|
|
|
|
r := referenceTpls[filename]
|
|
|
|
if _, err := t.New(filename).Parse(r.tpl); err != nil {
|
|
|
|
if _, err := t.New(filename).Parse(r.tpl); err != nil {
|
|
|
|
return map[string]string{}, cleanupParseError(filename, err)
|
|
|
|
return map[string]string{}, cleanupParseError(filename, err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|