internal

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GenericNamespaceRegistry []func(d *deps.Deps) *FuncsNamespace

GenericNamespaceRegistry represents the slice of generic functions that provide namespaces.

Functions

func AddFuncsNamespace

func AddFuncsNamespace(ns func(d *deps.Deps) *FuncsNamespace)

AddFuncsNamespace

Appends a FuncsNamespace to the registry

Types

type FuncMethodMapping

type FuncMethodMapping struct {
	Method   interface{}
	Name     string
	Aliases  []string
	Examples [][2]string
}

FuncMethodMapping represents individual methods found in each template namespaces.

type FuncNamespaces

type FuncNamespaces []*FuncsNamespace

GenericNamespaceRegistry represents the slice of generic functions that provide namespaces.

type FuncsNamespace

type FuncsNamespace struct {
	// The name of the namespace, for example "math" or "slice"
	Name string
	// The method receiver of the namespace
	Context func(v ...interface{}) interface{}
	// Additional information about the namespace such as aliases and examples.
	MethodMappings map[string]FuncMethodMapping
}

FuncsNamespace represents a template function namespace.

func (*FuncsNamespace) AddMethodMapping

func (t *FuncsNamespace) AddMethodMapping(m interface{}, name string, aliases []string, examples [][2]string)

AddMethodMapping

Adds a FuncsNamespace to the GenericNamespaceRegistry If any duplicates are found in the registry a panic will occur.

type TemplateDeps

type TemplateDeps struct {
	// The context to be used used for obtaining url's & query parameters etc...
	Context *gin.Context
	// The post to be used for rendering meta information for the page
	Post *domain.PostDatum
	// The breadcrumbs of the page, if they are not enabled, nil will be represented.
	Breadcrumbs verbis.Breadcrumbs
	// The config of the executor used in partials to obtain the root path.
	Cfg tpl.TemplateConfig
}

TemplateDeps represents the data to be passed to templates that rely on either context or domain.PostDatum such as "url", "fields" or "meta".

Jump to

Keyboard shortcuts

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