templates

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package templates helps sites to manage their templates

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPongo2Renderer

func NewPongo2Renderer(ts *pongo2.TemplateSet) render.HTMLRender

NewPongo2Renderer creates an wrapper for gin

Types

type EmptyLoader

type EmptyLoader struct{}

EmptyLoader is an Empty Loader

func (*EmptyLoader) Abs

func (*EmptyLoader) Abs(base, name string) string

Abs return the join of base and name

func (*EmptyLoader) Get

func (*EmptyLoader) Get(string) (io.Reader, error)

Get returns always errors

type FSLoader

type FSLoader struct {
	fs.FS
}

FSLoader is an interim until pongo merges the pullrequest for fs.FS

func (*FSLoader) Abs

func (e *FSLoader) Abs(base, name string) string

Abs return the join of base and name

func (*FSLoader) Get

func (e *FSLoader) Get(path string) (reader io.Reader, err error)

Get returns an io.Reader where the template's content can be read from.

type Pongo2Renderer

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

Pongo2Renderer is an simple wrapper for gin to use pongo2 templates

func (*Pongo2Renderer) Instance

func (p2r *Pongo2Renderer) Instance(name string, data any) render.Render

Instance create an new instance of an REnder object

type TemplateSite

type TemplateSite interface {
	Templates() pongo2.TemplateLoader
}

TemplateSite is an interface that is for storing templates.

Jump to

Keyboard shortcuts

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