ace – github.com/yosssi/ace Index | Files | Directories

package ace

import "github.com/yosssi/ace"

Package ace provides an HTML template engine.

Index

Functions

func CompileResult

func CompileResult(name string, rslt *result, opts *Options) (*template.Template, error)

CompileResult compiles the parsed result to the template.Template.

func NewSource

func NewSource(base, inner *File, includes []*File) *source

NewSource creates and returns source.

func ParseFiles

func ParseFiles(basePath, innerPath string, opts *Options) (*template.Template, error)

ParseFiles parses template files and returns an HTML template.

func ParseSource

func ParseSource(src *source, opts *Options) (*result, error)

ParseSource parses the source and returns the result.

Types

type File

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

File represents a file.

func NewFile

func NewFile(path string, data []byte) *File

NewFile creates and returns a file.

type Options

type Options struct {
	// Extension represents an extension of files.
	Extension string
	// DelimLeft represents a left delimiter for the html template.
	DelimLeft string
	// DelimRight represents a right delimiter for the html template.
	DelimRight string
	// Cache represents a flag which means whether Ace caches the parsed
	// templates or not.
	// This option should be true in production.
	Cache bool
	// BaseDir represents a base directory of the Ace templates.
	BaseDir string
	// Asset loads and returns the asset for the given name.
	// If this function is set, Ace load the template data from
	// this function instead of the template files.
	Asset func(name string) ([]byte, error)
	// FuncMap represents a template.FuncMap which is set to
	// the result template.
	FuncMap template.FuncMap
}

Options represents options for the template engine.

Source Files

ace.go action.go comment.go compile.go doc.go element.go element_base.go empty_element.go file.go helper_method_conditional_comment.go helper_method_content.go helper_method_css.go helper_method_doctype.go helper_method_include.go helper_method_javascript.go helper_method_yield.go html_comment.go html_tag.go line.go options.go parse.go plain_text.go plain_text_inner.go read.go result.go source.go

Directories

PathSynopsis
examples
examples/actions
examples/base_inner_template
examples/cache
examples/change_action_delimiter
examples/comments
examples/css_javascript_helper_method
examples/html_tags
examples/include_helper_method
examples/load_templates_from_binary_data
examples/pass_pipeline_to_included_template
examples/plain_texts
examples/set_custom_functions
examples/set_default_value_to_the_yield_helper_method
examples/single_template
Version
v0.0.2
Published
Jul 27, 2014
Platform
windows/amd64
Imports
8 packages
Last checked
now

Tools for package owners.