Home | Trees | Indices | Help |
|
---|
|
A cleanup tool for HTML.
Removes unwanted tags and content. See the Cleaner class for details.
|
|||
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. |
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|
|||
_css_javascript_re = re.compile(r'
|
|||
_css_import_re = re.compile(r'
|
|||
_javascript_scheme_re = re.compile(r'
|
|||
_conditional_comment_re = re.compile(r'
|
|||
_find_styled_elements = descendant-or-self::*[@style]
|
|||
_find_external_links = descendant-or-self::a [normalize-space
|
|||
clean = Cleaner()
|
|||
_link_regexes =
|
|||
_avoid_elements =
|
|||
_avoid_hosts =
|
|||
_avoid_classes =
|
|||
_avoid_word_break_elements =
|
|||
_avoid_word_break_classes =
|
|||
_break_prefer_re = re.compile(r'
|
|||
__package__ =
|
|
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. |
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 |
|
_javascript_scheme_re
|
_conditional_comment_re
|
_find_external_links
|
_link_regexes
|
_avoid_elements
|
_avoid_hosts
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sun Feb 6 20:30:21 2011 | http://epydoc.sourceforge.net |