This commit is contained in:
SG
2025-06-08 20:18:18 +03:00
parent 09621b73c3
commit 3348df26e5
3 changed files with 23 additions and 14 deletions

View File

@@ -6,8 +6,7 @@ from config import Config
from logger import logger
def create_content(filename):
filename += '.md'
filename = Path(f"{Config.CONTENT_DIR}/{filename}")
filename = Path(f"{Config.CONTENT_DIR}/{filename}.md")
if not filename.exists():
fh = DefaultFrontmatterHeader(filename.stem)
logger.debug(f"Creating new content {filename}")
@@ -17,6 +16,10 @@ def create_content(filename):
def edit_content(filename):
logger.debug(f"Editing content {filename}")
editor = os.environ.get('EDITOR', 'vim')
# Create the content file if not exists
if not Path(f"{Config.CONTENT_DIR}/{filename}.md").exists():
create_content(filename)
filename = Path(f"{Config.CONTENT_DIR}/{filename}.md")
subprocess.call([editor, filename])
def init_site():