compiled

package
v0.0.0-...-82db1e9 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2017 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Configuration

type Configuration struct {
	*Registry
	OutPath   string
	OutPkg    string
	Templates []TemplateConfiguration
	FuncsMap  []string
}

Configuration holds all information to run the template compiler.

func New

func New(outpath string, templates []TemplateConfiguration, funcsmap ...string) *Configuration

New creates a new configuration instance

func (*Configuration) SetPkg

func (c *Configuration) SetPkg(s string) *Configuration

SetPkg configures the output package of the produced compilation.

type DataConfiguration

type DataConfiguration struct {
	IsPtr        bool
	DataTypeName string
	DataType     string
	PkgPath      string
}

DataConfiguration holds information about the data type consumed by the template.

type Registry

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

Registry registers compiled templates by their name.

func NewRegistry

func NewRegistry() *Registry

NewRegistry create new instance of Registry

func (Registry) Add

func (t Registry) Add(name string, fn parse.CompiledTemplateFunc)

Add registers a func as a compiled template with given name.

func (Registry) Get

func (t Registry) Get(name string) *template.Compiled

Get provides a compiled template matching given name.

func (Registry) MustGet

func (t Registry) MustGet(name string) *template.Compiled

MustGet provides the compiled template matching given name, it panics if the template is not found.

func (Registry) Set

func (t Registry) Set(name string, tpl *template.Compiled)

Set a compiled template as given name.

type TemplateConfiguration

type TemplateConfiguration struct {
	HTML                       bool
	TemplatesPath              string
	TemplateName               string
	TemplateContent            string
	TemplatesData              map[string]interface{}
	TemplatesDataConfiguration map[string]DataConfiguration
	FuncsMap                   []string
	FuncsExport                map[string]interface{}
	PublicIdents               []map[string]string
}

TemplateConfiguration holds the configuration for a set of template files.

Jump to

Keyboard shortcuts

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