This commit is contained in:
sg
2025-06-10 11:37:57 +03:00
parent 45d12ab97d
commit 26c4b9c1e1
2 changed files with 22 additions and 28 deletions

View File

@@ -8,11 +8,10 @@ from logger import logger
def create_content(filename):
filename = Path(f"{Config.CONTENT_DIR}/{filename}.md")
if not filename.exists():
fh = DefaultFrontmatterHeader(filename.stem)
logger.debug(f"Creating new content {filename}")
with filename.open("w", encoding="utf-8") as f:
f.writelines(['---\n', fh.title, fh.date, fh.description, fh.author, fh.omit_second_title, '---\n', '\n', '\n'])
new_content_item = ContentItem(filename)
new_content_item.create_content()
def edit_content(filename):
logger.debug(f"Editing content {filename}")
editor = os.environ.get('EDITOR', 'vim')