Funcs registers named Go functions for use in template actions. Pass a template.FuncMap when creating the template; map keys become template identifiers and values provide the Go functions they call. section 11.5.2 section 11.6
Classifying habit progress
A statusCSSClass function maps a habit’s completed fraction to labels such as not_started, started, good_progress, and completed. Register it under that name, then invoke {{ statusCSSClass . }} inside a range to generate a CSS class.
Registered functions can also participate in pipelines:
- Register extractDomainNames and lower, then pass each result through extractDomainNames | lower | println. section 11.5.2
