templater

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CollectParameters

func CollectParameters(tempFiles []string) ([]string, error)

CollectParameters analyzes template files and returns a list of unique parameter names used in them. It processes templates concurrently for better performance.

func IsTemplate

func IsTemplate(path string) bool

IsTemplate checks if a file is a template by verifying if it has a .tmpl extension.

func RenderTemplate

func RenderTemplate(file string, params map[string]interface{}) (bytes.Buffer, error)

RenderTemplate processes a template file with the given parameters and returns the rendered content. It supports all standard Go template functionality plus Sprig template functions (http://masterminds.github.io/sprig/). This enables advanced template features like string manipulation, date formatting, math operations, and more. Examples of Sprig functions include: upper, lower, title, trim, default, date, repeat, etc.

func WriteTemplate

func WriteTemplate(path string, renderedTemplate *bytes.Buffer) error

WriteTemplate writes the rendered template content to the specified file path.

Types

This section is empty.

Jump to

Keyboard shortcuts

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