template

package
v0.0.0-...-5c8b849 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package template provides template rendering capabilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRenderer

func NewRenderer(c Config, logger log.Logger) *renderer

NewRenderer creates a configured template renderer.

Types

type Config

type Config struct {
	ViewsPath string `toml:"views_path"`

	BaseURL string `toml:"base_url"`
}

Config describes configuration options for a template renderer.

type Params

type Params map[string]stick.Value

Params contains named values to pass into a template.

type Renderer

type Renderer interface {
	// Render executes the named template and outputs to the given io.Writer.
	Render(name string, req *route.Request, w io.Writer, params Params) error

	// Error renders an error page for the given HTTP status code.
	Error(code int, req *route.Request, w http.ResponseWriter)
}

A Renderer facilitates rendering of templates.

Jump to

Keyboard shortcuts

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