stencil

package
v0.0.0-...-72c23d9 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fill

func Fill(template []byte, values map[string]string) ([]byte, error)

Fill renders a markdown template by substituting {{.X}} markers from values. Every top-level marker absent from values or empty is collected and reported in one error; the template is never executed with unfilled top-level markers.

func FillOptional

func FillOptional(template []byte, values map[string]string, optional []string) ([]byte, error)

FillOptional renders a template like Fill, except names in optional are exempt from the unfilled-marker guarantee and render as nothing if absent or empty.

func StripLeadingComment

func StripLeadingComment(text string) string

StripLeadingComment drops a leading `<!-- ... -->` block from text and returns text unchanged when there is none. It is the same stripper Fill and FillOptional apply to a template before parsing it.

func TopLevelMarkers

func TopLevelMarkers(template []byte) ([]string, error)

TopLevelMarkers parses template and returns the deduplicated, sorted names of every top-level {{.X}} marker it declares. It is the marker-set accessor `lyx stencil validate` uses to compare two templates, not a validity check: a marker is listed here regardless of whether any value would fill it.

Types

This section is empty.

Jump to

Keyboard shortcuts

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