v2

package
v0.0.0-...-e537141 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderBackground

func RenderBackground(tpl Template, w io.Writer, vals Values) error

Types

type CachedParser

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

func NewCachedParser

func NewCachedParser(parser Parser) CachedParser

func (CachedParser) ParseTemplate

func (cp CachedParser) ParseTemplate(name string, from io.Reader) (Template, error)

type Parser

type Parser interface {
	ParseTemplate(name string, from io.Reader) (Template, error)
}

type StdHtmlTemplate

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

func NewStdHtmlTemplate

func NewStdHtmlTemplate(name string) StdHtmlTemplate

func (StdHtmlTemplate) Execute

func (s StdHtmlTemplate) Execute(w io.Writer, data any) error

func (StdHtmlTemplate) Lookup

func (s StdHtmlTemplate) Lookup(name string) StdTemplate

func (StdHtmlTemplate) Name

func (s StdHtmlTemplate) Name() string

func (StdHtmlTemplate) New

func (s StdHtmlTemplate) New(name string) StdTemplate

func (StdHtmlTemplate) Parse

func (s StdHtmlTemplate) Parse(text string) (StdTemplate, error)

type StdParser

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

func NewStdParser

func NewStdParser(kind StdType, name string) StdParser

func StdRootParser

func StdRootParser(kind StdType) StdParser

StdRootParser call NewStdParser with name "root"

func (StdParser) ParseTemplate

func (s StdParser) ParseTemplate(name string, from io.Reader) (Template, error)

type StdTemplate

type StdTemplate interface {
	New(name string) StdTemplate
	Name() string
	Parse(text string) (StdTemplate, error)
	Lookup(name string) StdTemplate
	Execute(w io.Writer, data any) error
}

type StdTextTemplate

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

func NewStdTextTemplate

func NewStdTextTemplate(name string) StdTextTemplate

func (StdTextTemplate) Execute

func (s StdTextTemplate) Execute(w io.Writer, data any) error

func (StdTextTemplate) Lookup

func (s StdTextTemplate) Lookup(name string) StdTemplate

func (StdTextTemplate) Name

func (s StdTextTemplate) Name() string

func (StdTextTemplate) New

func (s StdTextTemplate) New(name string) StdTemplate

func (StdTextTemplate) Parse

func (s StdTextTemplate) Parse(text string) (StdTemplate, error)

type StdType

type StdType int

ENUM(

Text
Html

)

const (
	// StdTypeText is a StdType of type Text.
	StdTypeText StdType = iota
	// StdTypeHtml is a StdType of type Html.
	StdTypeHtml
)

func ParseStdType

func ParseStdType(name string) (StdType, error)

ParseStdType attempts to convert a string to a StdType.

func (StdType) MarshalText

func (x StdType) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (StdType) String

func (x StdType) String() string

String implements the Stringer interface.

func (*StdType) UnmarshalText

func (x *StdType) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type StringParser

type StringParser interface {
	ParseString(name string, tpl string) (Template, error)
}

type Template

type Template interface {
	Render(ctx context.Context, w io.Writer, vals Values) error
}

func ParseInlineString

func ParseInlineString(p Parser, str string) (Template, error)

func ParseString

func ParseString(p Parser, name, str string) (Template, error)

type Values

type Values = template.Values

Jump to

Keyboard shortcuts

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