theme

package module
v0.0.0-...-a0d72c5 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Theme

go get -u github.com/rumorshub/theme

License

Distributed under MIT License, please see license file within the code for more details.

Documentation

Index

Constants

View Source
const PluginName = "theme"

Variables

View Source
var FuncMap = sprig.FuncMap()

Functions

This section is empty.

Types

type Config

type Config struct {
	Debug  bool `mapstructure:"debug" json:"debug,omitempty" bson:"debug,omitempty"`
	Delims struct {
		Left  string `mapstructure:"left" json:"left,omitempty" bson:"left,omitempty"`
		Right string `mapstructure:"right" json:"right,omitempty" bson:"right,omitempty"`
	} `mapstructure:"delims" json:"delims,omitempty" bson:"delims,omitempty"`
	Global  []string       `mapstructure:"global" json:"global,omitempty" bson:"global,omitempty"`
	Loaders []LoaderConfig `mapstructure:"loaders" json:"loaders,omitempty" bson:"loaders,omitempty"`
}

func (*Config) InitDefaults

func (c *Config) InitDefaults()

type Configurer

type Configurer interface {
	Has(name string) bool
	UnmarshalKey(name string, out interface{}) error
}

type Environment

type Environment struct {
	*et.Environment
}

func NewEnvironment

func NewEnvironment(loaders []et.Loader) *Environment

func (*Environment) HTML

func (t *Environment) HTML(ctx context.Context, name string, data any) (string, error)

type LoaderConfig

type LoaderConfig struct {
	Dir   string              `mapstructure:"dir" json:"dir,omitempty" bson:"dir,omitempty"`
	Paths map[string][]string `mapstructure:"paths" json:"paths,omitempty" bson:"paths,omitempty"`
}

type Logger

type Logger interface {
	NamedLogger(name string) *slog.Logger
}

type Plugin

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

func (*Plugin) Collects

func (p *Plugin) Collects() []*dep.In

func (*Plugin) Init

func (p *Plugin) Init(cfg Configurer, logger Logger) error

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) Provides

func (p *Plugin) Provides() []*dep.Out

func (*Plugin) Theme

func (p *Plugin) Theme() *Environment

type Theme

type Theme interface {
	Debug(debug bool) *et.Environment
	Funcs(funcMap template.FuncMap) *et.Environment
	Global(global ...string) *et.Environment
	Load(ctx context.Context, name string) (*et.TemplateWrapper, error)
	HTML(ctx context.Context, name string, data any) (string, error)
}

Jump to

Keyboard shortcuts

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