Documentation
¶
Index ¶
- func Append(parent *html.Node, children ...*html.Node) *html.Node
- func CsvEscape(n *html.Node) error
- func Entity(n *html.Node) error
- func Execute(n *html.Node, fmap map[string]NodeFunc) error
- func Generate(src string, fmap map[string]NodeFunc) (string, error)
- func GetArg(n *html.Node, i int) (out string)
- func GetAttr(n *html.Node, key string) (out string)
- func InsertBefore(parent *html.Node, children ...*html.Node) *html.Node
- func NewElement(name string, kv ...string) *html.Node
- func NewText(text string) *html.Node
- func RemoveChildren(n *html.Node) *html.Node
- func Render(w io.Writer, n *html.Node) error
- func RenderHTML(w io.Writer, n *html.Node) error
- func RenderStringFunc(render func(io.Writer, *html.Node) error) func(n *html.Node) (string, error)
- func Reparent(dst, src *html.Node) *html.Node
- func Replace(dst, src *html.Node) *html.Node
- func Select(n *html.Node, tag string) string
- func Selector(n *html.Node, fn func(*html.Node) bool) []*html.Node
- func Serve(outdir string, prefix string)
- func SetArg(n *html.Node, i int, k string)
- func TextContent(n *html.Node) string
- func ToArgs(n *html.Node) []string
- func TransformElement(n *html.Node, name string, attr ...string) *html.Node
- type NodeFunc
- type Paragrapher
- type Tokenizer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Append ¶
Append adds the child to the parent and returns the parent helper to do function chaining
func GetArg ¶
GetArg - get Attribute value by index.
If index is invalid, an empty string is returned.
func RemoveChildren ¶
RemoveChildren removes all child nodes and returns itself
func RenderStringFunc ¶
func Selector ¶
Selector recursively selects all nodes that match a given function
TODO: why is this in this file?
func TextContent ¶
Types ¶
type NodeFunc ¶
func ExecuteFunc ¶
func MakeTag ¶
MakeTag return a NodeFunc that transforms the incoming node - Type of ElementNode - With a new Tag name - With no Attributes - Children are preserved
func MakeTagClass ¶
MakeTagClass returns a NodeFunc that transforms in incoming node: - Type of ElementNode - With a new Tag Name - Clears all existing attributes - Add an attribute of class with value - Children are preserved.
func NewCsvTableHTML ¶
NewCsvTableHTML takes an embedded CSV and converts to an HTML table.
The table's tags have optional class attributes using the formatter function. If nil, then no class attributes are added. It takes the class name, and the row and col of the cell if appropriate.
fn("td", 3, 2") means emit a CSS class for a <td> in row 3, col 2. fn("table", 0,0,) the row and colum are always zero
Sometimes you need to wrap a table in an outer div to get the desired behavior.
fn("wrap", 0, 0)
if non-empty will wrap the table in a <div class="xxx">