Lines Matching refs:markup
6 Implements a Markup string.
16 __all__ = ['Markup', 'soft_unicode', 'escape', 'escape_silent']
23 class Markup(text_type):
26 of frameworks and web applications use. :class:`Markup` is a direct
28 it escapes arguments passed and always returns `Markup`.
30 The `escape` function returns markup objects so that double escaping can't
33 The constructor of the :class:`Markup` class can be used for three
39 >>> Markup("Hello <em>World</em>!")
40 Markup(u'Hello <em>World</em>!')
45 >>> Markup(Foo())
46 Markup(u'<a href="#">foo</a>')
49 :meth:`escape` classmethod to create a :class:`Markup` object:
51 >>> Markup.escape("Hello <em>World</em>!")
52 Markup(u'Hello <em>World</em>!')
54 Operations on a markup string are markup aware which means that all
57 >>> em = Markup("<em>%s</em>")
59 Markup(u'<em>foo & bar</em>')
60 >>> strong = Markup("<strong>%(text)s</strong>")
62 Markup(u'<strong><blink>hacker here</blink></strong>')
63 >>> Markup("<em>Hello</em> ") + "<foo>"
64 Markup(u'<em>Hello</em> <foo>')
80 return self.__class__(super(Markup, self).__add__(self.escape(other)))
124 r"""Unescape markup again into an text_type string. This also resolves
127 >>> Markup("Main » <em>About</em>").unescape()
146 r"""Unescape markup into an text_type string and strip all tags. This
150 >>> Markup("Main » <em>About</em>").striptags()
154 return Markup(stripped).unescape()
159 that for subclasses of :class:`Markup` this function would return the
212 """Helper for Markup.__mod__"""
226 # modules imports the markup type which is define above.