Merge branch 'main' of gitlab.com:bashrc2/epicyon

merge-requests/30/head
Bob Mottram 2022-11-11 12:17:42 +00:00
commit fb164c745b
4 changed files with 21 additions and 4 deletions

View File

@ -684,7 +684,8 @@ def _add_hash_tags(word_str: str, http_prefix: str, domain: str,
'type': 'Hashtag'
}
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>"
return True

View File

@ -19133,13 +19133,17 @@ class PubServer(BaseHTTPRequestHandler):
not fields.get('pinToProfile'):
print('WARN: no message, image description or pin')
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 = \
get_config_param(self.server.base_dir, 'customSubmitText')
if custom_submit_text:
submit_text = custom_submit_text
submit_text3 = custom_submit_text
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'])
return -1
else:

View File

@ -3942,3 +3942,12 @@ def remove_square_capitals(text: str, system_language: str) -> str:
else:
result += chr(offset + text_value - start_value)
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')

View File

@ -25,6 +25,7 @@ from posts import post_is_muted
from posts import get_person_box
from posts import download_announce
from posts import populate_replies_json
from utils import dont_speak_hashtags
from utils import remove_eol
from utils import disallow_announce
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)
content_str = get_content_from_post(post_json_object, system_language,
languages_understood)
content_str = dont_speak_hashtags(content_str)
attachment_str, gallery_str = \
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:
content_str = get_content_from_post(post_json_object, system_language,
languages_understood)
content_str = dont_speak_hashtags(content_str)
if not content_str:
content_str = \
auto_translate_post(base_dir, post_json_object,