a11y: add alt to emojis
This commit is contained in:
parent
df6e1e2ffd
commit
1a8ef81e0e
1 changed files with 2 additions and 2 deletions
|
@ -78,7 +78,7 @@ def clean_author(account):
|
||||||
if 'emojis' in account and len(account['emojis']) > 0:
|
if 'emojis' in account and len(account['emojis']) > 0:
|
||||||
name = account['display_name']
|
name = account['display_name']
|
||||||
for emoji in account['emojis']:
|
for emoji in account['emojis']:
|
||||||
account['display_name'] = name.replace(":" + emoji['shortcode'] + ":", '<img class="emoji" src="'+emoji['url']+'" />')
|
account['display_name'] = name.replace(":" + emoji['shortcode'] + ":", '<img alt="' + emoji['shortcode'] + ' emoji" class="emoji" src="'+emoji['url']+'" />')
|
||||||
|
|
||||||
return clean_dict(account, ['avatar', 'display_name', 'id', 'url'])
|
return clean_dict(account, ['avatar', 'display_name', 'id', 'url'])
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ def clean_status(status):
|
||||||
clean = clean_dict(status, ['id', 'content', 'created_at', 'url', 'media_attachments', 'card'])
|
clean = clean_dict(status, ['id', 'content', 'created_at', 'url', 'media_attachments', 'card'])
|
||||||
clean['account'] = clean_author(status['account'])
|
clean['account'] = clean_author(status['account'])
|
||||||
for emoji in status['emojis']:
|
for emoji in status['emojis']:
|
||||||
clean['content'] = clean['content'].replace(":" + emoji['shortcode'] + ":", '<img class="emoji" src="'+emoji['url']+'" />')
|
clean['content'] = clean['content'].replace(":" + emoji['shortcode'] + ":", '<img alt="' + emoji['shortcode'] + ' emoji" class="emoji" src="'+emoji['url']+'" />')
|
||||||
return clean
|
return clean
|
||||||
|
|
||||||
def clean_dict(dict, keys):
|
def clean_dict(dict, keys):
|
||||||
|
|
Loading…
Reference in a new issue