template

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2024 License: MIT Imports: 4 Imported by: 3

Documentation

Overview

Package template simplifies parsing a set of templates with common layouts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MissingError

type MissingError string

MissingError is returned when trying to render a template that does not exist.

func (MissingError) Error

func (e MissingError) Error() string

type Template

type Template func(io.Writer, interface{}) error

type Templates

type Templates map[string]*template.Template

func Parse

func Parse(templateDir string, funcs template.FuncMap) (Templates, error)

Parse each html/template in templateDir with those in templateDir/layout, providing the custom funcs.

func (Templates) Get

func (t Templates) Get(name string) Template

Get name template from the Templates collection. It assumes that the defined template to be rendered is called "page".

Jump to

Keyboard shortcuts

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