Documentation ¶
Index ¶
- Variables
- func CreateHTMLTemplate(name string) *html.Template
- func CreateTemplate(name string) *template.Template
- func ParseFS(t *template.Template, f fs.FS, patterns ...string) error
- func ParseHTMLFS(t *html.Template, f fs.FS, pattern string, baseDir string) error
- func RenderHtmlTemplateString(tmpl string, data interface{}) (string, error)
- func RenderTemplate(tmpl TemplateExecute, data interface{}) (string, error)
- func RenderTemplateFile(filename string, data interface{}) (string, error)
- func RenderTemplateString(tmpl string, data interface{}) (string, error)
- type TemplateExecute
Constants ¶
This section is empty.
Variables ¶
View Source
var TemplateFuncs = template.FuncMap{ "trim": strings.TrimSpace, "trimRightSpace": trimRightSpace, "trimTrailingWhitespaces": trimRightSpace, "rpad": rpad, "quote": quote, "stripNewlines": stripNewlines, "quoteNewlines": quoteNewlines, "toUpper": strings.ToUpper, "toLower": strings.ToLower, "replaceRegexp": replaceRegexp, "add": add, "sub": sub, "div": div, "mul": mul, "parseFloat": parseFloat, "parseInt": parseInt, "currency": currency, "padLeft": padLeft, "padRight": padRight, "padCenter": padCenter, "bold": bold, "underline": underline, "italic": italic, "strikethrough": strikethrough, "code": code, "codeBlock": codeBlock, "toYaml": toYaml, "indentBlock": indentBlock, "styleBold": styleBold, }
TemplateFuncs provides helpers for the standard cobra usage and help templates
Functions ¶
func CreateHTMLTemplate ¶
func CreateTemplate ¶
func ParseFS ¶
ParseFS will recursively glob for all the files matching the given patterns, and load them into one big template (with sub-templates). The globs use bmatcuk/doublestar and support ** notation for recursive globbing.
func ParseHTMLFS ¶
ParseHTMLFS will recursively glob for all the files matching the given patterns, and load them into one big template (with sub-templates). It is the html.Template equivalent of ParseFS.
The globs use bmatcuk/doublestar and support ** notation for recursive globbing.
func RenderTemplate ¶
func RenderTemplate(tmpl TemplateExecute, data interface{}) (string, error)
func RenderTemplateFile ¶
func RenderTemplateString ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.