# # postprocess.py # # extract useful javascript from the output of google web toolkit compiler # run using the sso linker # # extract a section from the -nocache.js file (passed on stdin) # and send to stdout. The extracted section is standalone javascript that # can be included directly into web pages. # # import sys mod_name = sys.argv[1] startmarker = mod_name + "()" lines = sys.stdin.readlines()[:-1] started = False nr = 0 while nr < len(lines): if started: print lines[nr].strip("\n") elif lines[nr].startswith(startmarker): started = True nr += 1 if nr < len(lines) and lines[nr].startswith("(function () {"): print lines[nr][14:].strip() nr += 1