Help us shape the future of Go! Take the 2026 Go Developer Survey

renderer

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PackTemplateContext

type PackTemplateContext = parser.PackTemplateContext

type Rendered

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

Rendered encapsulates all the rendered template files associated with the pack. It splits them based on whether they belong to the parent or a dependency.

func (*Rendered) DependentRenders

func (r *Rendered) DependentRenders() map[string]string

DependentRenders returns a map of rendered templates belonging to the dependent packs of the parent template. The map key represents the path and file name of the template.

func (*Rendered) LenDependentRenders

func (r *Rendered) LenDependentRenders() int

LenDependentRenders returns the number of dependent rendered templates that are stored.

func (*Rendered) LenParentRenders

func (r *Rendered) LenParentRenders() int

LenParentRenders returns the number of parent rendered templates that are stored.

func (*Rendered) ParentRenders

func (r *Rendered) ParentRenders() map[string]string

ParentRenders returns a map of rendered templates belonging to the parent pack. The map key represents the path and file name of the template.

type Renderer

type Renderer struct {

	// Strict determines the template rendering missingkey option setting. If
	// set to true error will be used, otherwise zero is used.
	Strict bool

	// PackPath is the path to the pack being rendered.
	PackPath string

	// Client is the Nomad API client used when running the Nomad template
	// functions. It can potentially be nil, therefore care should be taken
	// when accessing it.
	Client *api.Client

	// RenderAuxFiles determines whether we should render auxiliary files found
	// in template/ or not
	RenderAuxFiles bool

	// Format determines whether we should format templates before rendering them
	// or not
	Format bool
	// contains filtered or unexported fields
}

Renderer provides template rendering functionality using the text/template package.

func (*Renderer) Render

func (r *Renderer) Render(p *pack.Pack, variables *parser.ParsedVariables) (*Rendered, error)

Render is responsible for iterating the pack and rendering each defined template using the parsed variable map.

func (*Renderer) RenderOutput

func (r *Renderer) RenderOutput() (string, error)

RenderOutput performs the output template rendering.

Jump to

Keyboard shortcuts

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