Skip to content
This repository has been archived by the owner on Nov 17, 2019. It is now read-only.

Latest commit

 

History

History
35 lines (26 loc) · 673 Bytes

2-pongo2-renders.md

File metadata and controls

35 lines (26 loc) · 673 Bytes

Pongo2 template engine

Middleware tpongo2 is a pongo2.v3 template engine support for Tango.

Installation

go get github.com/tango-contrib/tpongo2

Simple Example

package main

import (
    "github.com/lunny/tango"
    "gopkg.in/flosch/pongo2.v3"
    "github.com/tango-contrib/tpongo2"
)

type RenderAction struct {
    tpango2.Renderer
}

func (a *RenderAction) Get() error {
    return a.RenderString("Hello {{ name }}!", pongo2.Context{
        "name": "tango",
    })
}

func main() {
    o := tango.Classic()
    o.Use(tpango2.New())
    o.Get("/", new(RenderAction))
}