styledtree

package
v0.1.0-experimental.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2021 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. The resulting styled tree exposes interface style.TreeNode for every node and may be manipulated via an API.

This is the default implementation used by the engine. However, for interactive use it may be appropriate to create a styled tree derived from another type of styled node. The engine's design should fully support this kind of switch.

BSD License

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of this software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Creator

func Creator() style.NodeCreator

Creator returns a style-creator for use in CSSOM. The returned style.NodeCreator will then build up an instance of a styled tree with node type styledtree.StyNode.

func NewNodeForHTMLNode

func NewNodeForHTMLNode(html *html.Node) *tree.Node

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

func T

func T() tracing.Trace

T traces to the engine tracer.

Types

type StyNode

type StyNode struct {
	tree.Node // 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

Node gets the styled node from a generic tree node.

func (*StyNode) AsStyler

func (sn *StyNode) AsStyler() style.Styler

AsStyler returns a styled tree node as 'style.Styler'.

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) Styles

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

Styles is part of interface style.Styler.

func (*StyNode) StylesCascade

func (sn *StyNode) StylesCascade() style.Styler

StylesCascade gets the upwards to the enclosing style set.

Directories

Path Synopsis
Package xpathadapter implements an xpath.NodeNavigator.
Package xpathadapter implements an xpath.NodeNavigator.

Jump to

Keyboard shortcuts

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