templatefuncs

package module
v0.0.0-...-1b0f851 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 11 Imported by: 0

README

templatefuncs

Package templatefuncs provides a rich set of text/template functions.

templatefuncs is a modern alternative to github.com/masterminds/sprig with the following goals:

  • Flexible, practical typing of user-equivalent types (e.g. functions that accept strings also accept fmt.Stringers and []bytes).
  • Correct argument order, compatible with text/template's pipelines where the most variable argument is passed last (e.g. so you can write dict "key" "value" | hasKey "key" instead of hasKey (dict "key" value") "key").
  • Idiomatic Go naming conventions (e.g. toJSON, not toJson).
  • Structure-preserving transformations (e.g. toLower converts a string to a string and also converts a []string to a []string).
  • Linkable documentation for individual template functions (so you can direct users to the documentation for a single function, not just a page of functions).
  • Exported documentation which you can include in your own project (so you can include a full list of template functions that your project supports).
  • Actively maintained.

templatefuncs explicitly is not backwards compatible with github.com/masterminds/sprig.

templatefuncs is currently in the experimental stage and is not suitable for production use.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewFuncMap

func NewFuncMap() template.FuncMap

NewFuncMap returns a new text/template.FuncMap containing all template functions.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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