template

package
v0.0.0-...-d48ffb8 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Funcs = template.FuncMap{
	"null":     null,
	"memstats": memstats,
	"cmdline":  cmdline,
	"getwd":    getwd,
	"hostname": hostname,
	"environ":  environ,
}

Funcs contains the FuncMap providied and used by this package

Functions

func IfPrintNames

func IfPrintNames(flag bool, tmpl Template, prefix string)

IfPrintNames prints the names of the templates, iff flag is true

func IfPrintTemplate

func IfPrintTemplate(flag bool, tmpl Template, prefix string)

IfPrintTemplate prints the template names, iff flag is true

func Meta

func Meta(text string) (string, error)

Meta returns the meta-text extraced from text

func Names

func Names(tmpl Template) (names []string)

Names returns the sorted names of the templates referenced by tmpl

func New

func New(name string) *template.Template

New returns a new template with funcmap attached and delimiters set

Types

type Template

type Template interface {
	New(name string) *template.Template
	Clone() (*template.Template, error)
	Parse(text string) (*template.Template, error)
	Name() string
	Templates() []*template.Template
	ExecuteTemplate(wr io.Writer, name string, data interface{}) error
}

Template defines what is used from "text/template"

Jump to

Keyboard shortcuts

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