mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-29 22:29:56 +02:00
Replace *bytes.Buffer with io.Writer in rendering
Found via github.com/mvdan/interfacer.
This commit is contained in:
committed by
Bjørn Erik Pedersen
parent
4c596483e1
commit
7c5a1fd16b
@@ -14,7 +14,6 @@
|
||||
package tpl
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"github.com/eknkc/amber"
|
||||
bp "github.com/spf13/hugo/bufferpool"
|
||||
@@ -104,7 +103,7 @@ func Partial(name string, context_list ...interface{}) template.HTML {
|
||||
return ExecuteTemplateToHTML(context, "partials/"+name, "theme/partials/"+name)
|
||||
}
|
||||
|
||||
func ExecuteTemplate(context interface{}, buffer *bytes.Buffer, layouts ...string) {
|
||||
func ExecuteTemplate(context interface{}, w io.Writer, layouts ...string) {
|
||||
worked := false
|
||||
for _, layout := range layouts {
|
||||
|
||||
@@ -115,7 +114,7 @@ func ExecuteTemplate(context interface{}, buffer *bytes.Buffer, layouts ...strin
|
||||
}
|
||||
|
||||
if localTemplates.Lookup(name) != nil {
|
||||
err := localTemplates.ExecuteTemplate(buffer, name, context)
|
||||
err := localTemplates.ExecuteTemplate(w, name, context)
|
||||
if err != nil {
|
||||
jww.ERROR.Println(err, "in", name)
|
||||
}
|
||||
|
Reference in New Issue
Block a user