Documentation ¶
Overview ¶
Package nodes provides data structures to represents Html ElementNodes, TextNodes and Attributes.
You are free to use this package, but is probably more comfortable to use the html package, that already have html elements and common attributes.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Beautify = false
Functions ¶
This section is empty.
Types ¶
type Attr ¶
type Attr struct {
// contains filtered or unexported fields
}
Attr holds information about an attribute for an Element Node
type Element ¶
type Element struct {
// contains filtered or unexported fields
}
func NewElement ¶
NewElement creates a new element with the provided tagname and the provided options The options can be:
* An Attr that will be render * A string or Text * Another Element * Any WriterTo interface Attributes are output in order The rest is output in the same order as received
Example ¶
Beautify = false content := NewElement("html", NewAttr("lang", "en"), NewElement("head", NewElement("title", "Mi pagina")), NewElement("body", NewElement("h1", "This is my page")), ) content.WriteTo(os.Stdout)
Output: <html lang="en"><head><title>Mi pagina</title></head><body><h1>This is my page</h1></body></html>
Click to show internal directories.
Click to hide internal directories.