diff options
author | Timotej Lazar <timotej.lazar@araneo.org> | 2015-08-20 16:54:50 +0200 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@araneo.org> | 2015-08-20 16:54:50 +0200 |
commit | 78d81e2c5e1e00796ac74fea445d0b664e97d351 (patch) | |
tree | 2f8335fc1b650d1335737088875f2c1af5e3a14c | |
parent | a21b35619e5b42881b4461ab0a87a0fca95e4440 (diff) |
Replace strip_html function in prolog.engine
-rw-r--r-- | prolog/engine.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/prolog/engine.py b/prolog/engine.py index c0fd58c..f6ce103 100644 --- a/prolog/engine.py +++ b/prolog/engine.py @@ -1,14 +1,14 @@ #!/usr/bin/python3 import collections +import html import http.client import json import re import urllib -import xml.etree.ElementTree -def strip_html(html_str): - return ''.join(xml.etree.ElementTree.fromstring(html_str).itertext()) +def strip_html(text): + return html.unescape(re.sub(r'</?[a-z]+[^>]*>', '', text)) # Create a new pengine, initialize it with [code] and return Prolog's reply. # The engine is destroyed after answering one query. If [query] is given, the |