nodes

package
v0.0.0-...-203cdba Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContainingPositions = map[string]string{
	"absolute": "relative",
}

Functions

func IsPureTextContent

func IsPureTextContent(n Node) bool

Types

type Fan

type Fan struct {
	// contains filtered or unexported fields
}

func (Fan) Slice

func (f Fan) Slice(root *Node) *Node

type Node

type Node struct {
	DomSubtree *html.Node `json:"-"`
	Text       string
	Wrappable  bool
	style.Map
	Rectangular
	Children []*Node
	// contains filtered or unexported fields
}

func NewNodeTree

func NewNodeTree(doc *html.Node, ps style.Map, nodeMap map[*html.Node]style.Map, parent *Node) (n *Node)

NewNodeTree propagates the cascading styles to the leaves

First applies the parent style and at the end the local style attribute's style is attached.

func (*Node) Ancestor

func (n *Node) Ancestor(tag string) *Node

Ancestor of tag

func (*Node) Attr

func (n *Node) Attr(k string) string

func (*Node) CB

func (n *Node) CB() (blk *Node)

CB returns the Containing Block.

func (*Node) CBItems

func (n *Node) CBItems() (cbis []*Node)

CBItems returns items that are within this containing block

func (Node) Content

func (n Node) Content(pre bool) []string

func (Node) ContentString

func (n Node) ContentString(pre bool) (t string)

func (Node) Data

func (n Node) Data() string

func (*Node) Find

func (n *Node) Find(tag string) (c *Node)

func (*Node) FindAll

func (n *Node) FindAll(tag string) (cs []*Node)

func (*Node) FindNextPositions

func (n *Node) FindNextPositions(position string) (ps []*Node)

func (*Node) HasAttr

func (n *Node) HasAttr(k string) bool

func (*Node) NumVClusters

func (n *Node) NumVClusters() (m int)

func (*Node) Parent

func (n *Node) Parent() (p style.DomTree, ok bool)

func (*Node) Path

func (n *Node) Path() (p string, ok bool)

Path relative to body

func (*Node) PrintTree

func (n *Node) PrintTree()

func (*Node) Query

func (n *Node) Query(s string) (ns []*Node, err error)

func (*Node) QueryRef

func (n *Node) QueryRef() string

QueryRef relative to html > body

func (*Node) Rect

func (n *Node) Rect() image.Rectangle

func (*Node) Serialized

func (n *Node) Serialized() (string, error)

func (*Node) SetText

func (n *Node) SetText(t string)

SetText by replacing child nodes with a TextNode containing t.

func (*Node) Style

func (n *Node) Style() style.Map

func (*Node) Traverse

func (n *Node) Traverse(f func(r int, c *Node))

func (Node) Type

func (n Node) Type() html.NodeType

func (*Node) VSlice

func (n *Node) VSlice(i, j int) (s []*Node)

type Rectangular

type Rectangular interface {
	Rect() image.Rectangle
}

Jump to

Keyboard shortcuts

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