diff --git a/ui/server.py b/ui/server.py index 8d51acf59236439e17d718b333be7c059f14f0a3..624383c23e523f5a535813568cd26e003c0e663b 100755 --- a/ui/server.py +++ b/ui/server.py @@ -443,8 +443,9 @@ def utility_processor(): def syntaxHighlight(data): def json2html(match): #print "MATCH",match - print " K",match.group(1), K = match.group(1) + print " K '" + K + "'", + cls = 'jsonnumber' if K[0] == '"': @@ -452,16 +453,19 @@ def utility_processor(): cls = 'jsonkey' else: cls = 'jsonstring' + elif K in ('true', 'false'): cls = 'jsonboolean' + elif K == 'null': cls = 'jsonnull' + print " CLS",cls return '<span class="%s">%s</span>' % (cls, K) json = jsonpickle.encode(data) json.replace('&', '&').replace('<', '<').replace('>', '>'); - rep = '("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|(?:\s+)(true|false|null)|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)' + rep = '("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|(?:\b|\s)(true|false|null)|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)' repc = re.compile(rep) jsonRes = repc.sub(json2html, json) #print json