From 6948cdde4fa3e61548c9d089db2a859557df37b4 Mon Sep 17 00:00:00 2001 From: Brandon Dyck Date: Thu, 28 Mar 2019 21:00:53 -0600 Subject: [PATCH] Added WHATWG HTML5 element defs --- html5/defs.json | 107 +++- html5/generated.go | 1300 +++++++++++++++++++++++++++++++++++++++++++ html5/html5.go | 4 +- html5/html5_test.go | 2 +- 4 files changed, 1409 insertions(+), 4 deletions(-) diff --git a/html5/defs.json b/html5/defs.json index 71c624f..5360de6 100644 --- a/html5/defs.json +++ b/html5/defs.json @@ -5,14 +5,119 @@ {"name": "src", "type": "string"} ], "elements": [ + {"name": "a"}, + {"name": "abbr"}, + {"name": "address"}, + {"name": "area", "void": true}, + {"name": "article"}, + {"name": "aside"}, + {"name": "audio"}, + {"name": "b"}, + {"name": "base", "void": true}, + {"name": "bdi"}, + {"name": "bdo"}, + {"name": "blockquote"}, {"name": "body"}, + {"name": "br", "void": true}, + {"name": "button"}, + {"name": "canvas"}, + {"name": "caption"}, + {"name": "cite"}, + {"name": "code"}, + {"name": "col", "void": true}, + {"name": "colgroup"}, + {"name": "data"}, + {"name": "datalist"}, + {"name": "dd"}, + {"name": "del"}, + {"name": "details"}, + {"name": "dfn"}, + {"name": "dialog"}, {"name": "div"}, + {"name": "dl"}, + {"name": "dt"}, + {"name": "em"}, + {"name": "embed", "void": true}, + {"name": "fieldset"}, + {"name": "figcaption"}, + {"name": "figure"}, + {"name": "footer"}, + {"name": "form"}, + {"name": "h1"}, + {"name": "h2"}, + {"name": "h3"}, + {"name": "h4"}, + {"name": "h5"}, + {"name": "h6"}, {"name": "head"}, + {"name": "header"}, + {"name": "hgroup"}, + {"name": "hr", "void": true}, {"name": "html"}, + {"name": "i"}, + {"name": "iframe"}, {"name": "img", "void": true}, + {"name": "input", "void": true}, + {"name": "ins"}, + {"name": "kbd"}, + {"name": "label"}, + {"name": "legend"}, {"name": "li"}, + {"name": "link", "void": true}, + {"name": "main"}, + {"name": "map"}, + {"name": "mark"}, + {"name": "math"}, + {"name": "menu"}, + {"name": "meta", "void": true}, + {"name": "meter"}, + {"name": "nav"}, + {"name": "noscript"}, + {"name": "object"}, + {"name": "ol"}, + {"name": "optgroup"}, + {"name": "option"}, + {"name": "output"}, + {"name": "p"}, + {"name": "param", "void": true}, + {"name": "picture"}, + {"name": "pre"}, + {"name": "progress"}, + {"name": "q"}, + {"name": "rp"}, + {"name": "rt"}, + {"name": "ruby"}, + {"name": "s"}, + {"name": "samp"}, + {"name": "script"}, + {"name": "section"}, + {"name": "select"}, + {"name": "slot"}, + {"name": "small"}, + {"name": "source", "void": true}, {"name": "span"}, + {"name": "strong"}, + {"name": "style"}, + {"name": "sub"}, + {"name": "summary"}, + {"name": "sup"}, + {"name": "svg"}, + {"name": "table"}, + {"name": "tbody"}, + {"name": "td"}, + {"name": "template"}, + {"name": "textarea"}, + {"name": "tfoot"}, + {"name": "th"}, + {"name": "thead"}, + {"name": "time"}, {"name": "title"}, - {"name": "ul"} + {"name": "tr"}, + {"name": "track", "void": true}, + {"name": "u"}, + {"name": "ul"}, + {"name": "var"}, + {"name": "video"}, + {"name": "wbr", "void": true} ] } diff --git a/html5/generated.go b/html5/generated.go index b933091..affa45e 100644 --- a/html5/generated.go +++ b/html5/generated.go @@ -5,6 +5,152 @@ package html5 import "gitlab.codemonkeysoftware.net/b/hatmill" +// A creates a element. +func A(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement { + return func(children ...hatmill.Term) hatmill.ParentElement { + return hatmill.ParentElement{ + VoidElement: hatmill.VoidElement{ + TagName: "a", + Attribs: attribs, + }, + Children: children, + } + } +} + +// Abbr creates a element. +func Abbr(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement { + return func(children ...hatmill.Term) hatmill.ParentElement { + return hatmill.ParentElement{ + VoidElement: hatmill.VoidElement{ + TagName: "abbr", + Attribs: attribs, + }, + Children: children, + } + } +} + +// Address creates a
element. +func Address(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement { + return func(children ...hatmill.Term) hatmill.ParentElement { + return hatmill.ParentElement{ + VoidElement: hatmill.VoidElement{ + TagName: "address", + Attribs: attribs, + }, + Children: children, + } + } +} + +// Area creates a element. +func Area(attribs ...hatmill.Attrib) hatmill.VoidElement { + return hatmill.VoidElement{ + TagName: "area", + Attribs: attribs, + } +} + +// Article creates a
element. +func Article(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement { + return func(children ...hatmill.Term) hatmill.ParentElement { + return hatmill.ParentElement{ + VoidElement: hatmill.VoidElement{ + TagName: "article", + Attribs: attribs, + }, + Children: children, + } + } +} + +// Aside creates a