r"""Unescape markup again into an text_type string. This also resolves known HTML4 and XHTML entities: >>> Markup("Main » About ").unescape() u'Main \xbb About '
(self)
| 121 | splitlines.__doc__ = text_type.splitlines.__doc__ |
| 122 | |
| 123 | def unescape(self): |
| 124 | r"""Unescape markup again into an text_type string. This also resolves |
| 125 | known HTML4 and XHTML entities: |
| 126 | |
| 127 | >>> Markup("Main » <em>About</em>").unescape() |
| 128 | u'Main \xbb <em>About</em>' |
| 129 | """ |
| 130 | from markupsafe._constants import HTML_ENTITIES |
| 131 | def handle_match(m): |
| 132 | name = m.group(1) |
| 133 | if name in HTML_ENTITIES: |
| 134 | return unichr(HTML_ENTITIES[name]) |
| 135 | try: |
| 136 | if name[:2] in ('#x', '#X'): |
| 137 | return unichr(int(name[2:], 16)) |
| 138 | elif name.startswith('#'): |
| 139 | return unichr(int(name[1:])) |
| 140 | except ValueError: |
| 141 | pass |
| 142 | return u'' |
| 143 | return _entity_re.sub(handle_match, text_type(self)) |
| 144 | |
| 145 | def striptags(self): |
| 146 | r"""Unescape markup into an text_type string and strip all tags. This |
no outgoing calls
no test coverage detected