ace: github.com/yosssi/ace Index | Files

package ace

import "github.com/yosssi/ace"

Package ace provides an HTML template engine.

Index

Package Files

ace.go action.go comment.go compile.go doc.go element.go element_base.go empty_element.go file.go formatter.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

func CompileResult Uses

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

CompileResult compiles the parsed result to the template.Template.

func CompileResultWithTemplate Uses

func CompileResultWithTemplate(t *template.Template, rslt *result, opts *Options) (*template.Template, error)

CompileResultWithTemplate compiles the parsed result and associates it with t.

func FlushCache Uses

func FlushCache()

FlushCache clears all cached templates.

func Load Uses

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

Load loads and returns an HTML template. Each Ace templates are parsed only once and cached if the "DynamicReload" option are not set.

func NewSource Uses

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

NewSource creates and returns source.

func ParseSource Uses

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

ParseSource parses the source and returns the result.

type File Uses

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

File represents a file.

func NewFile Uses

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

NewFile creates and returns a file.

type Formatter Uses

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

func (*Formatter) ClosingElement Uses

func (f *Formatter) ClosingElement(bf *bytes.Buffer, e element) (int, error)

func (*Formatter) OpeningElement Uses

func (f *Formatter) OpeningElement(bf *bytes.Buffer, e element) (int, error)

func (*Formatter) WritingTextValue Uses

func (f *Formatter) WritingTextValue(bf *bytes.Buffer, e element) (int, error)

type Options Uses

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
    // AttributeNameClass is the attribute name for classes.
    AttributeNameClass string
    // NoCloseTagNames defines a set of tags which should not be closed.
    NoCloseTagNames []string
    // DynamicReload represents a flag which means whether Ace reloads
    // templates dynamically.
    // This option should only be true in development.
    DynamicReload bool
    // BaseDir represents a base directory of the Ace templates.
    BaseDir string
    // Indent string used for indentation.
    Indent 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
    // contains filtered or unexported fields
}

Options represents options for the template engine.

func InitializeOptions Uses

func InitializeOptions(opts *Options) *Options

InitializeOptions initializes the options.

func (*Options) AddNoCloseTagName Uses

func (opts *Options) AddNoCloseTagName(name string)

AddNoCloseTagName appends name to .NoCloseTagNames set.

func (*Options) DeleteNoCloseTagName Uses

func (opts *Options) DeleteNoCloseTagName(name string)

DeleteNoCloseTagName deletes name from .NoCloseTagNames set.

Package ace imports 8 packages (graph) and is imported by 265 packages. Updated 2018-12-08. Refresh now. Tools for package owners.