Documentation ¶
Overview ¶
Package pongo2gin is a template renderer that can be used with the Gin web framework https://github.com/gin-gonic/gin it uses the Pongo2 template library https://github.com/flosch/pongo2
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pongo2Render ¶
type Pongo2Render struct { Options *RenderOptions Template *pongo2.Template Context pongo2.Context }
Pongo2Render is a custom Gin template renderer using Pongo2.
func Default ¶
func Default() *Pongo2Render
Default creates a Pongo2Render instance with default options.
func New ¶
func New(options RenderOptions) *Pongo2Render
New creates a new Pongo2Render instance with custom Options.
func (Pongo2Render) Instance ¶
func (p Pongo2Render) Instance(name string, data interface{}) render.Render
Instance should return a new Pongo2Render struct per request and prepare the template by either loading it from disk or using pongo2's cache.
func (Pongo2Render) Render ¶
func (p Pongo2Render) Render(w http.ResponseWriter) error
Render should render the template to the response.
func (Pongo2Render) WriteContentType ¶
func (p Pongo2Render) WriteContentType(w http.ResponseWriter)
WriteContentType should add the Content-Type header to the response when not set yet.
type RenderOptions ¶
RenderOptions is used to configure the renderer.