Version: v2.0.0+incompatible Latest Latest

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

Go to latest
Published: Jan 20, 2014 License: BSD-2-Clause Imports: 8 Imported by: 0



The templating system for gonew (v2).



This section is empty.


This section is empty.


func FileCreate

func FileCreate(path string) (*os.File, error)

Output file creation helper. Creates any missing parent directories. Does not overwrite existing files.


type Environment

type Environment struct {
	// contains filtered or unexported fields

An artificial wrapper struct to make template rendering less cumbersome.

func Env

func Env(v interface{}) Environment

Create an Environment.

func (Environment) Render

func (env Environment) Render(out io.Writer, ts Interface, names ...string) (err error)

Render an ordered set of templates. Halts if a rendering error occurrs.

func (Environment) RenderText

func (env Environment) RenderText(out io.Writer, ts Interface, prefix, text string) (err error)

Render a raw template string using the templates/functions of ts.

func (Environment) RenderTextAsString

func (env Environment) RenderTextAsString(ts Interface, prefix, text string) (string, error)

Like Environment.RenderText, but returns a string containing rendered content.

type ErrNoTemplate

type ErrNoTemplate string

func (ErrNoTemplate) Error

func (err ErrNoTemplate) Error() string

type ErrSourceType

type ErrSourceType struct {
	// contains filtered or unexported fields

func (ErrSourceType) Error

func (err ErrSourceType) Error() string

type Interface

type Interface interface {
	Render(io.Writer, string, interface{}) error // Render a named template.
	Source(interface{}) error                    // Add a template source.
	Funcs(template.FuncMap) error                // Add a set of functions.

A set of templates relatively in-line with template.Template.

func New

func New(ext string) Interface

Create a new template set that recognizes ext as a template file extension.

type SourceDirectory

type SourceDirectory string

type SourceFile

type SourceFile string

type SourceTemplate

type SourceTemplate struct{ Name, Text string }

Jump to

Keyboard shortcuts

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