bugdown: Add explanation for unicode-emoji JS regex.

This commit is contained in:
hackerkid 2016-11-17 15:04:07 +05:30 committed by Tim Abbott
parent 3a8282ff44
commit cdb716aa63
1 changed files with 6 additions and 0 deletions

View File

@ -1048,6 +1048,12 @@ class Bugdown(markdown.Extension):
md.inlinePatterns.add('unicodeemoji', UnicodeEmoji(
u'(?P<syntax>[\U0001F300-\U0001F64F\U0001F680-\U0001F6FF\u2600-\u26FF\u2700-\u27BF])'),
'_end')
# The equalent JS regex is \ud83c[\udf00-\udfff]|\ud83d[\udc00-\ude4f]|\ud83d[\ude80-\udeff]|
# [\u2600-\u26FF]|[\u2700-\u27BF]. See below comments for explanation. The JS regex is used
# by marked.js for frontend unicode emoji processing.
# The JS regex \ud83c[\udf00-\udfff]|\ud83d[\udc00-\ude4f] represents U0001F300-\U0001F64F
# The JS regex \ud83d[\ude80-\udeff] represents \U0001F680-\U0001F6FF
# Similiarly [\u2600-\u26FF]|[\u2700-\u27BF] represents \u2600-\u26FF\u2700-\u27BF
md.inlinePatterns.add('link', AtomicLinkPattern(markdown.inlinepatterns.LINK_RE, md), '>avatar')