Moved HTML5 helpers to subpackage

This commit is contained in:
2019-03-24 19:56:24 -06:00
parent e5b056c1c1
commit 239ffa7ac2
4 changed files with 24 additions and 12 deletions

135
html5/generated.go Normal file
View File

@ -0,0 +1,135 @@
// GENERATED BY gitlab.codemonkeysoftware.net/b/hatmill/internal/codegen
// DO NOT EDIT!
package html5
import . "gitlab.codemonkeysoftware.net/b/hatmill"
// Body creates a <body> element.
func Body(attribs ...Attrib) func(children ...Term) *ParentElement {
return func(children ...Term) *ParentElement {
return &ParentElement{
EmptyElement: EmptyElement{
TagName: "body",
Attribs: attribs,
},
Children: children,
}
}
}
// Div creates a <div> element.
func Div(attribs ...Attrib) func(children ...Term) *ParentElement {
return func(children ...Term) *ParentElement {
return &ParentElement{
EmptyElement: EmptyElement{
TagName: "div",
Attribs: attribs,
},
Children: children,
}
}
}
// Head creates a <head> element.
func Head(attribs ...Attrib) func(children ...Term) *ParentElement {
return func(children ...Term) *ParentElement {
return &ParentElement{
EmptyElement: EmptyElement{
TagName: "head",
Attribs: attribs,
},
Children: children,
}
}
}
// Html creates a <html> element.
func Html(attribs ...Attrib) func(children ...Term) *ParentElement {
return func(children ...Term) *ParentElement {
return &ParentElement{
EmptyElement: EmptyElement{
TagName: "html",
Attribs: attribs,
},
Children: children,
}
}
}
// Img creates a <img> element.
func Img(attribs ...Attrib) EmptyElement {
return EmptyElement{
TagName: "img",
Attribs: attribs,
}
}
// Li creates a <li> element.
func Li(attribs ...Attrib) func(children ...Term) *ParentElement {
return func(children ...Term) *ParentElement {
return &ParentElement{
EmptyElement: EmptyElement{
TagName: "li",
Attribs: attribs,
},
Children: children,
}
}
}
// Span creates a <span> element.
func Span(attribs ...Attrib) func(children ...Term) *ParentElement {
return func(children ...Term) *ParentElement {
return &ParentElement{
EmptyElement: EmptyElement{
TagName: "span",
Attribs: attribs,
},
Children: children,
}
}
}
// Title creates a <title> element.
func Title(attribs ...Attrib) func(children ...Term) *ParentElement {
return func(children ...Term) *ParentElement {
return &ParentElement{
EmptyElement: EmptyElement{
TagName: "title",
Attribs: attribs,
},
Children: children,
}
}
}
// Ul creates a <ul> element.
func Ul(attribs ...Attrib) func(children ...Term) *ParentElement {
return func(children ...Term) *ParentElement {
return &ParentElement{
EmptyElement: EmptyElement{
TagName: "ul",
Attribs: attribs,
},
Children: children,
}
}
}
func Disabled() Attrib {
return Attrib{
Key: "disabled",
}
}
func Id(value string) Attrib {
return Attrib{
Key: "id",
Value: value,
}
}
func Src(value string) Attrib {
return Attrib{
Key: "src",
Value: value,
}
}

17
html5/html5.go Normal file
View File

@ -0,0 +1,17 @@
package html5
import "gitlab.codemonkeysoftware.net/b/hatmill"
// Data creates an attribute of the form "data-suffix='value'".
func Data(suffix, value string) hatmill.Attrib {
return hatmill.Attrib{
Key: "data-" + suffix,
Value: value,
}
}
// Text converts a string to a hatmill.Text. Text(s) is functionally identical
// to hatmill.Text(s) and is reproduced here for convenience.
func Text(s string) hatmill.Text {
return hatmill.Text(s)
}