diff options
Diffstat (limited to 'gomponents.go')
-rw-r--r-- | gomponents.go | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/gomponents.go b/gomponents.go index 4f610f4..9f86538 100644 --- a/gomponents.go +++ b/gomponents.go @@ -4,7 +4,7 @@ // to the given writer as a string. // // All DOM elements and attributes can be created by using the El and Attr functions. -// The functions Text, Textf, and Raw can be used to create text nodes. +// The functions Text, Textf, Raw, and Rawf can be used to create text nodes. // See also helper functions Group, Map, and If. // // For basic HTML elements and attributes, see the package html. @@ -207,7 +207,7 @@ func Text(t string) Node { }) } -// Textf creates a text DOM Node that Renders the interpolated and escaped string t. +// Textf creates a text DOM Node that Renders the interpolated and escaped string format. func Textf(format string, a ...interface{}) Node { return NodeFunc(func(w io.Writer) error { _, err := w.Write([]byte(template.HTMLEscapeString(fmt.Sprintf(format, a...)))) @@ -223,6 +223,14 @@ func Raw(t string) Node { }) } +// Rawf creates a text DOM Node that just Renders the interpolated and unescaped string format. +func Rawf(format string, a ...interface{}) Node { + return NodeFunc(func(w io.Writer) error { + _, err := w.Write([]byte(fmt.Sprintf(format, a...))) + return err + }) +} + type group struct { children []Node } |