erick.is/_draft.py

11 lines
268 B
Python
Raw Normal View History

from slugify import slugify
import _utils
title = input("Enter draft's title: ")
slug = slugify(title)
fm = _utils.loads("---\n---\n")
fm.metadata["title"] = title
with open(f"_drafts/{slug}.gmi", mode="w", encoding="utf8") as file:
file.write(_utils.dumps(fm))