diff --git a/attribute/generated.go b/attribute/generated.go index 92c1d3e..c458d7c 100644 --- a/attribute/generated.go +++ b/attribute/generated.go @@ -139,10 +139,10 @@ func Content(value string) hatmill.Attrib { } // Contenteditable creates a "contenteditable" attribute -func Contenteditable(value string) hatmill.Attrib { +func Contenteditable(value bool) hatmill.Attrib { return hatmill.Attrib{ Key: "contenteditable", - Value: value, + Value: strconv.FormatBool(value), } } @@ -239,10 +239,10 @@ func Download(value string) hatmill.Attrib { } // Draggable creates a "draggable" attribute -func Draggable(value string) hatmill.Attrib { +func Draggable(value bool) hatmill.Attrib { return hatmill.Attrib{ Key: "draggable", - Value: value, + Value: strconv.FormatBool(value), } } @@ -644,10 +644,10 @@ func Span(value int) hatmill.Attrib { } // Spellcheck creates a "spellcheck" attribute -func Spellcheck(value string) hatmill.Attrib { +func Spellcheck(value bool) hatmill.Attrib { return hatmill.Attrib{ Key: "spellcheck", - Value: value, + Value: strconv.FormatBool(value), } } diff --git a/defs.json b/defs.json index e7992fd..2bfd22b 100644 --- a/defs.json +++ b/defs.json @@ -17,7 +17,7 @@ {"name": "cols", "type": "int"}, {"name": "colspan", "type": "int"}, {"name": "content", "type": "string"}, - {"name": "contenteditable", "type": "string"}, + {"name": "contenteditable", "type": "explicit bool"}, {"name": "contextmenu", "type": "string"}, {"name": "controls", "type": "bool"}, {"name": "coords", "type": "string"}, @@ -30,7 +30,7 @@ {"name": "dirname", "type": "string"}, {"name": "disabled", "type": "bool"}, {"name": "download", "type": "string"}, - {"name": "draggable", "type": "string"}, + {"name": "draggable", "type": "explicit bool"}, {"name": "enctype", "type": "string"}, {"name": "for", "type": "string"}, {"name": "form", "type": "string"}, @@ -82,7 +82,7 @@ {"name": "size", "type": "int"}, {"name": "sizes", "type": "string"}, {"name": "span", "type": "int"}, - {"name": "spellcheck", "type": "string"}, + {"name": "spellcheck", "type": "explicit bool"}, {"name": "src", "type": "string"}, {"name": "srcdoc", "type": "string"}, {"name": "srclang", "type": "string"}, diff --git a/hatmill_test.go b/hatmill_test.go index e7509ba..15b4805 100644 --- a/hatmill_test.go +++ b/hatmill_test.go @@ -183,7 +183,7 @@ func Example() { document := he.Html()( he.Body()( - he.Img(ha.Src("./photo.jpg")), + he.Img(ha.Src("./photo.jpg"), ha.Contenteditable(true)), hatmill.Text(html.EscapeString(userInput)), he.Div(ha.Disabled(), ha.CustomData("coolness", "awesome"))(), he.Textarea(ha.Rows(25))(), @@ -191,5 +191,5 @@ func Example() { ), ) hatmill.WriteDocument(os.Stdout, document) - // Output:
<script>launchMissiles();</script>