Better than beautifier.js Decode strings un-minimize it use JSTools/JSFormat to un-minimize
import re import codecs ESCAPE_SEQUENCE_RE = re.compile(r''' ( \\U........ # 8-digit hex escapes | \\u.... # 4-digit hex escapes | \\x.. # 2-digit hex escapes | \\[0-7]{1,3} # Octal escapes | \\N\{[^}]+\} # Unicode characters by name | \\[\\'"abfnrtv] # Single-character escapes )''', re.UNICODE | re.VERBOSE) def decode_escapes(s): def decode_match(match): return codecs.decode(match.group(0), 'unicode-escape') return ESCAPE_SEQUENCE_RE.sub(decode_match, s) donnees = editor.getText() strings=re.finditer("(\".+\")",donnees) for s in strings: editor.replace(s.group(0)[1:-1],decode_escapes(s.group(0)[1:-1])) notepad.runMenuCommand("JSTool", "JSFormat")
Log in to post a comment.
Better than beautifier.js
Decode strings
un-minimize
it use JSTools/JSFormat to un-minimize