Removed unneeded pointer from ParentElement receivers
This commit is contained in:
parent
f3226fa5cc
commit
4ecd5ccaf7
@ -78,9 +78,9 @@ type ParentElement struct {
|
||||
Children []Term
|
||||
}
|
||||
|
||||
func (e *ParentElement) isHtml() {}
|
||||
func (e ParentElement) isHtml() {}
|
||||
|
||||
func (e *ParentElement) WriteTo(w io.Writer) (n int64, err error) {
|
||||
func (e ParentElement) WriteTo(w io.Writer) (n int64, err error) {
|
||||
n, err = e.EmptyElement.WriteTo(w)
|
||||
if err != nil {
|
||||
return
|
||||
@ -110,7 +110,7 @@ func (t Text) WriteTo(w io.Writer) (n int64, err error) {
|
||||
|
||||
// WriteDocument writes an HTML5 doctype declaration, followed by root.
|
||||
// root should probably be an <html> element.
|
||||
func WriteDocument(w io.Writer, root *ParentElement) (n int64, err error) {
|
||||
func WriteDocument(w io.Writer, root ParentElement) (n int64, err error) {
|
||||
err = writeStringsTo(w, &n, "<!DOCTYPE html>")
|
||||
if err != nil {
|
||||
return
|
||||
|
@ -6,9 +6,9 @@ package html5
|
||||
import "gitlab.codemonkeysoftware.net/b/hatmill"
|
||||
|
||||
// Body creates a <body> element.
|
||||
func Body(attribs ...hatmill.Attrib) func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return &hatmill.ParentElement{
|
||||
func Body(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return hatmill.ParentElement{
|
||||
EmptyElement: hatmill.EmptyElement{
|
||||
TagName: "body",
|
||||
Attribs: attribs,
|
||||
@ -19,9 +19,9 @@ func Body(attribs ...hatmill.Attrib) func(children ...hatmill.Term) *hatmill.Par
|
||||
}
|
||||
|
||||
// Div creates a <div> element.
|
||||
func Div(attribs ...hatmill.Attrib) func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return &hatmill.ParentElement{
|
||||
func Div(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return hatmill.ParentElement{
|
||||
EmptyElement: hatmill.EmptyElement{
|
||||
TagName: "div",
|
||||
Attribs: attribs,
|
||||
@ -32,9 +32,9 @@ func Div(attribs ...hatmill.Attrib) func(children ...hatmill.Term) *hatmill.Pare
|
||||
}
|
||||
|
||||
// Head creates a <head> element.
|
||||
func Head(attribs ...hatmill.Attrib) func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return &hatmill.ParentElement{
|
||||
func Head(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return hatmill.ParentElement{
|
||||
EmptyElement: hatmill.EmptyElement{
|
||||
TagName: "head",
|
||||
Attribs: attribs,
|
||||
@ -45,9 +45,9 @@ func Head(attribs ...hatmill.Attrib) func(children ...hatmill.Term) *hatmill.Par
|
||||
}
|
||||
|
||||
// Html creates a <html> element.
|
||||
func Html(attribs ...hatmill.Attrib) func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return &hatmill.ParentElement{
|
||||
func Html(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return hatmill.ParentElement{
|
||||
EmptyElement: hatmill.EmptyElement{
|
||||
TagName: "html",
|
||||
Attribs: attribs,
|
||||
@ -66,9 +66,9 @@ func Img(attribs ...hatmill.Attrib) hatmill.EmptyElement {
|
||||
}
|
||||
|
||||
// Li creates a <li> element.
|
||||
func Li(attribs ...hatmill.Attrib) func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return &hatmill.ParentElement{
|
||||
func Li(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return hatmill.ParentElement{
|
||||
EmptyElement: hatmill.EmptyElement{
|
||||
TagName: "li",
|
||||
Attribs: attribs,
|
||||
@ -79,9 +79,9 @@ func Li(attribs ...hatmill.Attrib) func(children ...hatmill.Term) *hatmill.Paren
|
||||
}
|
||||
|
||||
// Span creates a <span> element.
|
||||
func Span(attribs ...hatmill.Attrib) func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return &hatmill.ParentElement{
|
||||
func Span(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return hatmill.ParentElement{
|
||||
EmptyElement: hatmill.EmptyElement{
|
||||
TagName: "span",
|
||||
Attribs: attribs,
|
||||
@ -92,9 +92,9 @@ func Span(attribs ...hatmill.Attrib) func(children ...hatmill.Term) *hatmill.Par
|
||||
}
|
||||
|
||||
// Title creates a <title> element.
|
||||
func Title(attribs ...hatmill.Attrib) func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return &hatmill.ParentElement{
|
||||
func Title(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return hatmill.ParentElement{
|
||||
EmptyElement: hatmill.EmptyElement{
|
||||
TagName: "title",
|
||||
Attribs: attribs,
|
||||
@ -105,9 +105,9 @@ func Title(attribs ...hatmill.Attrib) func(children ...hatmill.Term) *hatmill.Pa
|
||||
}
|
||||
|
||||
// Ul creates a <ul> element.
|
||||
func Ul(attribs ...hatmill.Attrib) func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) *hatmill.ParentElement {
|
||||
return &hatmill.ParentElement{
|
||||
func Ul(attribs ...hatmill.Attrib) func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return func(children ...hatmill.Term) hatmill.ParentElement {
|
||||
return hatmill.ParentElement{
|
||||
EmptyElement: hatmill.EmptyElement{
|
||||
TagName: "ul",
|
||||
Attribs: attribs,
|
||||
|
@ -105,9 +105,9 @@ type ElemDef struct {
|
||||
func (def ElemDef) Generate(qualified bool) string {
|
||||
const (
|
||||
parentTemplate = `// %[1]s creates a <%[2]s> element.
|
||||
func %[1]s(attribs ...%[3]sAttrib) func(children ...%[3]sTerm) *%[3]sParentElement {
|
||||
return func(children ...%[3]sTerm) *%[3]sParentElement {
|
||||
return &%[3]sParentElement{
|
||||
func %[1]s(attribs ...%[3]sAttrib) func(children ...%[3]sTerm) %[3]sParentElement {
|
||||
return func(children ...%[3]sTerm) %[3]sParentElement {
|
||||
return %[3]sParentElement{
|
||||
EmptyElement: %[3]sEmptyElement{
|
||||
TagName: "%[2]s",
|
||||
Attribs: attribs,
|
||||
|
Loading…
Reference in New Issue
Block a user