summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2014-12-08 03:09:21 +0100
committermathieui <mathieui@mathieui.net>2014-12-08 03:09:21 +0100
commit4b8749ca88ef5a7e525231893b813eb0d4b2f8c1 (patch)
tree2c9a35e710595df0032425a6ee5bbae728191db0 /src
parente1543545ad06687df13729bc73958154774ee5b2 (diff)
downloadpoezio-4b8749ca88ef5a7e525231893b813eb0d4b2f8c1.tar.gz
poezio-4b8749ca88ef5a7e525231893b813eb0d4b2f8c1.tar.bz2
poezio-4b8749ca88ef5a7e525231893b813eb0d4b2f8c1.tar.xz
poezio-4b8749ca88ef5a7e525231893b813eb0d4b2f8c1.zip
Sanitize the XHTML output by removing useless formatting chars
Diffstat (limited to 'src')
-rw-r--r--src/xhtml.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/xhtml.py b/src/xhtml.py
index 01e2dfcd..5b71823c 100644
--- a/src/xhtml.py
+++ b/src/xhtml.py
@@ -183,6 +183,7 @@ whitespace_re = re.compile(r'\s+')
xhtml_attr_re = re.compile(r'\x19-?\d[^}]*}|\x19[buaio]')
xhtml_data_re = re.compile(r'data:image/([a-z]+);base64,(.+)')
+poezio_colors_trim = re.compile(r'\x19o(\x19\d+}|\x19\d|\x19[buaio])*\x19o')
xhtml_simple_attr_re = re.compile(r'\x19\d')
@@ -303,7 +304,7 @@ class XHTMLHandler(sax.ContentHandler):
@property
def result(self):
- return ''.join(self.builder).strip()
+ return re.sub(poezio_colors_trim, '\x19o', ''.join(self.builder).strip())
def append_formatting(self, formatting):
self.formatting.append(formatting)