aboutsummaryrefslogtreecommitdiffstats
path: root/parser.py
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2023-03-21 14:11:05 +0000
committerjwansek <eddie.atten.ea29@gmail.com>2023-03-21 14:11:05 +0000
commit7c7082fbc6bbaeb48aded3e2a598130a1c0b343f (patch)
tree4ed03ccb37055cdbcc6fc2fc4ec907f66ca143a9 /parser.py
parentc9c6db89a10e331d3df9f1a60b5c3ea89b1e7c59 (diff)
downloadboymoder.blog-7c7082fbc6bbaeb48aded3e2a598130a1c0b343f.tar.gz
boymoder.blog-7c7082fbc6bbaeb48aded3e2a598130a1c0b343f.zip
Added redirecting blog posts
Diffstat (limited to 'parser.py')
-rwxr-xr-xparser.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/parser.py b/parser.py
index ed4e04c..a851846 100755
--- a/parser.py
+++ b/parser.py
@@ -51,9 +51,9 @@ class EdawebRenderer(mistune.HTMLRenderer):
)
def get_thought_from_id(db, id_):
- category_name, title, dt, markdown = db.get_thought(id_)
+ category_name, title, dt, markdown, redirect = db.get_thought(id_)
html, headers = parse_text(markdown)
- return category_name, title, dt, html, headers
+ return category_name, title, dt, html, headers, redirect
def parse_file(path):
with open(path, "r") as f:
@@ -67,6 +67,8 @@ def parse_text(unformatted):
plugins = ["strikethrough", "table", "url", "task_lists", "def_list"]
)
html = md(unformatted)
+ if html == "":
+ return "", ""
return html, get_headers(html)
@@ -180,7 +182,7 @@ def main():
elif verb == "export":
with open(args["out"], "w") as f:
- f.writelines(db.get_thought(args["id"])[-1])
+ f.writelines(db.get_thought(args["id"])[-2])
print("Written to %s" % args["out"])
elif verb == "update":