This commit is contained in:
SG
2025-06-17 16:22:47 +03:00
parent 4ea54eaa91
commit 326e5c5edd
7 changed files with 77 additions and 51 deletions

View File

@@ -1,11 +1,11 @@
import os, subprocess
from pathlib import Path
from classes import *
from config import Config
from config import config
from logger import logger
def create_content(filename):
filename = Path(f"{Config.CONTENT_DIR}/{filename}.md")
filename = Path(f"{config.content_dir}/{filename}.md")
if not filename.exists():
logger.debug(f"Creating new content {filename}")
new_content_item = ContentItem(filename)
@@ -15,9 +15,9 @@ 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():
if not Path(f"{config.content_dir}/{filename}.md").exists():
create_content(filename)
filename = Path(f"{Config.CONTENT_DIR}/{filename}.md")
filename = Path(f"{config.content_dir}/{filename}.md")
subprocess.call([editor, filename])
def init_site():