mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of gitlab.com:bashrc2/epicyon
commit
fb164c745b
|
@ -684,7 +684,8 @@ def _add_hash_tags(word_str: str, http_prefix: str, domain: str,
|
||||||
'type': 'Hashtag'
|
'type': 'Hashtag'
|
||||||
}
|
}
|
||||||
replace_hashtags[word_str] = "<a href=\"" + hashtag_url + \
|
replace_hashtags[word_str] = "<a href=\"" + hashtag_url + \
|
||||||
"\" class=\"mention hashtag\" rel=\"tag\" tabindex=\"10\">#<span>" + \
|
"\" class=\"mention hashtag\" rel=\"tag\" tabindex=\"10\">" + \
|
||||||
|
"<span aria-hidden=\"true\">#</span><span>" + \
|
||||||
hashtag + "</span></a>"
|
hashtag + "</span></a>"
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
10
daemon.py
10
daemon.py
|
@ -19133,13 +19133,17 @@ class PubServer(BaseHTTPRequestHandler):
|
||||||
not fields.get('pinToProfile'):
|
not fields.get('pinToProfile'):
|
||||||
print('WARN: no message, image description or pin')
|
print('WARN: no message, image description or pin')
|
||||||
return -1
|
return -1
|
||||||
submit_text = self.server.translate['Publish']
|
submit_text1 = self.server.translate['Publish']
|
||||||
|
submit_text2 = self.server.translate['Send']
|
||||||
|
submit_text3 = submit_text2
|
||||||
custom_submit_text = \
|
custom_submit_text = \
|
||||||
get_config_param(self.server.base_dir, 'customSubmitText')
|
get_config_param(self.server.base_dir, 'customSubmitText')
|
||||||
if custom_submit_text:
|
if custom_submit_text:
|
||||||
submit_text = custom_submit_text
|
submit_text3 = custom_submit_text
|
||||||
if fields.get('submitPost'):
|
if fields.get('submitPost'):
|
||||||
if fields['submitPost'] != submit_text:
|
if fields['submitPost'] != submit_text1 and \
|
||||||
|
fields['submitPost'] != submit_text2 and \
|
||||||
|
fields['submitPost'] != submit_text3:
|
||||||
print('WARN: no submit field ' + fields['submitPost'])
|
print('WARN: no submit field ' + fields['submitPost'])
|
||||||
return -1
|
return -1
|
||||||
else:
|
else:
|
||||||
|
|
9
utils.py
9
utils.py
|
@ -3942,3 +3942,12 @@ def remove_square_capitals(text: str, system_language: str) -> str:
|
||||||
else:
|
else:
|
||||||
result += chr(offset + text_value - start_value)
|
result += chr(offset + text_value - start_value)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def dont_speak_hashtags(content: str) -> str:
|
||||||
|
"""Ensure that hashtags aren't announced by screen readers
|
||||||
|
"""
|
||||||
|
if not content:
|
||||||
|
return content
|
||||||
|
return content.replace('>#<span',
|
||||||
|
'><span aria-hidden="true">#</span><span')
|
||||||
|
|
|
@ -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 dont_speak_hashtags
|
||||||
from utils import remove_eol
|
from utils import remove_eol
|
||||||
from utils import disallow_announce
|
from utils import disallow_announce
|
||||||
from utils import disallow_reply
|
from utils import disallow_reply
|
||||||
|
@ -2061,6 +2062,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
languages_understood = get_actor_languages_list(actor_json)
|
languages_understood = get_actor_languages_list(actor_json)
|
||||||
content_str = get_content_from_post(post_json_object, system_language,
|
content_str = get_content_from_post(post_json_object, system_language,
|
||||||
languages_understood)
|
languages_understood)
|
||||||
|
content_str = dont_speak_hashtags(content_str)
|
||||||
|
|
||||||
attachment_str, gallery_str = \
|
attachment_str, gallery_str = \
|
||||||
get_post_attachments_as_html(base_dir, nickname, domain,
|
get_post_attachments_as_html(base_dir, nickname, domain,
|
||||||
|
@ -2144,6 +2146,7 @@ def individual_post_as_html(signing_priv_key_pem: str,
|
||||||
if not content_str:
|
if not content_str:
|
||||||
content_str = get_content_from_post(post_json_object, system_language,
|
content_str = get_content_from_post(post_json_object, system_language,
|
||||||
languages_understood)
|
languages_understood)
|
||||||
|
content_str = dont_speak_hashtags(content_str)
|
||||||
if not content_str:
|
if not content_str:
|
||||||
content_str = \
|
content_str = \
|
||||||
auto_translate_post(base_dir, post_json_object,
|
auto_translate_post(base_dir, post_json_object,
|
||||||
|
|
Loading…
Reference in New Issue