[fix] get_icon_html (#4748)
This commit is contained in:
parent
8d8358644c
commit
6f4e2b046c
1 changed files with 10 additions and 6 deletions
|
|
@ -49,16 +49,20 @@ def is_json(text):
|
|||
return True
|
||||
|
||||
def get_icon_html(icon, small=False):
|
||||
emoji_pattern = re.compile(u'['
|
||||
u'\U0001F300-\U0001F64F'
|
||||
u'\U0001F680-\U0001F6FF'
|
||||
u'\u2600-\u26FF\u2700-\u27BF]+',
|
||||
re.UNICODE)
|
||||
from frappe.utils import is_image
|
||||
|
||||
emoji_pattern = re.compile(
|
||||
u"(\ud83d[\ude00-\ude4f])|"
|
||||
u"(\ud83c[\udf00-\uffff])|"
|
||||
u"(\ud83d[\u0000-\uddff])|"
|
||||
u"(\ud83d[\ude80-\udeff])|"
|
||||
u"(\ud83c[\udde0-\uddff])"
|
||||
"+", flags=re.UNICODE)
|
||||
|
||||
if icon and emoji_pattern.match(icon):
|
||||
return '<span class="text-muted">' + icon + '</span>'
|
||||
|
||||
if frappe.utils.is_image(icon):
|
||||
if is_image(icon):
|
||||
return \
|
||||
'<img style="width: 16px; height: 16px;" src="{icon}">'.format(icon=icon) \
|
||||
if small else \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue