Documentation
¶
Overview ¶
Package builder provides a programatic way of building the HTML tree structure in a way that can be more easily read without the documenet structure becoming a right leaning mess, such as:
&Doc{
Head: &Head{},
Body: &Body{
Elements: []Element{
&Div{
Elements: []Element{
&Table{
Elements: []TableElement{
&TR{
Elements: []TRElement{
&TD{},
&TD{},
},
},
},
},
},
},
},
},
}
With our builder, this becomes
b := NewHTML(&Head{}, &Body{})
b.Into(&Div{}) // Adds the div and moves into the div
b.Into(&Table{}) // Adds the table and moves into the table
b.Into(&TR{}) // Adds the table row and moves into the table row
b.Add(&TD{}, &TD{}) // Adds two table role elements, but stays in the row.
b.Up() // We now move back to the table, if we called b.Up() again, we'd be at the div
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTML ¶
type HTML struct {
// contains filtered or unexported fields
}
HTML provides a builder for constucting HTML objects that can be rendered. This attempts to allow tooling and other software constructs to be made that aren't right leaning pages of text.
func (*HTML) Add ¶
Add adds an element into the focus object, the object focus is not changed. If there is no object in focus this element is added to the doc's body.
Click to show internal directories.
Click to hide internal directories.