Merge pull request #483 from taigaio/issue/3321/emoji_extension_uses_wrong_path
Fix issue #3321: Emoji extension uses wrong pathremotes/origin/logger
commit
dd07d228a4
|
@ -193,9 +193,6 @@ MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage"
|
|||
# urls depends on it. On production should be set
|
||||
# something like https://media.taiga.io/
|
||||
MEDIA_URL = "http://localhost:8000/media/"
|
||||
|
||||
# Static url is not widelly used by taiga (only
|
||||
# if admin is activated).
|
||||
STATIC_URL = "http://localhost:8000/static/"
|
||||
|
||||
# Static configuration.
|
||||
|
|
|
@ -27,7 +27,8 @@
|
|||
|
||||
import re
|
||||
|
||||
from django.conf import settings
|
||||
from django.templatetags.static import static
|
||||
|
||||
|
||||
from markdown.extensions import Extension
|
||||
from markdown.preprocessors import Preprocessor
|
||||
|
@ -35,8 +36,8 @@ from markdown.preprocessors import Preprocessor
|
|||
|
||||
# Grab the emojis (+800) here: https://github.com/arvida/emoji-cheat-sheet.com
|
||||
# This **crazy long** list was generated by walking through the emojis.png
|
||||
emojis_path = "{}://{}/static/img/emojis/".format(settings.SITES["api"]["scheme"], settings.SITES["api"]["domain"])
|
||||
emojis_set = {
|
||||
EMOJIS_PATH = "img/emojis/"
|
||||
EMOJIS_SET = {
|
||||
"+1", "-1", "100", "1234", "8ball", "a", "ab", "abc", "abcd", "accept", "aerial_tramway", "airplane",
|
||||
"alarm_clock", "alien", "ambulance", "anchor", "angel", "anger", "angry", "anguished", "ant", "apple",
|
||||
"aquarius", "aries", "arrows_clockwise", "arrows_counterclockwise", "arrow_backward", "arrow_double_down",
|
||||
|
@ -168,11 +169,11 @@ class EmojifyPreprocessor(Preprocessor):
|
|||
def emojify(match):
|
||||
emoji = match.group(1)
|
||||
|
||||
if emoji not in emojis_set:
|
||||
if emoji not in EMOJIS_SET:
|
||||
return match.group(0)
|
||||
|
||||
url = emojis_path + emoji + u'.png'
|
||||
|
||||
path = "{}{}.png".format(EMOJIS_PATH, emoji)
|
||||
url = static(path)
|
||||
return ''.format(emoji=emoji, url=url)
|
||||
|
||||
for line in lines:
|
||||
|
|
Loading…
Reference in New Issue