Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
Types ¶
type RenderRenderer ¶
type RenderRenderer struct {
// contains filtered or unexported fields
}
RenderRenderer is a Renderer implementation that uses unrolled/render (https://godoc.org/github.com/unrolled/render#Render.HTML) to do template rendering
func NewRenderRenderer ¶
func NewRenderRenderer(dir string, extensions []string, funcs []template.FuncMap, dev bool) *RenderRenderer
NewRenderRenderer returns a new RenderRenderer, where the underlying render.Render serves templates out of dir with the given func map. it's configured in dev mode according to the dev boolean
func (*RenderRenderer) Render ¶
func (r *RenderRenderer) Render(w http.ResponseWriter, code int, templateName string, data interface{}, layout string)
Render is the interface implementation
type Renderer ¶
type Renderer interface { // Render renders a template with data and passes the rendered result to w with the given code. // if layout is non-empty, this func renders the template with that name, and the templateName // is rendered under the {{yield}} block. otherwise this func renders the template called templateName Render(w http.ResponseWriter, code int, templateName string, data interface{}, layout string) }
Renderer is the interface to rendering templates. This example repository has an unrolled/render (https://godoc.org/github.com/unrolled/render) implementation, but other implementations are certainly possible
Click to show internal directories.
Click to hide internal directories.