Versions in this module Expand all Collapse all v6 v6.0.6 Aug 28, 2023 v6.0.5 Aug 23, 2023 v6.0.4 Aug 23, 2023 v6.0.3 Aug 23, 2023 v6.0.2 Aug 23, 2023 v6.0.1 Aug 23, 2023 Changes in this version + const EOF + const TokenError + const TokenHTML + const TokenIdentifier + const TokenKeyword + const TokenNil + const TokenNumber + const TokenString + const TokenSymbol + const Version + var DefaultLoader = MustNewLocalFileSystemLoader("") + var DefaultSet = NewSet("default", DefaultLoader) + var FromBytes = DefaultSet.FromBytes + var FromCache = DefaultSet.FromCache + var FromFile = DefaultSet.FromFile + var FromString = DefaultSet.FromString + var Globals = DefaultSet.Globals + var RenderTemplateFile = DefaultSet.RenderTemplateFile + var RenderTemplateString = DefaultSet.RenderTemplateString + var TokenKeywords = []string + var TokenSymbols = []string + func ApplyFilter(name string, value *Value, param *Value) (*Value, *Error) + func FilterExists(name string) bool + func RegisterFilter(name string, fn FilterFunction) error + func RegisterTag(name string, parserFn TagParser) error + func ReplaceFilter(name string, fn FilterFunction) error + func ReplaceTag(name string, parserFn TagParser) error + func SetAutoescape(newValue bool) + type Context map[string]any + func (c Context) Update(other Context) Context + type Error struct + Column int + Filename string + Line int + OrigError error + Sender string + Template *Template + Token *Token + func (e *Error) Error() string + func (e *Error) RawLine() (line string, available bool, outErr error) + type ExecutionContext struct + Autoescape bool + Private Context + Public Context + Shared Context + func NewChildExecutionContext(parent *ExecutionContext) *ExecutionContext + func (ctx *ExecutionContext) Error(msg string, token *Token) *Error + func (ctx *ExecutionContext) Logf(format string, args ...any) + func (ctx *ExecutionContext) OrigError(err error, token *Token) *Error + type Expression struct + func (expr *Expression) Evaluate(ctx *ExecutionContext) (*Value, *Error) + func (expr *Expression) Execute(ctx *ExecutionContext, writer TemplateWriter) *Error + func (expr *Expression) FilterApplied(name string) bool + func (expr *Expression) GetPositionToken() *Token + type FSLoader struct + func NewFSLoader(fs fs.FS) *FSLoader + func (l *FSLoader) Abs(base, name string) string + func (l *FSLoader) Get(path string) (io.Reader, error) + type FilterFunction func(in *Value, param *Value) (out *Value, err *Error) + type HttpFilesystemLoader struct + func MustNewHttpFileSystemLoader(httpfs http.FileSystem, baseDir string) *HttpFilesystemLoader + func NewHttpFileSystemLoader(httpfs http.FileSystem, baseDir string) (*HttpFilesystemLoader, error) + func (h *HttpFilesystemLoader) Abs(base, name string) string + func (h *HttpFilesystemLoader) Get(path string) (io.Reader, error) + type IEvaluator interface + Evaluate func(*ExecutionContext) (*Value, *Error) + FilterApplied func(name string) bool + GetPositionToken func() *Token + type INode interface + Execute func(*ExecutionContext, TemplateWriter) *Error + type INodeTag interface + type LocalFilesystemLoader struct + func MustNewLocalFileSystemLoader(baseDir string) *LocalFilesystemLoader + func NewLocalFileSystemLoader(baseDir string) (*LocalFilesystemLoader, error) + func (fs *LocalFilesystemLoader) Abs(base, name string) string + func (fs *LocalFilesystemLoader) Get(path string) (io.Reader, error) + func (fs *LocalFilesystemLoader) SetBaseDir(path string) error + type NodeWrapper struct + Endtag string + func (wrapper *NodeWrapper) Execute(ctx *ExecutionContext, writer TemplateWriter) *Error + type Options struct + LStripBlocks bool + TrimBlocks bool + func (opt *Options) Update(other *Options) *Options + type Parser struct + func (p *Parser) Consume() + func (p *Parser) ConsumeN(count int) + func (p *Parser) Count() int + func (p *Parser) Current() *Token + func (p *Parser) Error(msg string, token *Token) *Error + func (p *Parser) Get(i int) *Token + func (p *Parser) GetR(shift int) *Token + func (p *Parser) Match(typ TokenType, val string) *Token + func (p *Parser) MatchOne(typ TokenType, vals ...string) *Token + func (p *Parser) MatchType(typ TokenType) *Token + func (p *Parser) ParseExpression() (IEvaluator, *Error) + func (p *Parser) Peek(typ TokenType, val string) *Token + func (p *Parser) PeekN(shift int, typ TokenType, val string) *Token + func (p *Parser) PeekOne(typ TokenType, vals ...string) *Token + func (p *Parser) PeekType(typ TokenType) *Token + func (p *Parser) PeekTypeN(shift int, typ TokenType) *Token + func (p *Parser) Remaining() int + func (p *Parser) SkipUntilTag(names ...string) *Error + func (p *Parser) WrapUntilTag(names ...string) (*NodeWrapper, *Parser, *Error) + type SandboxedFilesystemLoader struct + func NewSandboxedFilesystemLoader(baseDir string) (*SandboxedFilesystemLoader, error) + type TagParser func(doc *Parser, start *Token, arguments *Parser) (INodeTag, *Error) + type Template struct + Options *Options + func Must(tpl *Template, err error) *Template + func (tpl *Template) Execute(context Context) (string, error) + func (tpl *Template) ExecuteBlocks(context Context, blocks []string) (map[string]string, error) + func (tpl *Template) ExecuteBytes(context Context) ([]byte, error) + func (tpl *Template) ExecuteWriter(context Context, writer io.Writer) error + func (tpl *Template) ExecuteWriterUnbuffered(context Context, writer io.Writer) error + type TemplateLoader interface + Abs func(base, name string) string + Get func(path string) (io.Reader, error) + type TemplateSet struct + Debug bool + Globals Context + Options *Options + func NewSet(name string, loaders ...TemplateLoader) *TemplateSet + func (set *TemplateSet) AddLoader(loaders ...TemplateLoader) + func (set *TemplateSet) BanFilter(name string) error + func (set *TemplateSet) BanTag(name string) error + func (set *TemplateSet) CleanCache(filenames ...string) + func (set *TemplateSet) FromBytes(tpl []byte) (*Template, error) + func (set *TemplateSet) FromCache(filename string) (*Template, error) + func (set *TemplateSet) FromFile(filename string) (*Template, error) + func (set *TemplateSet) FromString(tpl string) (*Template, error) + func (set *TemplateSet) RenderTemplateBytes(b []byte, ctx Context) (string, error) + func (set *TemplateSet) RenderTemplateFile(fn string, ctx Context) (string, error) + func (set *TemplateSet) RenderTemplateString(s string, ctx Context) (string, error) + type TemplateWriter interface + WriteString func(string) (int, error) + type Token struct + Col int + Filename string + Line int + TrimWhitespaces bool + Typ TokenType + Val string + func (t *Token) String() string + type TokenType int + type Value struct + func AsSafeValue(i any) *Value + func AsValue(i any) *Value + func MustApplyFilter(name string, value *Value, param *Value) *Value + func (v *Value) Bool() bool + func (v *Value) CanSlice() bool + func (v *Value) Contains(other *Value) bool + func (v *Value) EqualValueTo(other *Value) bool + func (v *Value) Float() float64 + func (v *Value) Index(i int) *Value + func (v *Value) Integer() int + func (v *Value) Interface() any + func (v *Value) IsBool() bool + func (v *Value) IsFloat() bool + func (v *Value) IsInteger() bool + func (v *Value) IsNil() bool + func (v *Value) IsNumber() bool + func (v *Value) IsString() bool + func (v *Value) IsTime() bool + func (v *Value) IsTrue() bool + func (v *Value) Iterate(fn func(idx, count int, key, value *Value) bool, empty func()) + func (v *Value) IterateOrder(fn func(idx, count int, key, value *Value) bool, empty func(), reverse bool, ...) + func (v *Value) Len() int + func (v *Value) Negate() *Value + func (v *Value) Slice(i, j int) *Value + func (v *Value) String() string + func (v *Value) Time() time.Time