templates

package
v2.9.4 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilenameFromPath

func FilenameFromPath(p string) string

func NicePath

func NicePath(forceSuffixSlash bool, p ...string) string

Types

type Manager added in v2.5.4

type Manager struct {
	// Use template cache?
	USE_TEMPLATE_CACHE bool

	// Default base template suffixes
	BASE_TEMPLATE_SUFFIXES []string
	// Default directory to look in for base templates
	BASE_TEMPLATE_DIRS []string
	TEMPLATE_DIRS      []string
	// Functions to add to templates
	DEFAULT_FUNCS template.FuncMap
	// Template file system
	TEMPLATEFS fs.FS
	// contains filtered or unexported fields
}

Template manager Used for easily fetching templates.

func (*Manager) Get added in v2.5.4

func (tm *Manager) Get(templateName string, funcs template.FuncMap) (*template.Template, string, error)

Get a template

func (*Manager) GetFromString added in v2.9.0

func (tm *Manager) GetFromString(templateString string, templateName string) (*template.Template, error)

Render a template from a string

func (*Manager) Init added in v2.5.4

func (tm *Manager) Init()

Initialize the template manager

Jump to

Keyboard shortcuts

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