#NEWLINE# def cleanjs( text ) : #NEWLINE# #INDENT# text = re . sub ( '\\s*}\\s*' , '\n}\n' , text ) #NEWLINE# text = re . sub ( '\\s*{\\s*' , ' {\n' , text ) #NEWLINE# text = re . sub ( '\\s*;\\s*' , ';\n' , text ) #NEWLINE# text = re . sub ( '\\s*,\\s*' , ', ' , text ) #NEWLINE# text = re . sub ( '\\s*(?P<a>[\\+\\-\\*/\\=]+)\\s*' , ' \\g<a> ' , line ) #NEWLINE# lines = text . split ( '\n' ) #NEWLINE# text = '' #NEWLINE# indent = 0 #NEWLINE# for line in lines : #NEWLINE# #INDENT# rline = line . strip ( ) #NEWLINE# if rline : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# return text