Skip to content
Snippets Groups Projects
Commit 8856942c authored by Aflitos, Saulo Alves's avatar Aflitos, Saulo Alves
Browse files

2012-10-23_19_05_01_02_00 :: 1 :: M => 1

parent b7b5d6fa
Branches
No related tags found
No related merge requests found
......@@ -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('&', '&amp;').replace('<', '&lt;').replace('>', '&gt;');
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment