Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BootStrap ¶
func BootStrap()
BootStrap actions. This function must be called prior to any access to the templates Registry.
func LoadFromEtree ¶
LoadFromEtree reads the view given etree.Element, creates or updates the template and adds it to the template registry if it not already.
Types ¶
type Collection ¶
A Collection of templates
func (*Collection) Abs ¶
func (tc *Collection) Abs(base, name string) string
Abs calculates the path to a given template. Whenever a path must be resolved due to an import from another template, the base equals the parent template's path.
func (*Collection) Add ¶
func (tc *Collection) Add(t *Template)
Add the given template to the Collection
func (*Collection) Get ¶
func (tc *Collection) Get(pth string) (io.Reader, error)
Get returns an io.Reader where the template's content can be read from.
func (*Collection) GetByID ¶
func (tc *Collection) GetByID(id string) *Template
GetByID returns the Template with the given id
func (*Collection) LoadFromEtree ¶
func (tc *Collection) LoadFromEtree(element *etree.Element)
LoadFromEtree loads the given template given as Element into this collection.
type Template ¶
type Template struct { *hweb.Template ID string Priority uint8 Page bool Optional bool OptionalDefault bool // contains filtered or unexported fields }
A Template holds information of a HWeb template
type TemplateRenderer ¶
A TemplateRenderer can render a template with the given data
func (TemplateRenderer) Render ¶
func (tr TemplateRenderer) Render(w http.ResponseWriter) error
Render this TemplateRenderer to the given ResponseWriter
func (TemplateRenderer) WriteContentType ¶
func (tr TemplateRenderer) WriteContentType(w http.ResponseWriter)
WriteContentType of this TemplateRenderer
type TemplateSet ¶
type TemplateSet struct { *hweb.TemplateSet // contains filtered or unexported fields }
A TemplateSet is a set of pongo2 templates
var Registry *TemplateSet
Registry is the templates set of the application
func NewTemplateSet ¶
func NewTemplateSet() *TemplateSet
NewTemplateSet returns a pointer to a new empty TemplateSet
type TemplateXML ¶
type TemplateXML struct { ID string `xml:"id,attr"` InheritID string `xml:"inherit_id,attr"` Content []byte `xml:",innerxml"` Priority uint8 `xml:"priority,attr"` Page string `xml:"page,attr"` Optional string `xml:"optional,attr"` }
TemplateXML is used to unmarshal the XML definition of a template