A cleanup tool for HTML.
Removes unwanted tags and content. See the Cleaner
class for
details.
Class | Cleaner |
Instances cleans the document of each of the possible offending elements. The cleaning is controlled by attributes; you can override attributes in a subclass, or set them in the constructor. |
Function | autolink |
Turn any URLs into links. |
Function | autolink_html |
Undocumented |
Function | word_break |
Breaks any long words found in the body of the text (not attributes). |
Function | word_break_html |
Undocumented |
Variable | basestring |
Undocumented |
Variable | clean |
Undocumented |
Function | _break_text |
Undocumented |
Function | _has_javascript_scheme |
Undocumented |
Function | _insert_break |
Undocumented |
Function | _link_text |
Undocumented |
Variable | _avoid_classes |
Undocumented |
Variable | _avoid_elements |
Undocumented |
Variable | _avoid_hosts |
Undocumented |
Variable | _avoid_word_break_classes |
Undocumented |
Variable | _avoid_word_break_elements |
Undocumented |
Variable | _break_prefer_re |
Undocumented |
Variable | _conditional_comment_re |
Undocumented |
Variable | _find_external_links |
Undocumented |
Variable | _find_image_dataurls |
Undocumented |
Variable | _find_styled_elements |
Undocumented |
Variable | _is_unsafe_image_type |
Undocumented |
Variable | _link_regexes |
Undocumented |
Variable | _looks_like_tag_content |
Undocumented |
Variable | _possibly_malicious_schemes |
Undocumented |
Variable | _replace_css_import |
Undocumented |
Variable | _replace_css_javascript |
Undocumented |
Variable | _substitute_whitespace |
Undocumented |
Turn any URLs into links.
It will search for links identified by the given regular expressions (by default mailto and http(s) links).
It won't link text in an element in avoid_elements, or an element with a class in avoid_classes. It won't link to anything with a host that matches one of the regular expressions in avoid_hosts (default localhost and 127.0.0.1).
If you pass in an element, the element's tail will not be substituted, only the contents of the element.
Breaks any long words found in the body of the text (not attributes).
Doesn't effect any of the tags in avoid_elements, by default <textarea> and <pre>
Breaks words by inserting ​, which is a unicode character for Zero Width Space character. This generally takes up no space in rendering, but does copy as a space, and in monospace contexts usually takes up space.
See http://www.cs.tut.fi/~jkorpela/html/nobr.html for a discussion