goat

package module
v0.0.0-...-867c6ed Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2014 License: MIT Imports: 6 Imported by: 0

README

goat

Go Advanced Templates - library that wraps text/template and html/template. The goal is to be able to use templates with the least amount of effort possible.

Build Status

state of the project

Currently the state is at about alpha or beta. The project has not been used in any type of production environment. Use it at your own risk. For documentation - currently there is none. You can look at flow_test.go - it might give you the idea of how goat is supposed to be used.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TemplateFactory *templateFactory = newTemplateFactory()

Functions

func CopyMap

func CopyMap(source map[string]interface{}) map[string]interface{}

func ReplaceAll

func ReplaceAll(s string, old, new []string) string

Types

type HtmlTemplate

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

func (*HtmlTemplate) ExecuteTemplate

func (this *HtmlTemplate) ExecuteTemplate(writer io.Writer, name string, data interface{}) error

func (*HtmlTemplate) Funcs

func (this *HtmlTemplate) Funcs(funcMap map[string]interface{})

func (*HtmlTemplate) ParseGlob

func (this *HtmlTemplate) ParseGlob(pattern string) error

type Loader

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

func NewLoader

func NewLoader(templateRoot string) *Loader

func (*Loader) AddPatterns

func (this *Loader) AddPatterns(patterns ...string)

func (*Loader) DefaultKind

func (this *Loader) DefaultKind() string

func (*Loader) ExecNamePattern

func (this *Loader) ExecNamePattern() string

func (*Loader) Funcs

func (this *Loader) Funcs(funcMap map[string]interface{})

func (*Loader) Get

func (this *Loader) Get(group, name string) (*Template, error)

func (*Loader) GetFull

func (this *Loader) GetFull(kind, group, name string) (*Template, error)

func (*Loader) GetValue

func (this *Loader) GetValue(name string) interface{}

func (*Loader) Patterns

func (this *Loader) Patterns() []string

func (*Loader) SetDefaultKind

func (this *Loader) SetDefaultKind(kind string)

func (*Loader) SetExecNamePattern

func (this *Loader) SetExecNamePattern(execNamePattern string)

func (*Loader) SetPatterns

func (this *Loader) SetPatterns(patterns []string)

func (*Loader) SetTemplateRoot

func (this *Loader) SetTemplateRoot(root string)

func (*Loader) SetValue

func (this *Loader) SetValue(name string, value interface{})

func (*Loader) TemplateRoot

func (this *Loader) TemplateRoot() string

type Template

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

func NewTemplate

func NewTemplate(kind, group, name string, patterns []string, execName string, globalFuncs map[string]interface{}, globalValues map[string]interface{}) *Template

func (*Template) Execute

func (this *Template) Execute(writer io.Writer, data interface{}) error

func (*Template) ExecuteTemplate

func (this *Template) ExecuteTemplate(writer io.Writer, name string, data interface{}) error

func (*Template) Funcs

func (this *Template) Funcs(funcMap map[string]interface{})

func (*Template) GetValue

func (this *Template) GetValue(name string) interface{}

func (*Template) Group

func (this *Template) Group() string

func (*Template) Kind

func (this *Template) Kind() string

func (*Template) Name

func (this *Template) Name() string

func (*Template) ParseGlob

func (this *Template) ParseGlob(pattern string) error

func (*Template) Patterns

func (this *Template) Patterns() []string

func (*Template) SetValue

func (this *Template) SetValue(name string, value interface{})

type TemplateCore

type TemplateCore interface {
	Funcs(funcMap map[string]interface{})
	ParseGlob(pattern string) error
	ExecuteTemplate(writer io.Writer, name string, data interface{}) error
}

func NewHtmlTemplate

func NewHtmlTemplate(name string) TemplateCore

func NewTextTemplate

func NewTextTemplate(name string) TemplateCore

type TemplateCoreConstructor

type TemplateCoreConstructor func(name string) TemplateCore

type TextTemplate

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

func (*TextTemplate) ExecuteTemplate

func (this *TextTemplate) ExecuteTemplate(writer io.Writer, name string, data interface{}) error

func (*TextTemplate) Funcs

func (this *TextTemplate) Funcs(funcMap map[string]interface{})

func (*TextTemplate) ParseGlob

func (this *TextTemplate) ParseGlob(pattern string) error

Jump to

Keyboard shortcuts

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