Documentation ¶
Index ¶
- Constants
- Variables
- func New(config *Config, informer logger.Informer) *goview.ViewEngine
- func NewWithConfigurator(config *Config, configurator configurator.Configurator, ...) *goview.ViewEngine
- type Config
- type ReConfiguration
- func (reConfiguration *ReConfiguration) ReConfiguration(configurator configurator.Configurator) error
- func (reConfiguration *ReConfiguration) Render(w http.ResponseWriter, statusCode int, name string, data interface{}) error
- func (reConfiguration *ReConfiguration) RenderWriter(w io.Writer, name string, data interface{}) error
- type Templater
Constants ¶
View Source
const ( TemplateRootDirectoryFieldName = "templater.directory.root" ExtensionFieldName = "templater.extension" IndexLayoutPathFieldName = "templater.layout.index" UseCacheFieldName = "templater.cache" TemplateRootDirectoryDefault = "template" ExtensionDefault = ".html" IndexLayoutPathDefault = "layouts/master" UseCacheDefault = false )
Variables ¶
View Source
var Component = &app.Component{ Dependencies: app.Components{ logger.Component, configurator.Component, info.Component, }, Constructor: func(container container.Container) error { return container.Provides( NewConfig, NewReConfigurationWithConfigurator, func(templater *ReConfiguration) Templater { return templater }, ) }, BindFlags: func(flagSet *pflag.FlagSet, container container.Container) error { return container.Invoke(func(config *Config) { flagSet.StringVar( &config.TemplateRootDirectory, TemplateRootDirectoryFieldName, TemplateRootDirectoryDefault, "path to templates directory", ) flagSet.StringVar(&config.Extension, ExtensionFieldName, ExtensionDefault, "template file extension") flagSet.StringVar(&config.IndexLayoutPath, IndexLayoutPathFieldName, IndexLayoutPathDefault, "main template file name") flagSet.BoolVar(&config.UseCache, UseCacheFieldName, UseCacheDefault, "if true, cache templating results") }) }, Run: func(c container.Container) error { templater, err := container.Get[*ReConfiguration](c) if err != nil { return err } reConfiguration, err := container.Get[configurator.ReConfiguration](c) if err != nil { return err } informer, err := container.Get[logger.Informer](c) if err != nil { return err } reConfiguration.Registration(templater) informer.Info("templater: registration in the reConfigurator") info, err := container.Get[info.Info](c) if err != nil { return err } config, err := container.Get[*Config](c) if err != nil { return err } info.Registration("templater", config) return nil }, }
Functions ¶
func NewWithConfigurator ¶
func NewWithConfigurator(config *Config, configurator configurator.Configurator, informer logger.Informer) *goview.ViewEngine
Types ¶
type Config ¶
type Config struct { TemplateRootDirectory string Extension string IndexLayoutPath string UseCache bool }
func Configuration ¶
func Configuration(config *Config, configurator configurator.Configurator) *Config
type ReConfiguration ¶
type ReConfiguration struct {
// contains filtered or unexported fields
}
func NewReConfiguration ¶
func NewReConfiguration(templater Templater, informer logger.Informer, config *Config) *ReConfiguration
func NewReConfigurationWithConfigurator ¶
func NewReConfigurationWithConfigurator(config *Config, configurator configurator.Configurator, informer logger.Informer) *ReConfiguration
func (*ReConfiguration) ReConfiguration ¶
func (reConfiguration *ReConfiguration) ReConfiguration(configurator configurator.Configurator) error
func (*ReConfiguration) Render ¶
func (reConfiguration *ReConfiguration) Render(w http.ResponseWriter, statusCode int, name string, data interface{}) error
func (*ReConfiguration) RenderWriter ¶
func (reConfiguration *ReConfiguration) RenderWriter(w io.Writer, name string, data interface{}) error
Click to show internal directories.
Click to hide internal directories.