aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2012-12-30 21:48:06 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2012-12-30 21:48:06 +0100
commitff66a20a0c9c0932f725c10fbb136ab5c6f95e9e (patch)
treeae82dc1e3fee55e2a21c143a56318a8b0254fd71
parentRemoved strip_accents function. (diff)
downloadnewspipe-ff66a20a0c9c0932f725c10fbb136ab5c6f95e9e.tar.gz
newspipe-ff66a20a0c9c0932f725c10fbb136ab5c6f95e9e.tar.bz2
newspipe-ff66a20a0c9c0932f725c10fbb136ab5c6f95e9e.zip
Removed unescape function.
-rwxr-xr-xsource/utils.py24
1 files changed, 0 insertions, 24 deletions
diff --git a/source/utils.py b/source/utils.py
index b37ecb8b..a985694b 100755
--- a/source/utils.py
+++ b/source/utils.py
@@ -92,30 +92,6 @@ def clear_string(data):
q = re.compile(b'\s') # consecutive white spaces
return p.sub(b'', q.sub(b' ', bytes(data, "utf-8"))).decode("utf-8", "strict")
-def unescape(text):
- """
- Removes HTML or XML character references and entities from a text string.
- """
- def fixup(m):
- text = m.group(0)
- if text[:2] == "&#":
- # character reference
- try:
- if text[:3] == "&#x":
- return chr(int(text[3:-1], 16))
- else:
- return chr(int(text[2:-1]))
- except ValueError:
- pass
- else:
- # named entity
- try:
- text = chr(html.entities.name2codepoint[text[1:-1]])
- except KeyError:
- pass
- return text # leave as is
- return re.sub("&#?\w+;", fixup, text)
-
def normalize_filename(name):
"""
Normalize a file name.
bgstack15