diff --git a/cook.py b/cook.py index 33eddea..ae4b50e 100644 --- a/cook.py +++ b/cook.py @@ -23,8 +23,8 @@ def progressbar(it, prefix="", size=60, out=sys.stdout): # Python3.6+ print(f"{prefix}[{u'█'*x}{('.'*(size-x))}] {j}/{count} (Currently working on: {item}){' '*spacesToPrint}", end='\r', file=out, flush=True) lastItemLength = len(item) for i, item in enumerate(it): - yield item show(i+1, item) + yield item print(f"{prefix}[{u'█'*size}] {count}/{count} {' '*lastItemLength}", end='\r', file=out, flush=True) print("\n", flush=True, file=out) @@ -75,9 +75,8 @@ for file in progressbar(files_to_work_on, "", 40): continue source_match = re.search(f"", source.read()) if source_match: - source_match_fixed = re.sub('[\.\s ]*(.*?)<\/p>', rf'\2

', source_match.group()) - source_match_fixed = re.sub('

', r'

', source_match_fixed) - fixed_text = re.sub(f'', fr'', text) + source_match_fixed = re.sub('[\.\s ]*(.*?)<\/p>', rf'

\1

', source_match.group()) + fixed_text = re.sub(f'', fr'', text) text = re.sub(f"\n\s*", f"\n{source_match_fixed}\n", fixed_text) with open(f"work/{file}", 'w') as output: output.write(text)