Artifact 39f912b954cea2859005da86fe4e5884ed75ce9d:
- File scripts/cleanjs.py — part of check-in [5e6e1e2c0a] at 2011-11-20 05:28:20 on branch feature/web2py_auth — Upgraded to web2py 1.99.2 (user: spiffy, size: 410) [annotate] [blame] [check-ins using] [more...]
import re def cleanjs(text): text = re.sub('\s*}\s*','\n}\n',text) text = re.sub('\s*{\s*',' {\n',text) text = re.sub('\s*;\s*',';\n',text) text = re.sub('\s*,\s*',', ',text) text = re.sub('\s*(?P<a>[\+\-\*/\=]+)\s*',' \g<a> ',text) lines = text.split('\n') text='' indent=0 for line in lines: rline=line.strip() if rline: pass return text