htmlfilter

White list HTML filter
Download

htmlfilter Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Price:
  • FREE
  • Publisher Name:
  • Samuel Adam
  • Publisher web site:
  • http://github.com/samueladam/

htmlfilter Tags


htmlfilter Description

White list HTML filter htmlfilter is a very simple white list HTML filter.Use it with a WYSIWYG editor on the client side.Usage::: from htmlfilter import HTMLFilter hf = HTMLFilter() cleaned_html = hf.filter(dirty_html)Rules fileThe filter is instanciated with a predefined set of rules. http://github.com/samueladam/htmlfilter/blob/master/htmlfilter/rules.pyYou can create your own rules file:# file: my_rules.pyTAGS = { 'a': ('href', 'name',), 'p': ('class',),}# define filters on attributes data (tag_attr)def p_class(data): if data not in ('class1', 'class2',): data = '' return dataAnd use them this way:from htmlfilter import HTMLFilterimport my_ruleshf = HTMLFilter(rules=my_rules)cleaned_html = hf.filter(dirty_html) Requirements: · Python


htmlfilter Related Software