tmpl

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultName = "tmpl"
)

Variables

This section is empty.

Functions

func NewDefault

func NewDefault(name string) dukkha.Renderer

func RenderTemplate

func RenderTemplate(
	rc dukkha.RenderingContext,
	tfs *templateutils.TemplateFuncs,
	inc []*IncludeSpec,
	variables map[string]any,

	tplStr string,
) ([]byte, error)

func ResolveInputSpec

func ResolveInputSpec(rc dukkha.RenderingContext, tplBytes []byte, out *InputSpec) (err error)

Types

type ConfigSpec

type ConfigSpec struct {
	rs.BaseField

	// Include templates
	Include []*IncludeSpec `yaml:"include"`

	// Variables are a map of any data
	//
	// available as `var.some_value`
	Variables rs.AnyObjectMap `yaml:"variables"`
}

type Driver

type Driver struct {
	rs.BaseField `yaml:"-"`

	renderer.BaseRenderer `yaml:",inline"`

	Options ConfigSpec `yaml:",inline"`
	// contains filtered or unexported fields
}

func (*Driver) Init

func (d *Driver) Init(cacheFS *fshelper.OSFS) error

func (*Driver) RenderYaml

func (d *Driver) RenderYaml(
	rc dukkha.RenderingContext, rawData any, attributes []dukkha.RendererAttribute,
) ([]byte, error)

type IncludeSpec

type IncludeSpec struct {
	rs.BaseField

	// Path to local files/dirs
	Path string `yaml:"path"`

	// Text is the plain text template to be included
	Text string `yaml:"text"`
}

type InputSpec

type InputSpec struct {
	rs.BaseField

	// Template text
	Template string `yaml:"template"`

	Config ConfigSpec `yaml:",inline"`
}

Jump to

Keyboard shortcuts

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