tmpl

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package tmpl executes operator-facing templates with Jet (CloudyKit). HTML email bodies stay on html/template for auto-escaping.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(body string, data any, opt Options) (string, error)

Execute parses body as Jet and renders it against data. HTML escaping is off so CLI and Icinga DSL are copied verbatim. Missing struct fields error; missing map keys render empty (use isset).

func Parse

func Parse(body string, opt Options) error

Parse checks that body is valid Jet without executing it.

func SplitCLI

func SplitCLI(text string) []string

SplitCLI splits rendered text into non-empty trimmed lines.

func StringErrFunc

func StringErrFunc(name string, fn func(string) (string, error)) jet.Func

StringErrFunc wraps func(string) (string, error) as a Jet function.

func StringFunc

func StringFunc(name string, fn func(string) string) jet.Func

StringFunc wraps func(string) string as a Jet function.

Types

type Options

type Options struct {
	// Name is the template path used in error messages.
	Name string
	// Block, if set, imports the body and yields that named block only.
	Block string
	// Macros are named snippets available to {{ include "name" }} and include("name").
	Macros map[string]string
	// Funcs are extra globals (Go funcs or jet.Func).
	Funcs map[string]any
}

Options control a single Execute.

Jump to

Keyboard shortcuts

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