From 78d81e2c5e1e00796ac74fea445d0b664e97d351 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 20 Aug 2015 16:54:50 +0200 Subject: Replace strip_html function in prolog.engine --- prolog/engine.py | 6 +++--- 1 file 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']*>', '', 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 -- cgit v1.2.1