mirror of
https://github.com/zulip/zulip.git
synced 2026-07-12 21:04:41 +08:00
markdown: Fix emojis not rendering with :bogus: in the line.
This fixes an issue where invalid emoji name prevents following
emojis from rendering.
This reverts the code change in
8842349629, while still passing the
tests added in that commit (it seems the original commit had
misdiagnosed an ordering bug and thus introduced this issue).
Fixes: #11770.
This commit is contained in:
parent
0be410d3fe
commit
58d28eed5d
@ -1179,7 +1179,7 @@ class Emoji(markdown.inlinepatterns.Pattern):
|
||||
elif name in name_to_codepoint:
|
||||
return make_emoji(name_to_codepoint[name], orig_syntax)
|
||||
else:
|
||||
return None
|
||||
return orig_syntax
|
||||
|
||||
def content_has_emoji_syntax(content: str) -> bool:
|
||||
return re.search(EMOJI_REGEX, content) is not None
|
||||
|
||||
@ -542,6 +542,11 @@
|
||||
"expected_output": "<p>Emojis like :man-girl-girl: which have ZWJ are banned for now.</p>",
|
||||
"text_content": "Emojis like :man-girl-girl: which have ZWJ are banned for now."
|
||||
},
|
||||
{
|
||||
"name": "valid_emoji_preceded_by_invalid_emoji",
|
||||
"input": "This is :invalidemoji: which should not prevent rendering :smile:",
|
||||
"expected_output": "<p>This is :invalidemoji: which should not prevent rendering <span aria-label=\"smile\" class=\"emoji emoji-263a\" role=\"img\" title=\"smile\">:smile:</span></p>"
|
||||
},
|
||||
{
|
||||
"name": "safe_html",
|
||||
"input": "<h1>stay normal</h1> thanks",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user