douceuradapter

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: 6 Imported by: 0

Documentation

Overview

Package douceuradapter is a concrete implementation of interface cssom.StyleSheet.

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

This section is empty.

Types

type CSSStyles

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

CSSStyles is an adapter for interface cssom.StyleSheet. For an explanation of the motivation behind this design, please refer to documentation for interface cssom.StyleSheet.

func ExtractStyleElements

func ExtractStyleElements(htmldoc *html.Node) []*CSSStyles

ExtractStyleElements visits <head> and <body> elements in an HTML parse tree and searches for embedded <style>s. It returns the content of style-elements as style sheets.

func Wrap

func Wrap(css *css.Stylesheet) *CSSStyles

Wrap a douceur.css.Stylesheet into CssStyles. The stylesheet is now managed by the wrapper.

func (*CSSStyles) AppendRules

func (sheet *CSSStyles) AppendRules(other cssom.StyleSheet)

AppendRules appends rules from another stylesheet.

Interface cssom.StyleSheet

func (*CSSStyles) Empty

func (sheet *CSSStyles) Empty() bool

Empty checks if this stylesheet contains any rules.

Interface cssom.StyleSheet

func (*CSSStyles) Rules

func (sheet *CSSStyles) Rules() []cssom.Rule

Rules returns all the rules of a stylesheet.

Interface style.StyleSheet

type Rule

type Rule css.Rule

Rule is an adapter for interface cssom.Rule.

func (Rule) IsImportant

func (r Rule) IsImportant(key string) bool

IsImportant returns true if a style key is marked as important ("!").

func (Rule) Properties

func (r Rule) Properties() []string

Properties returns the property keys of a rule, e.g. "margin-top"

func (Rule) Selector

func (r Rule) Selector() string

Selector returns the prelude / selectors of the rule.

func (Rule) Value

func (r Rule) Value(key string) style.Property

Value returns the property values for given key with this rule, e.g. "15px"

Jump to

Keyboard shortcuts

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