diff --git a/elements.go b/elements.go index 84e2c86..e12584c 100644 --- a/elements.go +++ b/elements.go @@ -3,6 +3,7 @@ package hatmill +// Html creates a element. func Html(attribs ...Attrib) func(children ...Term) *ParentElement { return func(children ...Term) *ParentElement { return &ParentElement{ @@ -14,6 +15,8 @@ func Html(attribs ...Attrib) func(children ...Term) *ParentElement { } } } + +// Head creates a element. func Head(attribs ...Attrib) func(children ...Term) *ParentElement { return func(children ...Term) *ParentElement { return &ParentElement{ @@ -25,6 +28,8 @@ func Head(attribs ...Attrib) func(children ...Term) *ParentElement { } } } + +// Body creates a element. func Body(attribs ...Attrib) func(children ...Term) *ParentElement { return func(children ...Term) *ParentElement { return &ParentElement{ @@ -36,6 +41,8 @@ func Body(attribs ...Attrib) func(children ...Term) *ParentElement { } } } + +// Div creates a
element. func Div(attribs ...Attrib) func(children ...Term) *ParentElement { return func(children ...Term) *ParentElement { return &ParentElement{ @@ -47,12 +54,16 @@ func Div(attribs ...Attrib) func(children ...Term) *ParentElement { } } } + +// Img creates a element. func Img(attribs ...Attrib) EmptyElement { return EmptyElement{ TagName: "img", Attribs: attribs, } } + +// Span creates a element. func Span(attribs ...Attrib) func(children ...Term) *ParentElement { return func(children ...Term) *ParentElement { return &ParentElement{ diff --git a/internal/elementgen/main.go b/internal/elementgen/main.go index a9b10dd..1ebf4bb 100644 --- a/internal/elementgen/main.go +++ b/internal/elementgen/main.go @@ -19,11 +19,12 @@ const ( parentType = "parent" emptyType = "empty" - parentTemplate = `func %s(attribs ...Attrib) func(children ...Term) *ParentElement { + parentTemplate = `// %[1]s creates a <%[2]s> element. + func %[1]s(attribs ...Attrib) func(children ...Term) *ParentElement { return func(children ...Term) *ParentElement { return &ParentElement{ EmptyElement: EmptyElement{ - TagName: "%s", + TagName: "%[2]s", Attribs: attribs, }, Children: children, @@ -31,9 +32,10 @@ const ( } } ` - emptyTemplate = `func %s(attribs ...Attrib) EmptyElement { + emptyTemplate = `// %[1]s creates a <%[2]s> element. + func %[1]s(attribs ...Attrib) EmptyElement { return EmptyElement{ - TagName: "%s", + TagName: "%[2]s", Attribs: attribs, } }