package inliner
import "github.com/aymerick/douceur/inliner"
Index ¶
- Constants
- func ComputeSpecificity(selector string) int
- func Inlinable(selector string) bool
- func Inline(html string) (string, error)
- type Element
- type ElementAttr
- type Inliner
- type StyleDeclaration
- func NewStyleDeclaration(styleRule *StyleRule, declaration *css.Declaration) *StyleDeclaration
- func (styleDecl *StyleDeclaration) Specificity() int
- type StyleRule
Constants ¶
const ( INLINE_FAKE_SELECTOR = "*INLINE*" NON_ID_ATTRIBUTES_AND_PSEUDO_CLASSES_REGEXP = "" /* 260 byte string literal not displayed */ ELEMENTS_AND_PSEUDO_ELEMENTS_REGEXP = `(?i)((^|[\s\+\>\~]+)[\w]+|\:{1,2}(after|before|first-letter|first-line|selection))` )
const (
ELT_MARKER_ATTR = "douceur-mark"
)
Functions ¶
func ComputeSpecificity ¶
Computes style rule specificity
cf. http://www.w3.org/TR/selectors/#specificity
func Inlinable ¶
Returns true if given selector is inlinable
func Inline ¶
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 ¶
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 ¶
Instanciate a new Inliner
func (*Inliner) Inline ¶
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 ¶
Returns the string representation of a style rule
Source Files ¶
element.go inliner.go style_declaration.go style_rule.go
- Version
- v0.1.0
- Published
- Apr 15, 2015
- Platform
- windows/amd64
- Imports
- 9 packages
- Last checked
- 2 hours ago –
Tools for package owners.