aboutsummaryrefslogtreecommitdiff
path: root/from_old_blog.py
diff options
context:
space:
mode:
authoralex <alex@pdp7.net>2022-03-12 20:20:54 +0100
committeralex <alex@pdp7.net>2022-03-12 20:20:54 +0100
commit5b16cf6dfd4ed949b67a2ca5091b19893854d68d (patch)
tree5bf06ea37ec53dafcbd187ce9d16bc7366b0d729 /from_old_blog.py
parent7bae3484971305b749886c472b6f75f10dddf28d (diff)
Fix newline issues
Diffstat (limited to 'from_old_blog.py')
-rw-r--r--from_old_blog.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/from_old_blog.py b/from_old_blog.py
index fc3d698f..8c137530 100644
--- a/from_old_blog.py
+++ b/from_old_blog.py
@@ -35,7 +35,7 @@ for post in posts:
post["post"] = post["post"].encode("iso-8859-1").decode("utf8")
post["title"] = post["title"].encode("iso-8859-1").decode("utf8")
- post["post"] = post["post"].replace("\\r\\n", "")
+ post["post"] = post["post"].replace("\\r\\n", " ")
t = post["title"]
@@ -47,4 +47,6 @@ for post in posts:
with open(p, "w") as f:
f.write(f"# {t}\n")
f.write(f"{y}-{m}-{d}\n\n")
- f.write(subprocess.run(["/home/alex/go/bin/html2gmi", "-mn"], input=post["post"].encode("utf8"), stdout=subprocess.PIPE).stdout.decode("utf8"))
+ gmi = subprocess.run(["/home/alex/go/bin/html2gmi", "-mn"], input=post["post"].encode("utf8"), stdout=subprocess.PIPE).stdout.decode("utf8")
+ gmi = "\n".join(map(str.rstrip, gmi.splitlines()))
+ f.write(gmi)