Documentation
¶
Overview ¶
Package render provides two-phase template rendering with validation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CollectConfig ¶
type CollectConfig struct {
TemplateDir string
OutputDir string
Data any
Config *config.ParsedConfig // nil = no path transformation
Engine *engine.Engine
}
CollectConfig configures the Collect function.
type ExecuteResult ¶
type ExecuteResult struct {
Skipped map[string]bool // Paths that were skipped due to no-overwrite
}
ExecuteResult contains information about executed outputs.
type Output ¶
type Output struct {
SourcePath string // Relative path in template dir
OutputPath string // Absolute path in output dir
Content []byte // Rendered content (nil for copied files)
CopyFrom string // Source path if copying verbatim (empty if rendered)
Permissions os.FileMode // File permissions to apply
Overwrite bool // Whether to overwrite existing files (default true)
}
Output represents a single file to be written.
type Plan ¶
type Plan struct {
Outputs []Output
}
Plan represents the complete rendering operation.
func Collect ¶
func Collect(cfg CollectConfig) (*Plan, error)
Collect walks the template directory and builds a Plan. It collects all outputs into memory for validation before any writes.
func (*Plan) Execute ¶
func (p *Plan) Execute(writer *output.Writer) (*ExecuteResult, error)
Execute writes all files in the Plan. Returns ExecuteResult with information about skipped files.
func (*Plan) OutputCount ¶
OutputCount returns the number of outputs in the plan.
Click to show internal directories.
Click to hide internal directories.