diff --git a/attribs.go b/attribs.go deleted file mode 100644 index 98952ac..0000000 --- a/attribs.go +++ /dev/null @@ -1,22 +0,0 @@ -// GENERATED BY gitlab.codemonkeysoftware.net/b/hatmill/internal/attribgen -// DO NOT EDIT! - -package hatmill - -func Id(value string) Attrib { - return Attrib{ - Key: "id", - Value: value, - } -} -func Disabled() Attrib { - return Attrib{ - Key: "disabled", - } -} -func Src(value string) Attrib { - return Attrib{ - Key: "src", - Value: value, - } -} diff --git a/attribs.txt b/attribs.txt deleted file mode 100644 index 1185490..0000000 --- a/attribs.txt +++ /dev/null @@ -1,3 +0,0 @@ -id string -disabled bool -src string diff --git a/elements.txt b/elements.txt deleted file mode 100644 index 4ae5e2c..0000000 --- a/elements.txt +++ /dev/null @@ -1,9 +0,0 @@ -html parent -head parent -body parent -div parent -img empty -span parent -ul parent -li parent -title parent diff --git a/hatmill.go b/hatmill.go index baf2bc2..522f2b9 100644 --- a/hatmill.go +++ b/hatmill.go @@ -2,7 +2,7 @@ package hatmill import "io" -//go:generate go run ./internal/codegen/codegen.go +//go:generate go run ./internal/codegen/codegen.go -input htmldefs.json -output htmldefs.go -package hatmill // Term represents a fragment of HTML markup, and is one of EmptyElement, ParentElement, or Text. type Term interface { diff --git a/elements.go b/htmldefs.go similarity index 91% rename from elements.go rename to htmldefs.go index e89465e..02a5e41 100644 --- a/elements.go +++ b/htmldefs.go @@ -1,34 +1,8 @@ -// GENERATED BY gitlab.codemonkeysoftware.net/b/hatmill/internal/elementgen +// GENERATED BY gitlab.codemonkeysoftware.net/b/hatmill/internal/codegen // DO NOT EDIT! package hatmill -// Html creates a element. -func Html(attribs ...Attrib) func(children ...Term) *ParentElement { - return func(children ...Term) *ParentElement { - return &ParentElement{ - EmptyElement: EmptyElement{ - TagName: "html", - Attribs: attribs, - }, - Children: children, - } - } -} - -// Head creates a element. -func Head(attribs ...Attrib) func(children ...Term) *ParentElement { - return func(children ...Term) *ParentElement { - return &ParentElement{ - EmptyElement: EmptyElement{ - TagName: "head", - Attribs: attribs, - }, - Children: children, - } - } -} - // Body creates a element. func Body(attribs ...Attrib) func(children ...Term) *ParentElement { return func(children ...Term) *ParentElement { @@ -55,6 +29,32 @@ func Div(attribs ...Attrib) func(children ...Term) *ParentElement { } } +// Head creates a 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 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 element. func Img(attribs ...Attrib) EmptyElement { return EmptyElement{ @@ -63,32 +63,6 @@ func Img(attribs ...Attrib) EmptyElement { } } -// Span creates a element. -func Span(attribs ...Attrib) func(children ...Term) *ParentElement { - return func(children ...Term) *ParentElement { - return &ParentElement{ - EmptyElement: EmptyElement{ - TagName: "span", - Attribs: attribs, - }, - Children: children, - } - } -} - -// Ul creates a