Versions in this module Expand all Collapse all v0 v0.1.1 Feb 18, 2026 v0.1.0 Jan 29, 2026 Changes in this version + const ErrorTypeFilter + const ErrorTypeInheritance + const ErrorTypeMacro + const ErrorTypeRuntime + const ErrorTypeSyntax + const ErrorTypeTemplate + const ErrorTypeTest + const ErrorTypeType + const ErrorTypeUndefined + var ContextPool = sync.Pool + var FastStringBuilderPool = sync.Pool + var GlobalByteBufferPool = NewByteBufferPool() + var GlobalConcurrentCache = NewConcurrentCacheManager() + var GlobalConcurrentContextPool = NewConcurrentContextPool() + var GlobalEnvironmentRegistry = NewConcurrentEnvironmentRegistry() + var GlobalErrorRecovery = NewErrorRecovery() + var GlobalMemoryProfiler = NewMemoryProfiler() + var GlobalPrecomputedHash = NewPrecomputedHash() + var GlobalSlicePool = &SlicePool + var GlobalSmallStringOptimizer = NewSmallStringOptimizer() + var GlobalStringInterner = NewStringInterner() + var GlobalSyntaxErrorHelper = NewSyntaxErrorHelper() + var GlobalTemplateDebugger = NewTemplateDebugger() + var GlobalTemplateValidator = NewTemplateValidator() + var StringBuilderPool = sync.Pool + func GetStringBuilder() *strings.Builder + func PutContext(ctx Context) + func PutFastStringBuilder(fsb *FastStringBuilder) + func PutStringBuilder(sb *strings.Builder) + func RenderString(source string, context Context) (string, error) + func RenderTemplate(name string, context Context) (string, error) + func SetDefaultLoader(loader Loader) + type ByteBufferPool struct + func NewByteBufferPool() *ByteBufferPool + func (bbp *ByteBufferPool) Get() []byte + func (bbp *ByteBufferPool) Put(buf []byte) + type CacheKey struct + Hash uint64 + Template string + type CachedEnvironment struct + func NewCachedEnvironment(opts ...EnvironmentOption) *CachedEnvironment + func (ce *CachedEnvironment) FromStringCached(source string) (*Template, error) + type CachedEnvironmentOptions struct + ByteBufferPoolSize int + ContextPoolSize int + TemplatePoolSize int + UseStringInterning bool + func DefaultCachedOptions() *CachedEnvironmentOptions + type CachedTemplate struct + func NewCachedTemplate(tmpl *Template) *CachedTemplate + func (ct *CachedTemplate) RenderCached(ctx Context) (string, error) + type ConcurrentCacheManager struct + func NewConcurrentCacheManager() *ConcurrentCacheManager + func (ccm *ConcurrentCacheManager) Delete(key string) + func (ccm *ConcurrentCacheManager) Get(key string) (interface{}, bool) + func (ccm *ConcurrentCacheManager) GetStats() (hits, misses int64) + func (ccm *ConcurrentCacheManager) Set(key string, value interface{}) + type ConcurrentContextPool struct + func NewConcurrentContextPool() *ConcurrentContextPool + func (ccp *ConcurrentContextPool) Get() Context + func (ccp *ConcurrentContextPool) GetStats() (gets, puts int64) + func (ccp *ConcurrentContextPool) Put(ctx Context) + type ConcurrentEnvironmentRegistry struct + func NewConcurrentEnvironmentRegistry() *ConcurrentEnvironmentRegistry + func (cer *ConcurrentEnvironmentRegistry) GetDefaultEnvironment() *ThreadSafeEnvironment + func (cer *ConcurrentEnvironmentRegistry) GetEnvironment(name string) (*ThreadSafeEnvironment, bool) + func (cer *ConcurrentEnvironmentRegistry) RegisterEnvironment(name string, env *ThreadSafeEnvironment) + type ConcurrentTemplateRenderer struct + func NewConcurrentTemplateRenderer(template *Template, workers int) *ConcurrentTemplateRenderer + func (ctr *ConcurrentTemplateRenderer) RenderAsync(ctx Context) <-chan renderResult + func (ctr *ConcurrentTemplateRenderer) RenderBatch(contexts []Context) ([]string, []error) + func (ctr *ConcurrentTemplateRenderer) Start() + func (ctr *ConcurrentTemplateRenderer) Stop() + type Context interface + All func() map[string]interface{} + Clone func() Context + Get func(key string) (interface{}, bool) + GetEnv func() *Environment + Pop func() Context + Push func() Context + Set func(key string, value interface{}) + func GetContext() Context + func NewCOWContext() Context + func NewCOWContextFrom(data map[string]interface{}) Context + func NewContext() Context + func NewContextFrom(data map[string]interface{}) Context + type ContextInterface interface + All func() map[string]interface{} + Get func(key string) (interface{}, bool) + Pop func() ContextInterface + Push func() ContextInterface + Set func(key string, value interface{}) + type DebugEvent struct + Column int + Line int + Message string + TemplateName string + Timestamp time.Time + Type string + Variables map[string]interface{} + type DebugInfo struct + AvailableFilters []string + AvailableTests []string + ExecutionTime int64 + MemoryUsage int64 + TemplatePath []string + Variables map[string]interface{} + type DebugLevel int + const DebugLevelBasic + const DebugLevelDetailed + const DebugLevelOff + const DebugLevelVerbose + type DebugTracer struct + func NewDebugTracer() *DebugTracer + func (dt *DebugTracer) AddFilter(eventType string) + func (dt *DebugTracer) Clear() + func (dt *DebugTracer) Disable() + func (dt *DebugTracer) Enable() + func (dt *DebugTracer) GetDetailedLog() string + func (dt *DebugTracer) GetEvents() []DebugEvent + func (dt *DebugTracer) GetSummary() string + func (dt *DebugTracer) RemoveFilter(eventType string) + func (dt *DebugTracer) SetLevel(level DebugLevel) + func (dt *DebugTracer) TraceEvent(eventType, templateName string, line, column int, message string, ...) + type EnhancedTemplateError struct + Column int + Context string + Line int + Message string + Source string + StackTrace []StackFrame + Suggestion string + TemplateName string + Type string + func NewEnhancedTemplateError(errorType, message, templateName string, line, column int) *EnhancedTemplateError + func (te *EnhancedTemplateError) DetailedError() string + func (te *EnhancedTemplateError) Error() string + func (te *EnhancedTemplateError) Unwrap() error + func (te *EnhancedTemplateError) WithContext(context string) *EnhancedTemplateError + func (te *EnhancedTemplateError) WithSource(source string) *EnhancedTemplateError + func (te *EnhancedTemplateError) WithStackFrame(templateName string, line, column int, function string) *EnhancedTemplateError + func (te *EnhancedTemplateError) WithSuggestion(suggestion string) *EnhancedTemplateError + type Environment struct + func NewEnvironment(opts ...EnvironmentOption) *Environment + func (e *Environment) AddExtension(extension extensions.Extension) error + func (e *Environment) AddFilter(name string, filter interface{}) error + func (e *Environment) AddFilterLegacy(name string, filter FilterFunc) error + func (e *Environment) AddGlobal(name string, value interface{}) + func (e *Environment) AddTest(name string, test interface{}) error + func (e *Environment) ApplyFilter(name string, value interface{}, args ...interface{}) (interface{}, error) + func (e *Environment) ApplyTest(name string, value interface{}, args ...interface{}) (bool, error) + func (e *Environment) CallMacro(name string, ctx Context, args []interface{}, kwargs map[string]interface{}) (interface{}, error) + func (e *Environment) ClearCache() + func (e *Environment) ClearInheritanceCache() + func (e *Environment) ClearMacros() + func (e *Environment) ConfigureInheritanceCache(hierarchyTTL, resolvedTTL time.Duration, maxEntries int) + func (e *Environment) FromString(source string) (*Template, error) + func (e *Environment) GetCacheSize() int + func (e *Environment) GetConfig(key string) (interface{}, bool) + func (e *Environment) GetExtension(name string) (extensions.Extension, bool) + func (e *Environment) GetExtensionForTag(tagName string) (extensions.Extension, bool) + func (e *Environment) GetExtensionRegistry() *extensions.Registry + func (e *Environment) GetFilter(name string) (FilterFunc, bool) + func (e *Environment) GetInheritanceCacheStats() runtime.CacheStats + func (e *Environment) GetLoader() Loader + func (e *Environment) GetMacro(name string) (*macros.Macro, bool) + func (e *Environment) GetTemplate(name string) (*Template, error) + func (e *Environment) GetTest(name string) (branching.TestFunc, bool) + func (e *Environment) InvalidateTemplate(templateName string) + func (e *Environment) IsCustomTag(tagName string) bool + func (e *Environment) ListFilters() []string + func (e *Environment) ListMacros() []string + func (e *Environment) ListTemplates() ([]string, error) + func (e *Environment) ListTests() []string + func (e *Environment) RenderString(source string, context Context) (string, error) + func (e *Environment) RenderTemplate(name string, context Context) (string, error) + func (e *Environment) SetCommentDelimiters(start, end string) + func (e *Environment) SetConfig(key string, value interface{}) + func (e *Environment) SetDelimiters(varStart, varEnd, blockStart, blockEnd string) + func (e *Environment) SetLoader(loader Loader) + type EnvironmentOption func(*Environment) + func WithAutoEscape(enabled bool) EnvironmentOption + func WithDebugUndefined(enabled bool) EnvironmentOption + func WithKeepTrailingNewline(enabled bool) EnvironmentOption + func WithLoader(loader Loader) EnvironmentOption + func WithLstripBlocks(enabled bool) EnvironmentOption + func WithStrictUndefined(enabled bool) EnvironmentOption + func WithTrimBlocks(enabled bool) EnvironmentOption + func WithUndefinedBehavior(behavior runtime.UndefinedBehavior) EnvironmentOption + type ErrorHandler struct + MaxSourceLines int + ShowSourceContext bool + ShowStackTrace bool + ShowSuggestions bool + func DefaultErrorHandler() *ErrorHandler + func (eh *ErrorHandler) FormatError(err error) string + type ErrorRecovery struct + func NewErrorRecovery() *ErrorRecovery + func (er *ErrorRecovery) AddDefaultStrategies() + func (er *ErrorRecovery) AddStrategy(errorType string, strategy RecoveryStrategy) + func (er *ErrorRecovery) Recover(err *EnhancedTemplateError, ctx Context) (string, error) + type FastStringBuilder struct + func GetFastStringBuilder() *FastStringBuilder + func NewFastStringBuilder(capacity int) *FastStringBuilder + func (fsb *FastStringBuilder) Len() int + func (fsb *FastStringBuilder) Reset() + func (fsb *FastStringBuilder) String() string + func (fsb *FastStringBuilder) WriteByte(b byte) error + func (fsb *FastStringBuilder) WriteString(s string) + type FilterFunc func(value interface{}, args ...interface{}) (interface{}, error) + type InteractiveDebugger struct + func NewInteractiveDebugger() *InteractiveDebugger + func (id *InteractiveDebugger) Disable() + func (id *InteractiveDebugger) Enable() + func (id *InteractiveDebugger) GetWatchedValues(ctx Context) map[string]interface{} + func (id *InteractiveDebugger) RemoveBreakpoint(templateName string, line int) + func (id *InteractiveDebugger) SetBreakpoint(templateName string, line int) + func (id *InteractiveDebugger) ShouldBreak(templateName string, line int) bool + func (id *InteractiveDebugger) Watch(varName string) + type Loader = loader.Loader + type LoopInfo struct + First bool + Index int + Index0 int + Last bool + Length int + RevIndex int + RevIndex0 int + type MemoryEfficientTemplate struct + func NewMemoryEfficientTemplate(tmpl *Template) *MemoryEfficientTemplate + func (met *MemoryEfficientTemplate) RenderMemoryEfficient(ctx Context) (string, error) + type MemoryOptimizedContext struct + func NewMemoryOptimizedContext() *MemoryOptimizedContext + func (moc *MemoryOptimizedContext) All() map[string]interface{} + func (moc *MemoryOptimizedContext) Clone() Context + func (moc *MemoryOptimizedContext) Get(key string) (interface{}, bool) + func (moc *MemoryOptimizedContext) GetEnv() *Environment + func (moc *MemoryOptimizedContext) Pop() Context + func (moc *MemoryOptimizedContext) Push() Context + func (moc *MemoryOptimizedContext) Set(key string, value interface{}) + type MemoryProfiler struct + func NewMemoryProfiler() *MemoryProfiler + func (mp *MemoryProfiler) GetStats() map[string]int64 + func (mp *MemoryProfiler) RecordAllocation(category string, size int64) + func (mp *MemoryProfiler) RecordDeallocation(category string, size int64) + type MemoryStats struct + InternedStrings int + PooledByteBuffers int + PooledContexts int + PooledStringBuilders int + PooledTemplates int + func GetMemoryStats() *MemoryStats + type Namespace struct + func NewNamespace() *Namespace + func (ns *Namespace) All() map[string]interface{} + func (ns *Namespace) Clear() + func (ns *Namespace) Delete(key string) + func (ns *Namespace) Get(key string) (interface{}, bool) + func (ns *Namespace) Has(key string) bool + func (ns *Namespace) Set(key string, value interface{}) + func (ns *Namespace) String() string + type NamespaceWrapper struct + func (nw *NamespaceWrapper) GetAttr(name string) (interface{}, error) + func (nw *NamespaceWrapper) SetAttr(name string, value interface{}) error + type Node interface + String func() string + type PerformanceMeasurement struct + Count int64 + MaxTime time.Duration + MinTime time.Duration + TotalTime time.Duration + type PerformanceProfiler struct + func NewPerformanceProfiler() *PerformanceProfiler + func (pp *PerformanceProfiler) Clear() + func (pp *PerformanceProfiler) Disable() + func (pp *PerformanceProfiler) Enable() + func (pp *PerformanceProfiler) GetMeasurements() map[string]*PerformanceMeasurement + func (pp *PerformanceProfiler) GetReport() string + func (pp *PerformanceProfiler) StartMeasurement(operation string) func() + type PrecomputedHash struct + func NewPrecomputedHash() *PrecomputedHash + func (ph *PrecomputedHash) GetHash(s string) uint64 + type RateLimitedRenderer struct + func NewRateLimitedRenderer(template *Template, maxConcurrent int) *RateLimitedRenderer + func (rlr *RateLimitedRenderer) Render(ctx Context) (string, error) + type RecoveryStrategy func(err *EnhancedTemplateError, ctx Context) (string, error) + type RuntimeError struct + Stack []string + func NewRuntimeError(template string, line, column int, format string, args ...interface{}) *RuntimeError + func (e *RuntimeError) Error() string + type SlicePool struct + func (sp *SlicePool) GetIntSlice() []int + func (sp *SlicePool) GetStringSlice() []string + func (sp *SlicePool) PutIntSlice(slice []int) + func (sp *SlicePool) PutStringSlice(slice []string) + type SmallStringOptimizer struct + func NewSmallStringOptimizer() *SmallStringOptimizer + func (sso *SmallStringOptimizer) OptimizeString(s string) string + type StackFrame struct + Column int + Function string + Line int + Source string + TemplateName string + type StringInterner struct + func NewStringInterner() *StringInterner + func (si *StringInterner) Clear() + func (si *StringInterner) Intern(s string) string + func (si *StringInterner) Size() int + type SyntaxError struct + func NewSyntaxError(template string, line, column int, format string, args ...interface{}) *SyntaxError + type SyntaxErrorHelper struct + func NewSyntaxErrorHelper() *SyntaxErrorHelper + func (seh *SyntaxErrorHelper) GetSuggestion(errorMessage string) string + type Template struct + func FromString(source string) (*Template, error) + func GetTemplate(name string) (*Template, error) + func (t *Template) AST() parser.Node + func (t *Template) GetASTAsTemplateNode() *parser.TemplateNode + func (t *Template) Name() string + func (t *Template) Release() + func (t *Template) Render(context Context) (string, error) + func (t *Template) RenderTo(w io.Writer, context Context) error + func (t *Template) SetAST(ast parser.Node) + func (t *Template) Source() string + type TemplateCache struct + func NewTemplateCache(maxSize int) *TemplateCache + func (tc *TemplateCache) Get(key string) (*Template, bool) + func (tc *TemplateCache) Put(key string, tmpl *Template) + type TemplateContextAdapter struct + func NewTemplateContextAdapter(ctx Context, env *Environment) *TemplateContextAdapter + func (a *TemplateContextAdapter) All() map[string]interface{} + func (a *TemplateContextAdapter) ApplyFilter(name string, value interface{}, args ...interface{}) (interface{}, error) + func (a *TemplateContextAdapter) ApplyTest(name string, value interface{}, args ...interface{}) (bool, error) + func (a *TemplateContextAdapter) Clone() runtime.Context + func (a *TemplateContextAdapter) GetVariable(name string) (interface{}, bool) + func (a *TemplateContextAdapter) IsAutoescapeEnabled() bool + func (a *TemplateContextAdapter) SetVariable(name string, value interface{}) + type TemplateDebugger struct + func NewTemplateDebugger() *TemplateDebugger + func (td *TemplateDebugger) AddBreakpoint(templateName string, line int) + func (td *TemplateDebugger) AddWatchVariable(varName string) + func (td *TemplateDebugger) Disable() + func (td *TemplateDebugger) Enable() + func (td *TemplateDebugger) GetWatchedVariables(ctx Context) map[string]interface{} + func (td *TemplateDebugger) RemoveBreakpoint(templateName string, line int) + func (td *TemplateDebugger) ShouldBreak(templateName string, line int) bool + type TemplateError = EnhancedTemplateError + func NewTemplateError(template string, line, column int, format string, args ...interface{}) *TemplateError + type TemplatePool struct + func NewTemplatePool(template *Template) *TemplatePool + func (tp *TemplatePool) Get() *Template + func (tp *TemplatePool) Put(tmpl *Template) + func (tp *TemplatePool) RenderConcurrent(ctx Context) (string, error) + type TemplateValidator struct + func NewTemplateValidator() *TemplateValidator + func (tv *TemplateValidator) AddDefaultRules() + func (tv *TemplateValidator) AddRule(rule ValidationRule) + func (tv *TemplateValidator) Validate(templateName, source string) []*ValidationError + type TestFunc func(value interface{}, args ...interface{}) (bool, error) + type ThreadSafeEnvironment struct + func NewThreadSafeEnvironment(opts ...EnvironmentOption) *ThreadSafeEnvironment + func (tse *ThreadSafeEnvironment) AddFilterConcurrent(name string, filter FilterFunc) error + func (tse *ThreadSafeEnvironment) AddGlobalConcurrent(name string, value interface{}) + func (tse *ThreadSafeEnvironment) FromStringConcurrent(source string) (*ThreadSafeTemplate, error) + func (tse *ThreadSafeEnvironment) GetTemplateConcurrent(name string) (*ThreadSafeTemplate, error) + type ThreadSafeTemplate struct + func NewThreadSafeTemplate(tmpl *Template) *ThreadSafeTemplate + func (tst *ThreadSafeTemplate) RenderConcurrent(ctx Context) (string, error) + type UndefinedError struct + Variable string + func NewUndefinedError(variable, template string, line, column int) *UndefinedError + func (e *UndefinedError) Error() string + type ValidationError struct + Severity string + func NewValidationError(severity, message, templateName string, line, column int) *ValidationError + type ValidationRule struct + Check func(templateName, source string) []*ValidationError + Description string + Name string + Severity string