[Reproducible-commits] [debbindiff] 02/03: Better handle non-printable characters in HTML presenter
Jérémy Bobbio
lunar at moszumanska.debian.org
Sat Mar 28 17:04:47 UTC 2015
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch master
in repository debbindiff.
commit 1054dff31e3835466362724d4e4afa3b69d72ffd
Author: Jérémy Bobbio <lunar at debian.org>
Date: Sat Mar 28 18:04:10 2015 +0100
Better handle non-printable characters in HTML presenter
---
debbindiff/presenters/html.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/debbindiff/presenters/html.py b/debbindiff/presenters/html.py
index d3a7241..f9a6cac 100644
--- a/debbindiff/presenters/html.py
+++ b/debbindiff/presenters/html.py
@@ -33,7 +33,7 @@
from __future__ import print_function
import os.path
-import htmlentitydefs
+import cgi
import re
import subprocess
import sys
@@ -263,10 +263,10 @@ def convert(s, ponct=0):
elif c == DIFFOFF:
t += u"</span>"
- # special html chars
- elif htmlentitydefs.codepoint2name.has_key(ord(c)):
- t += u"&%s;" % (htmlentitydefs.codepoint2name[ord(c)])
- i += 1
+ elif ord(c) < 32:
+ conv = u"\\x%x" % ord(c)
+ t += u"<em>%s</em>" % conv
+ i += len(conv)
# special highlighted chars
elif c == "\t" and ponct == 1:
@@ -279,7 +279,7 @@ def convert(s, ponct=0):
elif c == "\n" and ponct == 1:
t += u'<br/><span class="diffponct">\</span>'
else:
- t += c
+ t += cgi.escape(c)
i += 1
if WORDBREAK.count(c) == 1:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/debbindiff.git
More information about the Reproducible-commits
mailing list