Added doc comments to generated elements
This commit is contained in:
parent
c9d9cc59bc
commit
1e23de1266
11
elements.go
11
elements.go
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
package hatmill
|
package hatmill
|
||||||
|
|
||||||
|
// Html creates a <html> element.
|
||||||
func Html(attribs ...Attrib) func(children ...Term) *ParentElement {
|
func Html(attribs ...Attrib) func(children ...Term) *ParentElement {
|
||||||
return func(children ...Term) *ParentElement {
|
return func(children ...Term) *ParentElement {
|
||||||
return &ParentElement{
|
return &ParentElement{
|
||||||
@ -14,6 +15,8 @@ func Html(attribs ...Attrib) func(children ...Term) *ParentElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Head creates a <head> element.
|
||||||
func Head(attribs ...Attrib) func(children ...Term) *ParentElement {
|
func Head(attribs ...Attrib) func(children ...Term) *ParentElement {
|
||||||
return func(children ...Term) *ParentElement {
|
return func(children ...Term) *ParentElement {
|
||||||
return &ParentElement{
|
return &ParentElement{
|
||||||
@ -25,6 +28,8 @@ func Head(attribs ...Attrib) func(children ...Term) *ParentElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Body creates a <body> element.
|
||||||
func Body(attribs ...Attrib) func(children ...Term) *ParentElement {
|
func Body(attribs ...Attrib) func(children ...Term) *ParentElement {
|
||||||
return func(children ...Term) *ParentElement {
|
return func(children ...Term) *ParentElement {
|
||||||
return &ParentElement{
|
return &ParentElement{
|
||||||
@ -36,6 +41,8 @@ func Body(attribs ...Attrib) func(children ...Term) *ParentElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Div creates a <div> element.
|
||||||
func Div(attribs ...Attrib) func(children ...Term) *ParentElement {
|
func Div(attribs ...Attrib) func(children ...Term) *ParentElement {
|
||||||
return func(children ...Term) *ParentElement {
|
return func(children ...Term) *ParentElement {
|
||||||
return &ParentElement{
|
return &ParentElement{
|
||||||
@ -47,12 +54,16 @@ func Div(attribs ...Attrib) func(children ...Term) *ParentElement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Img creates a <img> element.
|
||||||
func Img(attribs ...Attrib) EmptyElement {
|
func Img(attribs ...Attrib) EmptyElement {
|
||||||
return EmptyElement{
|
return EmptyElement{
|
||||||
TagName: "img",
|
TagName: "img",
|
||||||
Attribs: attribs,
|
Attribs: attribs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Span creates a <span> element.
|
||||||
func Span(attribs ...Attrib) func(children ...Term) *ParentElement {
|
func Span(attribs ...Attrib) func(children ...Term) *ParentElement {
|
||||||
return func(children ...Term) *ParentElement {
|
return func(children ...Term) *ParentElement {
|
||||||
return &ParentElement{
|
return &ParentElement{
|
||||||
|
@ -19,11 +19,12 @@ const (
|
|||||||
parentType = "parent"
|
parentType = "parent"
|
||||||
emptyType = "empty"
|
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 func(children ...Term) *ParentElement {
|
||||||
return &ParentElement{
|
return &ParentElement{
|
||||||
EmptyElement: EmptyElement{
|
EmptyElement: EmptyElement{
|
||||||
TagName: "%s",
|
TagName: "%[2]s",
|
||||||
Attribs: attribs,
|
Attribs: attribs,
|
||||||
},
|
},
|
||||||
Children: children,
|
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{
|
return EmptyElement{
|
||||||
TagName: "%s",
|
TagName: "%[2]s",
|
||||||
Attribs: attribs,
|
Attribs: attribs,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user