Skip to content

Instantly share code, notes, and snippets.

@wyattdanger
Created March 5, 2010 23:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wyattdanger/323292 to your computer and use it in GitHub Desktop.
Save wyattdanger/323292 to your computer and use it in GitHub Desktop.
from re import sub
from django import template
register = template.Library()
@register.filter(name='cleanhtml')
def cleanhtml(value):
'''Removes inline styles from WYSIWYG-generated markup.'''
return sub('(\s?style\s?=\s?[\'\"].+[\'\"])', '', str(value))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment