diff --git a/attribute/generated.go b/attribute/generated.go index 887785b..02d05d1 100644 --- a/attribute/generated.go +++ b/attribute/generated.go @@ -4,6 +4,7 @@ package attribute import "gitlab.codemonkeysoftware.net/b/hatmill" +import "strconv" // Accept creates a "accept" attribute func Accept(value string) hatmill.Attrib { @@ -146,18 +147,18 @@ func Class(value string) hatmill.Attrib { } // Cols creates a "cols" attribute -func Cols(value string) hatmill.Attrib { +func Cols(value int) hatmill.Attrib { return hatmill.Attrib{ Key: "cols", - Value: value, + Value: strconv.FormatInt(int64(value), 10), } } // Colspan creates a "colspan" attribute -func Colspan(value string) hatmill.Attrib { +func Colspan(value int) hatmill.Attrib { return hatmill.Attrib{ Key: "colspan", - Value: value, + Value: strconv.FormatInt(int64(value), 10), } } @@ -326,10 +327,10 @@ func Headers(value string) hatmill.Attrib { } // Height creates a "height" attribute -func Height(value string) hatmill.Attrib { +func Height(value int) hatmill.Attrib { return hatmill.Attrib{ Key: "height", - Value: value, + Value: strconv.FormatInt(int64(value), 10), } } @@ -490,11 +491,11 @@ func Max(value string) hatmill.Attrib { } } -// Maxlengh creates a "maxlengh" attribute -func Maxlengh(value string) hatmill.Attrib { +// Maxlength creates a "maxlength" attribute +func Maxlength(value int) hatmill.Attrib { return hatmill.Attrib{ - Key: "maxlengh", - Value: value, + Key: "maxlength", + Value: strconv.FormatInt(int64(value), 10), } } @@ -523,10 +524,10 @@ func Min(value string) hatmill.Attrib { } // Minlength creates a "minlength" attribute -func Minlength(value string) hatmill.Attrib { +func Minlength(value int) hatmill.Attrib { return hatmill.Attrib{ Key: "minlength", - Value: value, + Value: strconv.FormatInt(int64(value), 10), } } @@ -652,18 +653,18 @@ func Reversed() hatmill.Attrib { } // Rows creates a "rows" attribute -func Rows(value string) hatmill.Attrib { +func Rows(value int) hatmill.Attrib { return hatmill.Attrib{ Key: "rows", - Value: value, + Value: strconv.FormatInt(int64(value), 10), } } // Rowspan creates a "rowspan" attribute -func Rowspan(value string) hatmill.Attrib { +func Rowspan(value int) hatmill.Attrib { return hatmill.Attrib{ Key: "rowspan", - Value: value, + Value: strconv.FormatInt(int64(value), 10), } } @@ -699,10 +700,10 @@ func Shape(value string) hatmill.Attrib { } // Size creates a "size" attribute -func Size(value string) hatmill.Attrib { +func Size(value int) hatmill.Attrib { return hatmill.Attrib{ Key: "size", - Value: value, + Value: strconv.FormatInt(int64(value), 10), } } @@ -803,10 +804,10 @@ func Summary(value string) hatmill.Attrib { } // Tabindex creates a "tabindex" attribute -func Tabindex(value string) hatmill.Attrib { +func Tabindex(value int) hatmill.Attrib { return hatmill.Attrib{ Key: "tabindex", - Value: value, + Value: strconv.FormatInt(int64(value), 10), } } @@ -859,10 +860,10 @@ func Value(value string) hatmill.Attrib { } // Width creates a "width" attribute -func Width(value string) hatmill.Attrib { +func Width(value int) hatmill.Attrib { return hatmill.Attrib{ Key: "width", - Value: value, + Value: strconv.FormatInt(int64(value), 10), } } diff --git a/defs.json b/defs.json index 6697efc..72ea458 100644 --- a/defs.json +++ b/defs.json @@ -18,8 +18,8 @@ {"name": "checked", "type": "bool"}, {"name": "cite", "type": "string"}, {"name": "class", "type": "string"}, - {"name": "cols", "type": "string"}, - {"name": "colspan", "type": "string"}, + {"name": "cols", "type": "int"}, + {"name": "colspan", "type": "int"}, {"name": "content", "type": "string"}, {"name": "contenteditable", "type": "string"}, {"name": "contextmenu", "type": "string"}, @@ -41,7 +41,7 @@ {"name": "form", "type": "string"}, {"name": "formaction", "type": "string"}, {"name": "headers", "type": "string"}, - {"name": "height", "type": "string"}, + {"name": "height", "type": "int"}, {"name": "hidden", "type": "bool"}, {"name": "high", "type": "string"}, {"name": "href", "type": "string"}, @@ -62,11 +62,11 @@ {"name": "low", "type": "string"}, {"name": "manifest", "type": "string"}, {"name": "max", "type": "string"}, - {"name": "maxlengh", "type": "string"}, + {"name": "maxlength", "type": "int"}, {"name": "media", "type": "string"}, {"name": "method", "type": "string"}, {"name": "min", "type": "string"}, - {"name": "minlength", "type": "string"}, + {"name": "minlength", "type": "int"}, {"name": "multiple", "type": "bool"}, {"name": "muted", "type": "bool"}, {"name": "name", "type": "string"}, @@ -83,13 +83,13 @@ {"name": "rel", "type": "string"}, {"name": "required", "type": "bool"}, {"name": "reversed", "type": "bool"}, - {"name": "rows", "type": "string"}, - {"name": "rowspan", "type": "string"}, + {"name": "rows", "type": "int"}, + {"name": "rowspan", "type": "int"}, {"name": "sandbox", "type": "string"}, {"name": "scope", "type": "string"}, {"name": "selected", "type": "bool"}, {"name": "shape", "type": "string"}, - {"name": "size", "type": "string"}, + {"name": "size", "type": "int"}, {"name": "sizes", "type": "string"}, {"name": "slot", "type": "string"}, {"name": "span", "type": "string"}, @@ -102,14 +102,14 @@ {"name": "step", "type": "string"}, {"name": "style", "type": "string"}, {"name": "summary", "type": "string"}, - {"name": "tabindex", "type": "string"}, + {"name": "tabindex", "type": "int"}, {"name": "target", "type": "string"}, {"name": "title", "type": "string"}, {"name": "translate", "type": "string"}, {"name": "type", "type": "string"}, {"name": "usemap", "type": "string"}, {"name": "value", "type": "string"}, - {"name": "width", "type": "string"}, + {"name": "width", "type": "int"}, {"name": "wrap", "type": "string"} ], "elements": [ diff --git a/hatmill_test.go b/hatmill_test.go index f18e605..a9bd1df 100644 --- a/hatmill_test.go +++ b/hatmill_test.go @@ -190,9 +190,10 @@ func Example() { he.Img(ha.Src("./me.jpg"), ha.Id("profile-photo")), hatmill.Text(html.EscapeString(userInput)), he.Div(ha.Disabled(), ha.CustomData("coolness", "awesome"))(), + he.Textarea(ha.Height(25))(), ), ), ) hatmill.WriteDocument(os.Stdout, document) - // Output: