generator

package
v0.2.663 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 13 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(template parser.TemplateFile, w io.Writer, opts ...GenerateOpt) (sm *parser.SourceMap, literals string, err error)

Generate generates Go code from the input template file to w, and returns a map of the location of Go expressions in the template to the location of the generated Go code in the output.

Types

type GenerateOpt added in v0.2.428

type GenerateOpt func(g *generator) error

func WithExtractStrings added in v0.2.542

func WithExtractStrings() GenerateOpt

func WithFileName added in v0.2.501

func WithFileName(name string) GenerateOpt

WithFileName sets the filename of the templ file in template rendering error messages.

func WithTimestamp added in v0.2.428

func WithTimestamp(d time.Time) GenerateOpt

WithTimestamp enables the generated date to be included in the generated code.

func WithVersion added in v0.2.428

func WithVersion(v string) GenerateOpt

WithVersion enables the version to be included in the generated code.

type RangeWriter

type RangeWriter struct {
	Current parser.Position
	// contains filtered or unexported fields
}

func NewRangeWriter

func NewRangeWriter(w io.Writer) *RangeWriter

func (*RangeWriter) Write

func (rw *RangeWriter) Write(s string) (r parser.Range, err error)

func (*RangeWriter) WriteIndent

func (rw *RangeWriter) WriteIndent(level int, s string) (r parser.Range, err error)

func (*RangeWriter) WriteStringLiteral added in v0.2.315

func (rw *RangeWriter) WriteStringLiteral(level int, s string) (r parser.Range, err error)

Jump to

Keyboard shortcuts

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