content update
This commit is contained in:
4
build.py
4
build.py
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user