Skip to content

Commit

Permalink
fix: add code to remove trailing newlines in make_docs.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jayanthkoushik committed Jun 12, 2024
1 parent 2c3db3c commit 60f7f86
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/pyseed.py
Original file line number Diff line number Diff line change
Expand Up @@ -1703,11 +1703,13 @@ def main():
print(f"+ {shlex.join(build_cmd)}", file=sys.stderr)
subprocess.run(build_cmd, check=True, text=True)
# Remove tralining spaces and newlines from the generated files.
for fname in docs_dir.glob("**/*.md"):
with open(fname, "r") as f:
fdata = f.read()
fdata_fixed = re.sub(r" *(?=\\n|$)", "", fdata)
fdata_fixed = re.sub(r" *(?=$)", "", fdata, flags=re.MULTILINE)
fdata_fixed = re.sub("\\n+(?=$)", "", fdata_fixed)
if fdata_fixed != fdata:
with open(fname, "w") as f:
print(fdata_fixed, file=f)
Expand Down

0 comments on commit 60f7f86

Please sign in to comment.