From: Agnibho Mondal Date: Wed, 7 Feb 2018 06:58:03 +0000 (+0530) Subject: Relocated loop X-Git-Url: https://code.agnibho.com/repo?a=commitdiff_plain;h=2c4d8763b483cffeee4f408b4dcfb986546df4ad;p=statin.git Relocated loop --- diff --git a/statin b/statin index f067cd7..f8d4d16 100755 --- a/statin +++ b/statin @@ -66,40 +66,39 @@ def main(): if(not args.quiet): print("Contents copied to " + OUTPUT_DIR + "\n") - # Send file list for processing - process_file(filelist) + # Send each file for processing + for filename in filelist: + outfile = OUTPUT_DIR + path.splitext(path.basename(filename))[0] + ".html" + process_file(filename, outfile) -# Process each file in list -def process_file(filelist): +# Process the file +def process_file(filename, outfile): global args global openif, ifstatus, ifskip - #Loop over the filelist - for filename in filelist: - try: - varlist["DOCUMENT_URI"] = filename - varlist["DOCUMENT_NAME"] = path.basename(filename) - varlist["LAST_MODIFIED"] = datetime.fromtimestamp(path.getmtime(filename)).strftime(conflist["timefmt"]) - if(not args.quiet): - print("Processing " + filename) - outfile = OUTPUT_DIR + path.splitext(path.basename(filename))[0] + ".html" - with open(filename) as src, open(outfile, "w") as out: - for line in src: - line = re.split("()", line) - for item in line: - if(item.strip()): - if(item.strip()[:5] == ")", line) + for item in line: + if(item.strip()): + if(item.strip()[:5] == "