mirror of https://gitlab.com/bashrc2/epicyon
Extra check for missing code tags
parent
c90991b543
commit
d76f69d162
|
@ -25,6 +25,7 @@ from posts import post_is_muted
|
||||||
from posts import get_person_box
|
from posts import get_person_box
|
||||||
from posts import download_announce
|
from posts import download_announce
|
||||||
from posts import populate_replies_json
|
from posts import populate_replies_json
|
||||||
|
from utils import remove_markup_tag
|
||||||
from utils import ap_proxy_type
|
from utils import ap_proxy_type
|
||||||
from utils import remove_style_within_html
|
from utils import remove_style_within_html
|
||||||
from utils import license_link_from_name
|
from utils import license_link_from_name
|
||||||
|
@ -1955,6 +1956,18 @@ def _get_buy_footer(buy_links: {}, translate: {}) -> str:
|
||||||
return buy_str
|
return buy_str
|
||||||
|
|
||||||
|
|
||||||
|
def _remove_incomplete_code_tags(content: str) -> str:
|
||||||
|
"""Remove any uncompleted code tags
|
||||||
|
"""
|
||||||
|
tags = ('code', 'pre')
|
||||||
|
for tag_name in tags:
|
||||||
|
if '<' + tag_name not in content:
|
||||||
|
continue
|
||||||
|
if '</' + tag_name not in content:
|
||||||
|
content = remove_markup_tag(content, tag_name)
|
||||||
|
return content
|
||||||
|
|
||||||
|
|
||||||
def individual_post_as_html(signing_priv_key_pem: str,
|
def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
allow_downloads: bool,
|
allow_downloads: bool,
|
||||||
recent_posts_cache: {}, max_recent_posts: int,
|
recent_posts_cache: {}, max_recent_posts: int,
|
||||||
|
@ -2717,6 +2730,8 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
encrypted_str = translate[encrypted_str]
|
encrypted_str = translate[encrypted_str]
|
||||||
object_content = '🔒 ' + encrypted_str
|
object_content = '🔒 ' + encrypted_str
|
||||||
|
|
||||||
|
object_content = _remove_incomplete_code_tags(object_content)
|
||||||
|
|
||||||
object_content = \
|
object_content = \
|
||||||
'<article><span itemprop="articleBody">' + \
|
'<article><span itemprop="articleBody">' + \
|
||||||
object_content + '</span></article>'
|
object_content + '</span></article>'
|
||||||
|
|
Loading…
Reference in New Issue