PKG-INFO 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. Metadata-Version: 1.0
  2. Name: MarkupSafe
  3. Version: 0.9.3
  4. Summary: Implements a XML/HTML/XHTML Markup safe string for Python
  5. Home-page: http://dev.pocoo.org/
  6. Author: Armin Ronacher
  7. Author-email: armin.ronacher@active-4.com
  8. License: BSD
  9. Description: MarkupSafe
  10. ==========
  11. Implements a unicode subclass that supports HTML strings:
  12. >>> from markupsafe import Markup, escape
  13. >>> escape("<script>alert(document.cookie);</script>")
  14. Markup(u'&lt;script&gt;alert(document.cookie);&lt;/script&gt;')
  15. >>> tmpl = Markup("<em>%s</em>")
  16. >>> tmpl % "Peter > Lustig"
  17. Markup(u'<em>Peter &gt; Lustig</em>')
  18. If you want to make an object unicode that is not yet unicode
  19. but don't want to lose the taint information, you can use the
  20. `soft_unicode` function:
  21. >>> from markupsafe import soft_unicode
  22. >>> soft_unicode(42)
  23. u'42'
  24. >>> soft_unicode(Markup('foo'))
  25. Markup(u'foo')
  26. Objects can customize their HTML markup equivalent by overriding
  27. the `__html__` function:
  28. >>> class Foo(object):
  29. ... def __html__(self):
  30. ... return '<strong>Nice</strong>'
  31. ...
  32. >>> escape(Foo())
  33. Markup(u'<strong>Nice</strong>')
  34. >>> Markup(Foo())
  35. Markup(u'<strong>Nice</strong>')
  36. Platform: UNKNOWN
  37. Classifier: Development Status :: 5 - Production/Stable
  38. Classifier: Environment :: Web Environment
  39. Classifier: Intended Audience :: Developers
  40. Classifier: License :: OSI Approved :: BSD License
  41. Classifier: Operating System :: OS Independent
  42. Classifier: Programming Language :: Python
  43. Classifier: Programming Language :: Python :: 3
  44. Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
  45. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  46. Classifier: Topic :: Text Processing :: Markup :: HTML