47 lines
1.6 KiB
Go
47 lines
1.6 KiB
Go
package step
|
|
|
|
import "html/template"
|
|
|
|
// Provider is an object which provides extra functionality to an environment.
|
|
type Provider interface {
|
|
// Package returns the package identifier of the provider. For example:
|
|
// git.tebibyte.media/sashakoshka/step/examples/testplugin. The only
|
|
// exception is providers within the providers sub-package, which just
|
|
// return their basename.
|
|
Package () string
|
|
}
|
|
|
|
// 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
|
|
}
|
|
|
|
// ConfigProcessor is an object that can alter the environment configuration
|
|
// before other providers are configured in order to provide a sort of macro
|
|
// system.
|
|
type ConfigProcessor interface {
|
|
// ProcessConfig analyzes and makes necessary changes to config. Unlike
|
|
// Configurable.Configure, it can modify config.
|
|
ProcessConfig (config Meta) error
|
|
}
|
|
|
|
// 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
|
|
}
|