render

package
v1.0.1006 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalFilesystemLoader added in v1.0.1006

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

LocalFilesystemLoader represents a local filesystem loader with basic BaseDirectory capabilities. The access to the local filesystem is unrestricted.

func MustNewLocalFileSystemLoader added in v1.0.1006

func MustNewLocalFileSystemLoader(baseDir string) *LocalFilesystemLoader

MustNewLocalFileSystemLoader creates a new LocalFilesystemLoader instance and panics if there's any error during instantiation. The parameters are the same like NewLocalFileSystemLoader.

func NewLocalFileSystemLoader added in v1.0.1006

func NewLocalFileSystemLoader(baseDir string) (*LocalFilesystemLoader, error)

NewLocalFileSystemLoader creates a new LocalFilesystemLoader and allows templatesto be loaded from disk (unrestricted). If any base directory is given (or being set using SetBaseDir), this base directory is being used for path calculation in template inclusions/imports. Otherwise the path is calculated based relatively to the including template's path.

func (*LocalFilesystemLoader) Abs added in v1.0.1006

func (fs *LocalFilesystemLoader) Abs(base, name string) string

Abs resolves a filename relative to the base directory. Absolute paths are allowed. When there's no base dir set, the absolute path to the filename will be calculated based on either the provided base directory (which might be a path of a template which includes another template) or the current working directory.

func (*LocalFilesystemLoader) Get added in v1.0.1006

func (fs *LocalFilesystemLoader) Get(path string) (io.Reader, error)

Get reads the path's content from your local filesystem.

func (*LocalFilesystemLoader) SetBaseDir added in v1.0.1006

func (fs *LocalFilesystemLoader) SetBaseDir(path string) error

SetBaseDir sets the template's base directory. This directory will be used for any relative path in filters, tags and From*-functions to determine your template. See the comment for NewLocalFileSystemLoader as well.

type PongoHTML

type PongoHTML struct {
	Template *pongo2.Template
	Name     string
	Data     any
}

PongoHTML strcut

func (*PongoHTML) Render

func (this *PongoHTML) Render(w http.ResponseWriter) error

输出

func (*PongoHTML) WriteContentType

func (this *PongoHTML) WriteContentType(w http.ResponseWriter)

WriteContentType for gin interface WriteContentType override

type PongoRender

type PongoRender struct {
	TmplDir string
}

PongoRender struct init

func New added in v1.0.1006

func New(tmplDir string) *PongoRender

New html files path

func (*PongoRender) Instance

func (this *PongoRender) Instance(name string, data any) render.Render

Instance init

Jump to

Keyboard shortcuts

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