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