tpl

package
v0.0.0-...-c7f67dd Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2016 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Logi18nWarnings set to true to print warnings about missing language strings
	Logi18nWarnings bool
)

Functions

func ExecuteTemplateToHTML

func ExecuteTemplateToHTML(context interface{}, layouts ...string) template.HTML

func Lookup

func Lookup(name string) *template.Template

func ResetCaches

func ResetCaches()

ResetCaches resets all caches that might be used during build.

func SetI18nTfuncs

func SetI18nTfuncs(bndl *bundle.Bundle)

SetI18nTfuncs sets the language bundle to be used for i18n.

func SetTranslateLang

func SetTranslateLang(language *helpers.Language) error

SetTranslateLang sets the translations language to use during template processing. This construction is unfortunate, but the template system is currently global.

Types

type GoHTMLTemplate

type GoHTMLTemplate struct {
	template.Template
	// contains filtered or unexported fields
}

func (*GoHTMLTemplate) AddAceTemplate

func (t *GoHTMLTemplate) AddAceTemplate(name, basePath, innerPath string, baseContent, innerContent []byte) error

func (*GoHTMLTemplate) AddInternalShortcode

func (t *GoHTMLTemplate) AddInternalShortcode(name, content string) error

func (*GoHTMLTemplate) AddInternalTemplate

func (t *GoHTMLTemplate) AddInternalTemplate(prefix, name, tpl string) error

func (*GoHTMLTemplate) AddTemplate

func (t *GoHTMLTemplate) AddTemplate(name, tpl string) error

func (*GoHTMLTemplate) AddTemplateFile

func (t *GoHTMLTemplate) AddTemplateFile(name, baseTemplatePath, path string) error

func (*GoHTMLTemplate) AddTemplateFileWithMaster

func (t *GoHTMLTemplate) AddTemplateFileWithMaster(name, overlayFilename, masterFilename string) error

func (*GoHTMLTemplate) EmbedShortcodes

func (t *GoHTMLTemplate) EmbedShortcodes()

func (*GoHTMLTemplate) EmbedTemplates

func (t *GoHTMLTemplate) EmbedTemplates()

func (*GoHTMLTemplate) GenerateTemplateNameFrom

func (t *GoHTMLTemplate) GenerateTemplateNameFrom(base, path string) string

func (*GoHTMLTemplate) GetClone

func (t *GoHTMLTemplate) GetClone() *template.Template

func (*GoHTMLTemplate) LoadEmbedded

func (t *GoHTMLTemplate) LoadEmbedded()

func (*GoHTMLTemplate) LoadTemplates

func (t *GoHTMLTemplate) LoadTemplates(absPath string)

func (*GoHTMLTemplate) LoadTemplatesWithPrefix

func (t *GoHTMLTemplate) LoadTemplatesWithPrefix(absPath string, prefix string)

func (*GoHTMLTemplate) Lookup

func (t *GoHTMLTemplate) Lookup(name string) *template.Template

func (*GoHTMLTemplate) MarkReady

func (t *GoHTMLTemplate) MarkReady()

MarkReady marks the template as "ready for execution". No changes allowed after this is set.

func (*GoHTMLTemplate) PrintErrors

func (t *GoHTMLTemplate) PrintErrors()

type Template

type Template interface {
	ExecuteTemplate(wr io.Writer, name string, data interface{}) error
	Lookup(name string) *template.Template
	Templates() []*template.Template
	New(name string) *template.Template
	GetClone() *template.Template
	LoadTemplates(absPath string)
	LoadTemplatesWithPrefix(absPath, prefix string)
	MarkReady()
	AddTemplate(name, tpl string) error
	AddTemplateFileWithMaster(name, overlayFilename, masterFilename string) error
	AddAceTemplate(name, basePath, innerPath string, baseContent, innerContent []byte) error
	AddInternalTemplate(prefix, name, tpl string) error
	AddInternalShortcode(name, tpl string) error
	PrintErrors()
}

TODO(bep) an interface with hundreds of methods ... remove it. And unexport most of these methods.

func InitializeT

func InitializeT() Template

InitializeT resets the internal template state to its initial state

func New

func New() Template

New returns a new Hugo Template System with all the additional features, templates & functions

func T

func T() Template

T is the "global" template system

type Tmpl

type Tmpl struct {
	Name string
	Data string
}

Jump to

Keyboard shortcuts

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