This commit is contained in:
2025-10-09 20:46:21 +01:00
parent 700ebe9f5b
commit 8f90159eda
8 changed files with 406 additions and 160 deletions

View File

@@ -18,6 +18,7 @@ class Website:
self.tags = []
self.all_images = []
self.about_meta, self.about_content, self.about_modified_time = self.fetch_page('content', 'about.md')
self.cv_meta, self.cv_content, self.cv_modified_time = self.fetch_page('content', 'cv.md')
def build(self):
self.fetch_pages()
@@ -27,6 +28,7 @@ class Website:
self.create_list()
self.build_about()
self.build_campfire()
self.build_cv()
self.fetch_all_images()
self.create_json('public/json/articles.json')
@@ -74,6 +76,7 @@ class Website:
def fetch_page(self, dir, page):
for about in os.listdir(dir):
if about == page:
print(page)
with open(os.path.join(dir, about), 'r', encoding='utf8') as f:
content = f.read()
parts = content.split('---')
@@ -117,6 +120,14 @@ class Website:
content=None
)
def build_cv(self):
template = self.env.get_template('cv.html')
html_output = template.render(
content=self.cv_content
)
with open(os.path.join('public', 'cv.html'), 'w', encoding='utf8') as output_file:
output_file.write(html_output)
def format_content(self, content):
# convert all (link)(src) to <a> tags
content = re.sub(r'\(([^)]+)\)\[([^\]]+)\]', r'<a href="\2" target="_blank">\1</a>', content)