diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-04-30 18:12:08 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2022-05-06 19:43:22 +0200 |
commit | 6eea32bd6bc8e7a7dd07a8cb6a8343ae2c74aba0 (patch) | |
tree | dc9b14069f5e983942ac53c6f5e6d8629a5c269e /tpl/safe | |
parent | a6d545854a670356e93cd48e55de6e81233d68cb (diff) |
tpl: Improve godoc
Diffstat (limited to 'tpl/safe')
-rw-r--r-- | tpl/safe/safe.go | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/tpl/safe/safe.go b/tpl/safe/safe.go index 6c836b25c..d1a2e8d4e 100644 --- a/tpl/safe/safe.go +++ b/tpl/safe/safe.go @@ -30,44 +30,44 @@ func New() *Namespace { // Namespace provides template functions for the "safe" namespace. type Namespace struct{} -// CSS returns a given string as html/template CSS content. -func (ns *Namespace) CSS(a any) (template.CSS, error) { - s, err := cast.ToStringE(a) - return template.CSS(s), err +// CSS returns the string s as html/template CSS content. +func (ns *Namespace) CSS(s any) (template.CSS, error) { + ss, err := cast.ToStringE(s) + return template.CSS(ss), err } -// HTML returns a given string as html/template HTML content. -func (ns *Namespace) HTML(a any) (template.HTML, error) { - s, err := cast.ToStringE(a) - return template.HTML(s), err +// HTML returns the string s as html/template HTML content. +func (ns *Namespace) HTML(s any) (template.HTML, error) { + ss, err := cast.ToStringE(s) + return template.HTML(ss), err } -// HTMLAttr returns a given string as html/template HTMLAttr content. -func (ns *Namespace) HTMLAttr(a any) (template.HTMLAttr, error) { - s, err := cast.ToStringE(a) - return template.HTMLAttr(s), err +// HTMLAttr returns the string s as html/template HTMLAttr content. +func (ns *Namespace) HTMLAttr(s any) (template.HTMLAttr, error) { + ss, err := cast.ToStringE(s) + return template.HTMLAttr(ss), err } // JS returns the given string as a html/template JS content. -func (ns *Namespace) JS(a any) (template.JS, error) { - s, err := cast.ToStringE(a) - return template.JS(s), err +func (ns *Namespace) JS(s any) (template.JS, error) { + ss, err := cast.ToStringE(s) + return template.JS(ss), err } // JSStr returns the given string as a html/template JSStr content. -func (ns *Namespace) JSStr(a any) (template.JSStr, error) { - s, err := cast.ToStringE(a) - return template.JSStr(s), err +func (ns *Namespace) JSStr(s any) (template.JSStr, error) { + ss, err := cast.ToStringE(s) + return template.JSStr(ss), err } -// URL returns a given string as html/template URL content. -func (ns *Namespace) URL(a any) (template.URL, error) { - s, err := cast.ToStringE(a) - return template.URL(s), err +// URL returns the string s as html/template URL content. +func (ns *Namespace) URL(s any) (template.URL, error) { + ss, err := cast.ToStringE(s) + return template.URL(ss), err } -// SanitizeURL returns a given string as html/template URL content. -func (ns *Namespace) SanitizeURL(a any) (string, error) { - s, err := cast.ToStringE(a) - return helpers.SanitizeURL(s), err +// SanitizeURL returns the string s as html/template URL content. +func (ns *Namespace) SanitizeURL(s any) (string, error) { + ss, err := cast.ToStringE(s) + return helpers.SanitizeURL(ss), err } |