node

package
v0.0.0-...-6902453 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendChild

func AppendChild(parent Node, child Node)

func Debug

func Debug(n Node) string

func IsFragment

func IsFragment(v Node) bool

func IterChildElement

func IterChildElement(ctx context.Context, n Node) <-chan Node

func RenderToString

func RenderToString(w io.Writer, n Node, optFns ...RenderOptionFunc)

Types

type DisplayNameSetter

type DisplayNameSetter interface {
	SetDisplayName(name string)
}

type Element

type Element struct {
	Name string
	// contains filtered or unexported fields
}

func (*Element) DisplayName

func (e *Element) DisplayName() string

func (*Element) FirstChild

func (e *Element) FirstChild() Node

func (*Element) LastChild

func (e *Element) LastChild() Node

func (*Element) NextSibling

func (e *Element) NextSibling() Node

func (*Element) ParentNode

func (e *Element) ParentNode() Node

func (*Element) PreviousSibling

func (e *Element) PreviousSibling() Node

func (*Element) SetDisplayName

func (e *Element) SetDisplayName(name string)

func (*Element) SetFirstChild

func (e *Element) SetFirstChild(n Node)

func (*Element) SetLastChild

func (e *Element) SetLastChild(n Node)

func (*Element) SetNextSibling

func (e *Element) SetNextSibling(n Node)

func (*Element) SetParentNode

func (e *Element) SetParentNode(n Node)

func (*Element) SetPreviousSibling

func (e *Element) SetPreviousSibling(n Node)

func (*Element) String

func (e *Element) String() string

type Fragment

type Fragment struct {
	Element
}

func (Fragment) DisplayName

func (Fragment) DisplayName() string

func (Fragment) String

func (Fragment) String() string

type Node

type Node interface {
	DisplayName() string

	ParentNode() Node
	FirstChild() Node
	LastChild() Node

	PreviousSibling() Node
	NextSibling() Node

	SetParentNode(n Node)
	SetFirstChild(n Node)
	SetLastChild(n Node)
	SetPreviousSibling(p Node)
	SetNextSibling(p Node)
}

func InsertBefore

func InsertBefore(parent, newChildNode, oldChildNode Node) Node

func RemoveChild

func RemoveChild(parent Node, child Node) Node

type RenderOptionFunc

type RenderOptionFunc = func(w *printer)

func WithPretty

func WithPretty(pretty bool) RenderOptionFunc

func WithPtr

func WithPtr(ptr bool) RenderOptionFunc

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL