sdtemplate

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package sdtemplate 文本模板工具

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HtmlLoad

func HtmlLoad(fsys fs.FS, name string) (*template.Template, error)

Types

type HtmlLoader

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

func NewHtmlLoader

func NewHtmlLoader(fsys fs.FS, opts *HtmlLoaderOptions) (*HtmlLoader, error)

func (*HtmlLoader) Load

func (loader *HtmlLoader) Load(name string) (*template.Template, error)

type HtmlLoaderOptions

type HtmlLoaderOptions struct {
	Eager      bool
	Extensions []string
}

type TemplateExecutor

type TemplateExecutor interface {
	Exec(template string, data any) (string, error)
	ExecDef(template string, data any, def string) string
}
var (
	Text TemplateExecutor = textExecutor{}
	Html TemplateExecutor = htmlExecutor{}
)

Jump to

Keyboard shortcuts

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