renderer

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

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

Go to latest
Published: Jan 6, 2017 License: MIT Imports: 11 Imported by: 0

README

Renderer

Build Status Coverage Status GoDoc license

Renderer provides a wrapper for unrolled/render's Render instance that implements the labstack/echo Renderer interface for template rendering.

Install

With a properly configured Go toolchain:

go get -u github.com/syntaqx/renderer

Example

The minimum amount needed to set render as your apps template renderer is the following:

package main

import (
    "github.com/labstack/echo"
    "github.com/syntaqx/renderer"
    "github.com/unrolled/render"
)

func main() {
    e := echo.New()
    r := render.New()

    e.Renderer = renderer.Wrap(r)

    // ... the rest of your application

    e.Logger.Fatal(e.Start(":8080"))
}

However, that's not a particularly useful example, given there's no routes or templates to reference. For a bit more elaborate example, check out our example.

Contributing

Please feel free to submit issues and send pull requests!

License

Renderer is licensed under the MIT license. See LICENSE file for details.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultFuncs = template.FuncMap{
	"dateFormat":   dateFormat,
	"htmlEscape":   htmlEscape,
	"htmlUnescape": htmlUnescape,
	"safeHTML":     safeHTML,
	"safeURL":      safeURL,
	"dict":         dictionary,
	"querify":      querify,
}

DefaultFuncs is a map of highly reusable template functions that can optionally be appended to a `render.Render` FuncMap

Functions

This section is empty.

Types

type RenderWrapper

type RenderWrapper struct {
	// contains filtered or unexported fields
}

RenderWrapper ...

func Wrap

func Wrap(r *render.Render) *RenderWrapper

Wrap ...

func (*RenderWrapper) Render

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

Render ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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