processor

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package processor wraps a Syringe for easier integration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Opts

type Opts struct {
	AllowAliases     bool           // When true, allow short function names ("map") as aliases (for "".Gtpl.Map")
	LeftDelimiter    string         // When "", defaults to "{{"
	RightDelimter    string         // When "", defaults to "}}"
	RemoveEmptyLines bool           // When true, remove empty lines from the output
	ListTemplate     bool           // When true, list template with line numbers before processing
	Logger           syringe.Logger // When nil, defaults to https://pkg.go.dev/log
}

Opts control how the processor works.

type Processor

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

Processor is the receiver.

func New

func New(o *Opts) *Processor

func (*Processor) Overview

func (p *Processor) Overview() string

Builtins returns the "usage" information of the builtin functions, just as syringe.Overview does. This is just a pass-through.

func (*Processor) ProcessFiles

func (p *Processor) ProcessFiles(files []string, w io.Writer) error

ProcessFiles reads templates from files. The output goes to an io.Writer.

func (*Processor) ProcessStreams

func (p *Processor) ProcessStreams(r io.Reader, w io.Writer) error

ProcessStreams reads the template to process from an io.Reader and runs it. The output goes to an io.Writer.

Jump to

Keyboard shortcuts

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