Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Css Styling for element attributes #83

Merged
merged 4 commits into from
Jul 15, 2019

Conversation

StevenGutzwiller
Copy link
Contributor

Let me know if anything needs adjusting or if you have any questions about this, I'll try to respond quickly.

pauln and others added 4 commits July 11, 2019 17:54
Style policies allow inline styles ("style" attributes on HTML elements) to be processed, either using regular expressions or matching against a list of allowed values (enum).
Adds a test for AllowStyles which covers Matching, MatchingEnum, OnElements and Globally.
This change adds in default handlers and functionality to add handlers
to specific styles. Building on top of Nicholls changes, this allows
for setting allowed styles as an attribute of either individual
elements or globally and validating using either a regular expression,
matching against a list of values, or with a supplied handler. If
none of these are supplied, it relies on a default handler for each
element. Please note this change does not allow for style elements,
or for external styule sheets.
@StevenGutzwiller
Copy link
Contributor Author

Attempted fix to #43

@@ -228,7 +232,7 @@ func (p *Policy) sanitize(r io.Reader) *bytes.Buffer {
case html.TextToken:

if !skipElementContent {
switch mostRecentlyStartedToken {
switch strings.ToLower(mostRecentlyStartedToken) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch

@buro9 buro9 merged commit 3fdf438 into microcosm-cc:master Jul 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants