diff options
Diffstat (limited to 'gomponents.go')
-rw-r--r-- | gomponents.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gomponents.go b/gomponents.go index ab85226..beb13f3 100644 --- a/gomponents.go +++ b/gomponents.go @@ -25,6 +25,11 @@ func (n NodeFunc) Render() string { return n() } +// String satisfies fmt.Stringer. +func (n NodeFunc) String() string { + return n.Render() +} + // El creates an element DOM Node with a name and child Nodes. // Use this if no convenience creator exists. func El(name string, children ...Node) NodeFunc { @@ -92,6 +97,11 @@ func (a attr) Render() string { return fmt.Sprintf(` %v="%v"`, a.name, *a.value) } +// String satisfies fmt.Stringer. +func (a attr) String() string { + return a.Render() +} + // Text creates a text DOM Node that Renders the escaped string t. func Text(t string) NodeFunc { return func() string { |