Replace *bytes.Buffer with io.Writer in rendering

Found via github.com/mvdan/interfacer.
This commit is contained in:
Daniel Martí
2016-01-03 12:53:45 +01:00
committed by Bjørn Erik Pedersen
parent 4c596483e1
commit 7c5a1fd16b
2 changed files with 4 additions and 5 deletions

View File

@@ -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)
}