mirror of https://gitlab.com/bashrc2/epicyon
Return of teh headers
parent
9ced39ef81
commit
9e2581f141
20
blog.py
20
blog.py
|
|
@ -202,15 +202,15 @@ def html_blog_post_markdown(content: str) -> str:
|
||||||
"""Converts any markdown to html
|
"""Converts any markdown to html
|
||||||
"""
|
"""
|
||||||
replacements = {
|
replacements = {
|
||||||
"># ": "h1",
|
"># ": "h3",
|
||||||
">## ": "h2",
|
">## ": "h4",
|
||||||
">### ": "h3",
|
">### ": "h5",
|
||||||
">#### ": "h4",
|
">#### ": "h6",
|
||||||
">##### ": "h5",
|
">##### ": "h7",
|
||||||
">###### ": "h6"
|
">###### ": "h8"
|
||||||
}
|
}
|
||||||
new_content = content
|
new_content = content
|
||||||
for markdown_text, _ in replacements.items():
|
for markdown_text, html_header in replacements.items():
|
||||||
if markdown_text not in new_content:
|
if markdown_text not in new_content:
|
||||||
continue
|
continue
|
||||||
sections = new_content.split(markdown_text)
|
sections = new_content.split(markdown_text)
|
||||||
|
|
@ -222,9 +222,11 @@ def html_blog_post_markdown(content: str) -> str:
|
||||||
ctr += 1
|
ctr += 1
|
||||||
continue
|
continue
|
||||||
if '<' in section:
|
if '<' in section:
|
||||||
section = '><s>' + section.replace('<', '</s><', 1)
|
section = '><' + html_header + '>' + \
|
||||||
|
section.replace('<', '</' + html_header + '><', 1)
|
||||||
elif '\n' in section:
|
elif '\n' in section:
|
||||||
section = '><s>' + section.replace('\n', '</s>\n', 1)
|
section = '><' + html_header + '>' + \
|
||||||
|
section.replace('\n', '</' + html_header + '>\n', 1)
|
||||||
else:
|
else:
|
||||||
section = markdown_text + section
|
section = markdown_text + section
|
||||||
new_content2 += section
|
new_content2 += section
|
||||||
|
|
|
||||||
|
|
@ -3118,14 +3118,14 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
# remove any tabs
|
# remove any tabs
|
||||||
content_str = \
|
content_str = \
|
||||||
content_str.replace('\t', '').replace('\r', '')
|
content_str.replace('\t', '').replace('\r', '')
|
||||||
# replace any markdown with html
|
|
||||||
content_str = html_blog_post_markdown(content_str)
|
|
||||||
# Add bold text
|
# Add bold text
|
||||||
if bold_reading and \
|
if bold_reading and \
|
||||||
not post_is_blog:
|
not post_is_blog:
|
||||||
content_str = bold_reading_string(content_str)
|
content_str = bold_reading_string(content_str)
|
||||||
|
|
||||||
object_content = remove_header_tags(content_str)
|
object_content = remove_header_tags(content_str)
|
||||||
|
# replace any markdown with html
|
||||||
|
content_str = html_blog_post_markdown(content_str)
|
||||||
object_content = \
|
object_content = \
|
||||||
remove_link_trackers_from_content(object_content)
|
remove_link_trackers_from_content(object_content)
|
||||||
object_content = \
|
object_content = \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue