theme

package
v1.17.0 Latest Latest
Warning

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

Go to latest
Published: Mar 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 {
	Path        string
	ContentType string
	ReadSeeker  io.ReadSeeker
}

type Assets

type Assets []Asset

func (Assets) Append added in v1.17.0

func (assets Assets) Append(path string, content []byte) (Assets, 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