Compare commits
3 Commits
13c72b8066
...
3c9c948fe2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3c9c948fe2 | ||
![]() |
73760341d9 | ||
![]() |
e4b6b80fdb |
@@ -56,12 +56,12 @@ class Blog:
|
||||
html_file.write(html_content)
|
||||
|
||||
def _copy_css(self):
|
||||
css_path = Path(self.conf.theme) / 'css'
|
||||
dest_path = Path(self.conf.outbox) / 'css'
|
||||
|
||||
css_path = Path(self.conf.theme) / "css"
|
||||
dest_path = Path(self.conf.outbox) / "css"
|
||||
|
||||
if not dest_path.exists():
|
||||
dest_path.mkdir()
|
||||
|
||||
for css_file in css_path.glob('*.css'):
|
||||
for css_file in css_path.glob("*.css"):
|
||||
dest_file = dest_path / css_file.name
|
||||
shutil.copy(css_file, dest_file)
|
||||
|
10
blog/page.py
10
blog/page.py
@@ -6,7 +6,7 @@ import textwrap
|
||||
import markdown
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
from datetime import date, datetime
|
||||
from datetime import date
|
||||
|
||||
# from bs4 import BeautifulSoup as bs
|
||||
|
||||
@@ -23,12 +23,12 @@ def new_page(title: str):
|
||||
---
|
||||
date: {today}
|
||||
title: {title}
|
||||
category:
|
||||
category:
|
||||
tags:
|
||||
-
|
||||
-
|
||||
---
|
||||
# {title}
|
||||
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
@@ -65,7 +65,7 @@ class Page:
|
||||
|
||||
# if name == date:
|
||||
# return datetime(self.meta['date'], "%Y-%m-%d")
|
||||
|
||||
|
||||
return self.meta[name]
|
||||
|
||||
def _extract_meta_and_markdown(self, content: str) -> list:
|
||||
|
@@ -1,6 +0,0 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def clean_output(path: Path):
|
||||
# TODO
|
||||
pass
|
8
main.py
8
main.py
@@ -5,12 +5,11 @@ import argparse
|
||||
from pathlib import Path
|
||||
from blog.page import new_page
|
||||
from blog.config import Config
|
||||
from blog.utils import clean_output
|
||||
from blog.blog import Blog
|
||||
|
||||
# from blog.blog import Blog
|
||||
|
||||
actions_list = ["new", "make", "clean"]
|
||||
actions_list = ["new", "make"]
|
||||
blog_dir = "./inbox/"
|
||||
|
||||
|
||||
@@ -57,7 +56,6 @@ def main():
|
||||
args = load_args()
|
||||
|
||||
if not Path(args["config"]).is_file():
|
||||
# TODO gérer le cas où le fichier n'existe pas. Le créer ? Prendre les valeurs par défaut ?
|
||||
print("Le fichier de configuration n'existe pas.")
|
||||
os._exit(1)
|
||||
|
||||
@@ -79,10 +77,6 @@ def main():
|
||||
|
||||
os._exit(0)
|
||||
|
||||
case "clean":
|
||||
clean_output(conf.inbox)
|
||||
os._exit(0)
|
||||
|
||||
case _:
|
||||
print("error")
|
||||
os._exit(1)
|
||||
|
Reference in New Issue
Block a user