tmpllib

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package tmpllib enshrines in code the common practice of managing a directory of HTML templates, all of which depend on a root template called, fittingly, "root.html."

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(w io.Writer, name string, o interface{}) error

Execute sends to the given Writer the output of evaluating a template with the given name on the given object.

func Load

func Load(directory string) error

Load scans the given directory and generates html template objects for each file found. Each template object is the reslt of parsing a file preceded by the "root.html" file. Files are scanned in lexicographic order, and no template is created for the contents of "root.html".

Types

type Error

type Error struct {
	MissingTemplate string
}

Error is returned if an attempt is made to execute a named template not in the template library.

func (Error) Error

func (e Error) Error() string

Source Files

  • main.go

Jump to

Keyboard shortcuts

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