inliner

package
v0.0.0-...-fa3d426 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	INLINE_FAKE_SELECTOR = "*INLINE*"

	// Regular expressions borrowed from premailer:
	//   https://github.com/premailer/css_parser/blob/master/lib/css_parser/regexps.rb
	NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_REGEXP = `` /* 258-byte string literal not displayed */
	ELEMENTS_AND_PSEUDO_ELEMENTS_REGEXP         = `(?i)((^|[\s\+\>\~]+)[\w]+|\:{1,2}(after|before|first-letter|first-line|selection))`
)
View Source
const (
	ELT_MARKER_ATTR = "douceur-mark"
)

Variables

This section is empty.

Functions

func ComputeSpecificity

func ComputeSpecificity(selector string) int

Computes style rule specificity

cf. http://www.w3.org/TR/selectors/#specificity

func Inlinable

func Inlinable(selector string) bool

Returns true if given selector is inlinable

func Inline

func Inline(html string) (string, error)

Inlines css into html document

Types

type Element

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

An HTML element with matching CSS rules

func NewElement

func NewElement(elt *goquery.Selection) *Element

Instanciate a new element

type ElementAttr

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

type Inliner

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

CSS Inliner

func NewInliner

func NewInliner(html string) *Inliner

Instanciate a new Inliner

func (*Inliner) Inline

func (inliner *Inliner) Inline() (string, error)

Inlines CSS and returns HTML

type StyleDeclaration

type StyleDeclaration struct {
	StyleRule   *StyleRule
	Declaration *css.Declaration
}

func NewStyleDeclaration

func NewStyleDeclaration(styleRule *StyleRule, declaration *css.Declaration) *StyleDeclaration

func (*StyleDeclaration) Specificity

func (styleDecl *StyleDeclaration) Specificity() int

Computes style declaration specificity

type StyleRule

type StyleRule struct {
	// The style rule selector
	Selector string

	// The style rule properties
	Declarations []*css.Declaration

	// Selector specificity
	Specificity int
}

A Qualifier Rule for a uniq selector

func NewStyleRule

func NewStyleRule(selector string, declarations []*css.Declaration) *StyleRule

Instanciate a new StyleRule

func (*StyleRule) String

func (styleRule *StyleRule) String() string

Returns the string representation of a style rule

Jump to

Keyboard shortcuts

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