startertemplates

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package startertemplates ships the pre-built starter email template masters that seed a new account's template library.

Each master lives under masters/<alias>/ as three files:

meta.json  - catalog metadata (name, description, version, subject,
             declared variables)
body.html  - the HTML part
body.txt   - the plain-text part

Templates use flat interpolation only: {{var}} (HTML-escaped in the HTML part, plain in subject/text) and {{{var}}} (raw, for pre-rendered HTML fragments). There are no loops, conditionals, or partials. Variables that are missing at render time produce empty strings.

This is a leaf package: stdlib only. The content is embedded at compile time and validated by the QA gates in startertemplates_test.go, so a malformed master is a build/test failure, never a runtime surprise.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Master

type Master struct {
	Alias       string     `json:"alias"`
	Name        string     `json:"name"`
	Description string     `json:"description"`
	Version     string     `json:"version"`
	Subject     string     `json:"subject"`
	Variables   []Variable `json:"variables"`
	HTMLBody    string     `json:"-"`
	TextBody    string     `json:"-"`
}

Master is one parsed starter template.

func Catalog

func Catalog() []Master

Catalog returns all starter template masters, sorted by alias. The returned slice is a copy; callers may reorder it freely.

func Get

func Get(alias string) (Master, bool)

Get returns the master with the given alias, if it exists.

type Variable

type Variable struct {
	// Name is the identifier used inside {{...}} / {{{...}}} tokens.
	Name string `json:"name"`
	// Required marks variables the caller should always supply. Optional
	// variables render as empty strings when absent.
	Required bool `json:"required"`
	// Raw marks {{{...}}} slots that accept pre-rendered HTML fragments and
	// are inserted without escaping. Never feed untrusted input to raw slots.
	Raw bool `json:"raw"`
	// Description explains what the variable is and, for raw slots, the
	// exact fragment shape the template expects.
	Description string `json:"description"`
	// Example is a realistic sample value, used for previews and QA renders.
	Example string `json:"example"`
}

Variable describes one interpolation slot declared by a master.

Jump to

Keyboard shortcuts

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