White list HTML filter
Project description
About
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 file
The filter is instanciated with a predefined set of rules. http://github.com/samueladam/htmlfilter/blob/master/htmlfilter/rules.py
You can create your own rules file:
# file: my_rules.py TAGS = { 'a': ('href', 'name',), 'p': ('class',), } # define filters on attributes data (tag_attr) def p_class(data): if data not in ('class1', 'class2',): data = '' return data
And use them this way:
from htmlfilter import HTMLFilter import my_rules hf = HTMLFilter(rules=my_rules) cleaned_html = hf.filter(dirty_html)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
htmlfilter-0.2.tar.gz
(3.1 kB
view details)
File details
Details for the file htmlfilter-0.2.tar.gz
.
File metadata
- Download URL: htmlfilter-0.2.tar.gz
- Upload date:
- Size: 3.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
7db96cd0a7177a8c6c9e1b492d5ea99c97d7e40b53e8aec1577a281085f6246d
|
|
MD5 |
1f30857c7a51ab65d5e72194f8976b6d
|
|
BLAKE2b-256 |
cbe36ffcdeb32db84999eb75cf0627f9ceff25e39b7dab0c7cd449f503b8220a
|