pongo2

package module
v0.0.0-...-952494d Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2016 License: MIT Imports: 5 Imported by: 1

README

#Pongo2 Render wercker status GoDoc GoCover

Pongo2.v3 template engine for Neko.

Usage

package main

import (
  "github.com/rocwong/neko"
  "github.com/neko-contrib/pongo2"
)

func main() {
  app := neko.Classic()
  //default: Options{BaseDir: "views", Extension: ".html"}
  //app.Use(pongo2.Renderer())
  
  app.Use(pongo2.Renderer(
    pongo2.Options{
      BaseDir: "template/",
      MultiDir: map[string]string {
        "template-key" : "template2/",
        "custom" : "template3/themes",
      },
      Extension: ".html",
    }),
  )
  app.Run(":3000")
}

func Home(ctx *neko.Context) {
  // use 'BaseDir' path
  ctx.Render("default/index", neko.JSON{})
  // use 'MultiDir' path
  ctx.Render("#template-key/index", neko.JSON{})
}

####type Options

type Options struct {
  // BaseDir represents a base directory of the pongo2 templates.
  BaseDir string
  // MultiDir multiple directories of the pongo2 templates.
  MultiDir map[string]string
  // Extension represents an extension of files.
  Extension string
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Renderer

func Renderer(options ...Options) neko.HandlerFunc

Types

type Options

type Options struct {
	// BaseDir represents a base directory of the pongo2 templates.
	BaseDir string
	// MultiDir multiple directories of the pongo2 templates.
	MultiDir map[string]string
	// Extension represents an extension of files.
	Extension string
}

Jump to

Keyboard shortcuts

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