step/provider.go

32 lines
984 B
Go

package step
import "html/template"
// Provider is an object which provides extra functionality to an environment.
type Provider any
// FuncProvider provides a template.FuncMap.
type FuncProvider interface {
Provider
// FuncMap provides a template.FuncMap. It may return nil, in which case
// its result is simply not considered.
FuncMap () template.FuncMap
}
// FuncProviderFor is an object that provides a template.FuncMap for a specific
// document.
type FuncProviderFor interface {
Provider
// FuncMap provides a template.FuncMap, given a particular document. It
// may return nil, in which case its result is simply not considered.
FuncMapFor (*Document) template.FuncMap
}
// Configurable is an object that can be configured according to metadata.
type Configurable interface {
Provider
// Configure uses config to configure the object. It must not modify
// config. Keys are namespaced with a '.' and are written in kebab case.
Configure (config Meta) error
}