pages

package module
Version: v0.0.0-...-481193c Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: ISC Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	Static         = "-static-"
	StaticTemplate = "{{define \"title\"}}{{.Title}}{{end}}{{define \"style\"}}{{.Style}}{{end}}{{define \"body\"}}\n{{.Body}}{{end}}"
)

Variables

View Source
var (
	ErrTemplateExists  = errors.New("template already exists")
	ErrUnknownTemplate = errors.New("unknown template")
)

Errors

Functions

This section is empty.

Types

type Bytes

type Bytes struct {
	// contains filtered or unexported fields
}

func (*Bytes) ServeHTTP

func (b *Bytes) ServeHTTP(w http.ResponseWriter, r *http.Request)

type File

type File struct {
	Filename string

	LastModified time.Time
	// contains filtered or unexported fields
}

func (*File) ServeHTTP

func (f *File) ServeHTTP(w http.ResponseWriter, r *http.Request)

type HookFn

type HookFn func(http.ResponseWriter, *http.Request, interface{}) interface{}
var PassthroughHook HookFn = func(_ http.ResponseWriter, _ *http.Request, data interface{}) interface{} {
	return data
}

type Pages

type Pages struct {
	// contains filtered or unexported fields
}

func New

func New(baseTemplateFilename string) (*Pages, error)

func NewString

func NewString(baseTemplate string) (*Pages, error)

func (*Pages) Bytes

func (p *Pages) Bytes(title, style string, body template.HTML) *Bytes

func (*Pages) File

func (p *Pages) File(title, style, filename string) *File

func (*Pages) Hook

func (p *Pages) Hook(hook HookFn)

func (*Pages) Rebuild

func (p *Pages) Rebuild() error

func (*Pages) RegisterFile

func (p *Pages) RegisterFile(name, filename string) error

func (*Pages) RegisterString

func (p *Pages) RegisterString(name, contents string) error

func (*Pages) StaticFile

func (p *Pages) StaticFile(static string) error

func (*Pages) StaticString

func (p *Pages) StaticString(static string) error

func (*Pages) Write

func (p *Pages) Write(w http.ResponseWriter, r *http.Request, templateName string, data interface{}) error

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL