theme

package
v1.15.16-go1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParsePageTpl

func ParsePageTpl(tplText string) (tpl *template.Template, err error)

Types

type Asset

type Asset struct {
	ContentType string
	ReadSeeker  io.ReadSeeker
}

type Assets

type Assets map[string]Asset

func (Assets) Set

func (assets Assets) Set(path string, content []byte) error

type DirTheme

type DirTheme string

func (DirTheme) RenderAsset

func (dir DirTheme) RenderAsset(w http.ResponseWriter, r *http.Request, assetPath string)

func (DirTheme) RenderPage

func (dir DirTheme) RenderPage(w io.Writer, data interface{}) error

type MemTheme

type MemTheme struct {
	Template *template.Template
	Assets   Assets
}

func LoadMemTheme

func LoadMemTheme(themePath string) (theme MemTheme, err error)

func (MemTheme) RenderAsset

func (theme MemTheme) RenderAsset(w http.ResponseWriter, r *http.Request, assetPath string)

func (MemTheme) RenderPage

func (theme MemTheme) RenderPage(w io.Writer, data interface{}) error

type Theme

type Theme interface {
	RenderPage(w io.Writer, data interface{}) error
	RenderAsset(w http.ResponseWriter, r *http.Request, assetPath string)
}

Jump to

Keyboard shortcuts

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