template

package
v1.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GlobalDir

func GlobalDir() string

GlobalDir returns the user-global template directory (~/.config/lore/templates). Returns empty string if the home directory cannot be determined.

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

Engine wraps text/template with hierarchical resolution and custom functions.

func New

func New(localDir, globalDir string) (*Engine, error)

New creates a template engine with hierarchical resolution. localDir is the project-local template directory (e.g. ".lore/templates"). globalDir is the user-global template directory (e.g. "~/.config/lore/templates").

func (*Engine) Render

func (e *Engine) Render(name string, data TemplateContext) (string, error)

Render resolves a named template via the hierarchy and executes it with the given data.

func (*Engine) TemplateExists

func (e *Engine) TemplateExists(name string) bool

TemplateExists checks whether a template with the given name is available in any level of the hierarchy (local, global, or embedded defaults).

type TemplateContext

type TemplateContext struct {
	Type         string
	Title        string
	Date         string // YYYY-MM-DD
	Commit       string
	Author       string
	Branch       string // current branch at capture time
	Scope        string // scope from conventional commit
	Tags         []string
	Why          string
	Impact       string
	Alternatives string
	GeneratedBy  string // "hook" or "manual"
	AngelaMode   string
}

TemplateContext holds all variables passed to templates during rendering. Built by the caller (workflow/ or cmd/) from domain.GenerateInput and domain.DocMeta. The template package never constructs TemplateContext itself.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL