Files
Unified_Dashboard_Suite_Go/web/bulk-api-tester/static/js/parse_render.py
T

23 lines
669 B
Python

import re
with open('app.js', 'r') as f:
content = f.read()
for func in ['renderSidebar', 'renderMain', 'renderResponse']:
match = re.search(fr'{func}\(\)\s*\{{', content)
if match:
start = match.start()
brace_count = 0
started = False
for i in range(start, len(content)):
if content[i] == '{':
brace_count += 1
started = True
elif content[i] == '}':
brace_count -= 1
if started and brace_count == 0:
end = i + 1
break
with open(f'{func}.txt', 'w') as out:
out.write(content[start:end])