Add Textf function (#17) Like Text, but calls fmt.Sprintf before rendering.
1 file changed, 7 insertions(+), 0 deletions(-)
changed files
M gomponents.go → gomponents.go
@@ -109,6 +109,13 @@ return template.HTMLEscaper(t) } } +// Textf creates a text DOM Node that Renders the interpolated and escaped string t. +func Textf(format string, a ...interface{}) NodeFunc { + return func() string { + return template.HTMLEscaper(fmt.Sprintf(format, a...)) + } +} + // Raw creates a raw Node that just Renders the unescaped string t. func Raw(t string) NodeFunc { return func() string {