html

package
v0.0.0-...-8e825b5 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: Unlicense Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Ext         = ".html"
	ContentType = "text/html; charset=utf-8"
)
View Source
const DefaultHTML = `` /* 545-byte string literal not displayed */

The default html template. It is exported for documentation purposes (can be used as a basis for your more elaborate templates).

Variables

View Source
var DefaultTemplate = must(New("_default.html").Parse(DefaultHTML))

Functions

This section is empty.

Types

type Template

type Template struct {
	*template.Template
}

Template extends the standard html/template.Template to implement interface sql2http.Template (with ContentType method).

func New

func New(name string) *Template

New wraps the standard library html/template.New. It is a simple helper function to avoid importing the standard library.

func ParseTree

func ParseTree(dir string) (*Template, error)

ParseTree creates a new Template, walks recursively the files starting at the given directory, and for each file ending with ".html" parses the template definition under the relative file name. The returned template is the first matching file.

func (*Template) ContentType

func (t *Template) ContentType() string

ContentType implements interface sql2http.Template. It returns the constant string ContentType.

func (*Template) Lookup

func (t *Template) Lookup(name string) *Template

Lookup returns the template associated with t with given name. This method is particularly useful with ParseTree.

If no such template exists, nil is returned.

Jump to

Keyboard shortcuts

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