styledtree

package
v0.0.0-...-ada8b72 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2023 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package styledtree is a straightforward default implementation of a styled document tree.

Overview

This is an implementation of style.TreeNode and of cssom.StyledNode. Using a builder type, cssom.Style() will create a styled tree from an HTML parse tree and a CSSOM.

___________________________________________________________________________

License

Governed by a 3-Clause BSD license. License file may be found in the root folder of this module.

Copyright © 2017–2022 Norbert Pillmayer <norbert@pillmayer.com>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewNodeForHTMLNode

func NewNodeForHTMLNode(html *html.Node) *tree.Node[*StyNode]

NewNodeForHTMLNode creates a new styled node linked to an HTML node.

Types

type StyNode

type StyNode struct {
	tree.Node[*StyNode] // we build on top of general purpose tree
	// contains filtered or unexported fields
}

StyNode is a style node, the building block of the styled tree.

func Node

func Node(n *tree.Node[*StyNode]) *StyNode

Node gets the styled node from a generic tree node.

func (*StyNode) GetPropertyValue

func (sn *StyNode) GetPropertyValue(key string, pmap *style.PropertyMap) style.Property

GetPropertyValue returns the property value for a given key. If the property is inherited, it may cascade. func (pmap *style.PropertyMap) GetPropertyValue(key string, node *tree.Node[*styledtree.StyNode]) style.Property {

func (*StyNode) HTMLNode

func (sn *StyNode) HTMLNode() *html.Node

HTMLNode gets the HTML DOM node corresponding to this styled node.

func (*StyNode) SetStyles

func (sn *StyNode) SetStyles(styles *style.PropertyMap)

SetStyles sets the styling properties of a styled node.

func (*StyNode) String

func (sn *StyNode) String() string

func (*StyNode) Styles

func (sn *StyNode) Styles() *style.PropertyMap

Styles is part of interface style.Styler.

Jump to

Keyboard shortcuts

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