Expand description
Template loading with override support.
Responsibilities:
- Load templates from
.ralph/templates/{name}.jsonfirst. - Fall back to built-in templates if no custom template exists.
- List all available templates (built-in + custom).
- Validate templates and return warnings for unknown variables.
Not handled here:
- Template content validation beyond JSON parsing.
- Template merging with user options (see
merge.rs).
Invariants/assumptions:
- Custom templates override built-ins with the same name.
- Template files must have
.jsonextension. - Template names are case-sensitive.
- Variable validation is performed (unknowns produce warnings; strict mode fails).
Structs§
- Loaded
Template - Result of loading a template with context
- Template
Info - Metadata for a template (used for listing)
Enums§
- Template
Error - Error type for template operations
- Template
Source - Source of a loaded template
Functions§
- get_
template_ context - Get the template context for inspection
- list_
templates - List all available templates (built-in + custom)
- load_
template - Load a template by name
- load_
template_ with_ context - Load a template by name with variable substitution
- load_
template_ with_ context_ legacy - Load a template by name with variable substitution (legacy, non-strict)
- template_
exists - Check if a template exists (either custom or built-in)