1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-11 17:51:01 +00:00

Use vanilla HTTP handlers (refactoring)

This commit is contained in:
Frédéric Guillot 2018-04-29 16:35:04 -07:00
parent 1eba1730d1
commit f49b42f70f
121 changed files with 4339 additions and 3369 deletions

View file

@ -7,7 +7,6 @@ package template
import (
"bytes"
"html/template"
"io"
"time"
"github.com/miniflux/miniflux/config"
@ -38,7 +37,7 @@ func (e *Engine) parseAll() {
}
// Render process a template and write the ouput.
func (e *Engine) Render(w io.Writer, name, language string, data interface{}) {
func (e *Engine) Render(name, language string, data interface{}) []byte {
tpl, ok := e.templates[name]
if !ok {
logger.Fatal("[Template] The template %s does not exists", name)
@ -74,7 +73,7 @@ func (e *Engine) Render(w io.Writer, name, language string, data interface{}) {
logger.Fatal("[Template] Unable to render template: %v", err)
}
b.WriteTo(w)
return b.Bytes()
}
// NewEngine returns a new template engine.