Documentation
¶
Index ¶
- type Compiler
- type Composer
- type ComposerRegistry
- type Engine
- func (e *Engine) ClearAllStacks()
- func (e *Engine) ClearStack(name string)
- func (e *Engine) Each(collection []any, templateName string, data map[string]any) (string, error)
- func (e *Engine) GetShared() map[string]any
- func (e *Engine) Make(name string, data map[string]any) (string, error)
- func (e *Engine) Push(name string, content string)
- func (e *Engine) Share(key string, value any)
- func (e *Engine) ShareMany(data map[string]any)
- func (e *Engine) Stack(name string) []string
- type Loop
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compiler ¶
type Compiler struct {
CachePath string
}
Compiler handles transpiling Goblade templates into standard Go html/template files.
func NewCompiler ¶
NewCompiler creates a new Goblade compiler.
func (*Compiler) CompileFile ¶
CompileFile reads a file, compiles it, and caches the output, returning the path to the cached file.
func (*Compiler) CompileString ¶
Compile takes a raw Goblade string and returns the compiled html/template string. For Phase 3, we implement a lightweight parser/replacer as requested.
type ComposerRegistry ¶
type ComposerRegistry struct {
// contains filtered or unexported fields
}
ComposerRegistry stores view composers for specific views.
func NewComposerRegistry ¶
func NewComposerRegistry() *ComposerRegistry
NewComposerRegistry creates a new composer registry.
func (*ComposerRegistry) Compose ¶
func (r *ComposerRegistry) Compose(view string, data map[string]any)
Compose executes all registered composers for a given view, modifying the data map in-place.
func (*ComposerRegistry) Register ¶
func (r *ComposerRegistry) Register(view string, composer Composer)
Register adds a composer for a specific view or wildcard (*).
type Engine ¶
type Engine struct {
ViewPaths []string
Compiler *Compiler
// contains filtered or unexported fields
}
Engine is the Goblade view rendering engine.
func (*Engine) ClearStack ¶
ClearStack clears a named stack.