This commit is contained in:
Simon Ser 2020-01-20 20:27:49 +01:00
parent 589b303f9f
commit d19c17c6d5
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48

View file

@ -6,65 +6,65 @@ import (
"regexp" "regexp"
"strings" "strings"
"golang.org/x/net/html"
"github.com/microcosm-cc/bluemonday"
"github.com/aymerick/douceur/css" "github.com/aymerick/douceur/css"
cssparser "github.com/chris-ramon/douceur/parser" cssparser "github.com/chris-ramon/douceur/parser"
"github.com/microcosm-cc/bluemonday"
"golang.org/x/net/html"
) )
// TODO: this doesn't accomodate for quoting // TODO: this doesn't accomodate for quoting
var ( var (
cssURLRegexp = regexp.MustCompile(`url\([^)]*\)`) cssURLRegexp = regexp.MustCompile(`url\([^)]*\)`)
cssExprRegexp = regexp.MustCompile(`expression\([^)]*\)`) cssExprRegexp = regexp.MustCompile(`expression\([^)]*\)`)
) )
var allowedStyles = map[string]bool{ var allowedStyles = map[string]bool{
"direction": true, "direction": true,
"font": true, "font": true,
"font-family": true, "font-family": true,
"font-style": true, "font-style": true,
"font-variant": true, "font-variant": true,
"font-size": true, "font-size": true,
"font-weight": true, "font-weight": true,
"letter-spacing": true, "letter-spacing": true,
"line-height": true, "line-height": true,
"text-align": true, "text-align": true,
"text-decoration": true, "text-decoration": true,
"text-indent": true, "text-indent": true,
"text-overflow": true, "text-overflow": true,
"text-shadow": true, "text-shadow": true,
"text-transform": true, "text-transform": true,
"white-space": true, "white-space": true,
"word-spacing": true, "word-spacing": true,
"word-wrap": true, "word-wrap": true,
"vertical-align": true, "vertical-align": true,
"color": true, "color": true,
"background": true, "background": true,
"background-color": true, "background-color": true,
"background-image": true, "background-image": true,
"background-repeat": true, "background-repeat": true,
"border": true, "border": true,
"border-color": true, "border-color": true,
"border-radius": true, "border-radius": true,
"height": true, "height": true,
"margin": true, "margin": true,
"padding": true, "padding": true,
"width": true, "width": true,
"max-width": true, "max-width": true,
"min-width": true, "min-width": true,
"clear": true, "clear": true,
"float": true, "float": true,
"border-collapse": true, "border-collapse": true,
"border-spacing": true, "border-spacing": true,
"caption-side": true, "caption-side": true,
"empty-cells": true, "empty-cells": true,
"table-layout": true, "table-layout": true,
"list-style-type": true, "list-style-type": true,
"list-style-position": true, "list-style-position": true,
} }