templates

package
v3.4.2 Latest Latest
Warning

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

Go to latest
Published: May 11, 2023 License: GPL-2.0 Imports: 5 Imported by: 4

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

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

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

Get a template

func (*Manager) GetBases added in v3.0.8

func (tm *Manager) GetBases(funcMap template.FuncMap) (*template.Template, error)

Get base templates

func (*Manager) GetFromString

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

Render a template from a string

func (*Manager) Init

func (tm *Manager) Init()

Initialize the template manager

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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