render

package module
v0.0.0-...-0756744 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: MIT Imports: 10 Imported by: 0

README

render

Simple html/template wrapper to support template refresh + htmx headers handling.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

type Manager interface {
	GetPage(page string, username string) Renderer
	GetBlock(page string, block string) Renderer
	GetComponent(path string, name string) Renderer
	FromRequest(r *http.Request, page string, username string) Renderer
}

type Renderer

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

func (Renderer) Render

func (r Renderer) Render(w io.Writer, data any) error

type RendererManager

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

func ParseTemplates

func ParseTemplates(f fs.FS, fm template.FuncMap) (*RendererManager, error)

func (RendererManager) FromRequest

func (rm RendererManager) FromRequest(r *http.Request, page string, username string) Renderer

func (RendererManager) GetBlock

func (rm RendererManager) GetBlock(page, block string) Renderer

func (RendererManager) GetComponent

func (rm RendererManager) GetComponent(path, name string) Renderer

func (RendererManager) GetPage

func (rm RendererManager) GetPage(page, username string) Renderer

type WatcherManager

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

func NewWatcher

func NewWatcher(dir string, fm template.FuncMap) (*WatcherManager, error)

func (*WatcherManager) FromRequest

func (wm *WatcherManager) FromRequest(r *http.Request, page string, username string) Renderer

func (*WatcherManager) GetBlock

func (wm *WatcherManager) GetBlock(page, block string) Renderer

func (*WatcherManager) GetComponent

func (wm *WatcherManager) GetComponent(path, name string) Renderer

func (*WatcherManager) GetPage

func (wm *WatcherManager) GetPage(page, username string) Renderer

func (*WatcherManager) Refresh

func (wm *WatcherManager) Refresh() error

Jump to

Keyboard shortcuts

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