content update

This commit is contained in:
2024-06-21 11:57:55 +01:00
parent 77fb75ef98
commit 8a260f35f9
51 changed files with 323 additions and 88 deletions

View File

@@ -75,7 +75,7 @@ class Website:
parts = content.split('---')
metadata = yaml.safe_load(parts[1])
md_content = ''.join(parts[2:])
md_content = re.sub(r'\(([^)]+)\)\[([^\]]+)\]', r'<a href="\2">\1</a>', md_content)
md_content = re.sub(r'\(([^)]+)\)\[([^\]]+)\]', r'<a href="\2" target="_blank">\1</a>', md_content)
html_content = markdown.markdown(md_content)
about_modified_time = time.ctime(os.fstat(f.fileno()).st_mtime)
return metadata, html_content, about_modified_time
@@ -109,7 +109,7 @@ class Website:
def format_content(self, content):
# convert all (link)(src) to <a> tags
content = re.sub(r'\(([^)]+)\)\[([^\]]+)\]', r'<a href="\2">\1</a>', content)
content = re.sub(r'\(([^)]+)\)\[([^\]]+)\]', r'<a href="\2" target="_blank">\1</a>', content)
# convert all video links to embedded code
return content