Add Provider interface
This commit is contained in:
@@ -2,8 +2,12 @@ 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
|
||||
@@ -12,7 +16,7 @@ type FuncProvider interface {
|
||||
// FuncProviderFor is an object that provides a template.FuncMap for a specific
|
||||
// document.
|
||||
type FuncProviderFor interface {
|
||||
FuncProvider
|
||||
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
|
||||
@@ -20,6 +24,7 @@ type FuncProviderFor interface {
|
||||
|
||||
// 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
|
||||
|
||||
Reference in New Issue
Block a user