echopongo2

package module
v0.0.0-...-5801426 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2017 License: MIT Imports: 8 Imported by: 0

README

echo-pongo2

Use pongo2 templates in the echo web framework

Usage

echo-pongo2 implements the echo Renderer interface

e := echo.New()
r, err := echo-pongo2.NewRenderer("./template")
e.SetRenderer(r)

somewhere in a handler

func Hello(c *echo.Context) error {
    data := map[string]string{"World":"mayowa"}
    return c.Render(http.StatusOK, "hello.html", data)
}

template: ./template/hello.html

Hello {{World}}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Renderer

type Renderer struct {
	BaseDir   string
	DebugMode bool
	TplSet    *pongo2.TemplateSet
}

Renderer manages a pongo2 TemplateSet

func NewRenderer

func NewRenderer(baseDir string, Debug bool) (*Renderer, error)

NewRenderer creates a new instance of Renderer

func (*Renderer) Render

func (r *Renderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error

Render implements echo.Render interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL