templates

package
v1.1.11 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2023 License: BSD-3-Clause Imports: 4 Imported by: 18

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BaseTemplates = []string{
	"web/templates/common/base.go.html",
	"web/templates/common/head.go.html",
	"web/templates/common/menu.go.html",
}

BaseTemplates represents all partial templates used to build the base of the site.

View Source
var (
	// DefaultLoader is the default loader to be used with LoadTemplates.
	DefaultLoader = &EmbedLoader{}
)

Functions

func LoadTemplates

func LoadTemplates(filenames ...string) (*template.Template, error)

LoadTemplates loads and associates the given templates.

Types

type EmbedLoader added in v1.1.8

type EmbedLoader struct{}

EmbedLoader loads templates from the templates directory.

func NewEmbedLoader added in v1.1.8

func NewEmbedLoader() *EmbedLoader

NewEmbedLoader creates a new EmbedLoader.

func (*EmbedLoader) LoadTemplates added in v1.1.8

func (l *EmbedLoader) LoadTemplates(filename string) (string, error)

LoadTemplates reads and returns the file's content.

type Loader

type Loader interface {
	LoadTemplates(filename string) (string, error)
}

Loader is an interface for a template loader.

Jump to

Keyboard shortcuts

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