| Trees | Indices | Help |
|
|---|
|
|
| Classes | |
|
TracHTMLSanitizer Sanitize HTML constructions which are potentially vector of phishing or XSS attacks, in user-supplied HTML. |
|
|
Deuglifier Help base class used for cleaning up HTML riddled with <FONT COLOR=...> tags and replace them with appropriate <span class="...">. |
|
|
FormTokenInjector Identify and protect forms from CSRF attacks. |
|
| Functions | |||
| Markup |
|
||
unicode
|
|
||
unicode
|
|
||
unicode
|
|
||
|
|||
|
|||
|
|||
|
|||
|
|||
| Variables | |
html = ElementFactory()
|
|
tag = ElementFactory()
|
|
| Function Details |
Create a Markup instance from a string and escape special characters it may contain (<, >, & and "). >>> escape('"1 < 2"') Markup(u'"1 < 2"') >>> escape(['"1 < 2"']) Markup(u"['"1 < 2"']") If the >>> escape('"1 < 2"', quotes=False) Markup(u'"1 < 2"') >>> escape(['"1 < 2"'], quotes=False) Markup(u'[\'"1 < 2"\']') However, escape behaves slightly differently with Markup and Fragment behave instances, as they are passed through unmodified. >>> escape(Markup('"1 < 2 '"')) Markup(u'"1 < 2 '"') >>> escape(Markup('"1 < 2 '"'), quotes=False) Markup(u'"1 < 2 '"') >>> escape(tag.b('"1 < 2"')) Markup(u'<b>"1 < 2"</b>') >>> escape(tag.b('"1 < 2"'), quotes=False) Markup(u'<b>"1 < 2"</b>')
|
Reverse-escapes &, <, >, and " and returns a >>> unescape(Markup('1 < 2')) u'1 < 2' If the provided text object is not a Markup instance, it is returned unchanged. >>> unescape('1 < 2') '1 < 2'
|
Return a copy of the given text with any character or numeric entities replaced by the equivalent UTF-8 characters. >>> stripentities('1 < 2') u'1 < 2' >>> stripentities('more …') u'more \u2026' >>> stripentities('…') u'\u2026' >>> stripentities('…') u'\u2026' >>> stripentities(Markup(u'\u2026')) u'\u2026' If the >>> stripentities('1 < 2 …', keepxmlentities=True) u'1 < 2 \u2026'
|
Return a copy of the text with any XML/HTML tags removed. >>> striptags('<span>Foo</span> bar') u'Foo bar' >>> striptags('<span class="bar">Foo</span>') u'Foo' >>> striptags('Foo<br />') u'Foo' HTML/XML comments are stripped, too: >>> striptags('<!-- <blub>hehe</blah> -->test') u'test'
|
Extract the text elements from (X)HTML content >>> plaintext('<b>1 < 2</b>') u'1 < 2' >>> plaintext(tag('1 ', tag.b('<'), ' 2')) u'1 < 2' >>> plaintext('''<b>1 ... < ... 2</b>''', keeplinebreaks=False) u'1 < 2'
|
| Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Fri Aug 11 08:14:28 2023 | http://epydoc.sourceforge.net |