A template engine binds a template to a data model, parses the template, and executes its actions to produce output. Ordinary text is copied unchanged; actions enclosed in {{...}} evaluate values supplied through the dot operator. section 11.1.2
Go templates support several executable features:
- Use {{.}} to print the current value, or use range and if to control how data is rendered. section 11.1.2
- Register Go functions with template.FuncMap, then call them by name from template actions. section 11.5.2
- Chain transformations with pipelines, passing one function’s output into the next with the | operator. section 11.5.2
Rendering habit status
A Go function can convert a habit’s weekly progress into labels such as not_started, started, good_progress, or completed. Register it as statusCSSClass, then render {{ statusCSSClass . }} inside a range loop to select the HTML element’s CSS class.




