Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
':sparkle:', ':eight_pointed_black_star:', ':heart_decoration:', ':vs:', ':vibration_mode:', ':mobile_phone_off:', ':chart:',
':currency_exchange:', ':aries:', ':taurus:', ':gemini:', ':cancer:', ':leo:', ':virgo:', ':libra:', ':scorpius:', ':sagittarius:',
':capricorn:', ':aquarius:', ':pisces:', ':ophiuchus:', ':six_pointed_star:', ':negative_squared_cross_mark:', ':a:', ':b:', ':ab:', ':o2:',
':diamond_shape_with_a_dot_inside:', ':recycle:', ':end:', ':back:', ':on:', ':soon:', ':clock1:', ':clock130:', ':clock10:', ':clock1030:',
':clock11:', ':clock1130:', ':clock12:', ':clock1230:', ':clock2:', ':clock230:', ':clock3:', ':clock330:', ':clock4:', ':clock430:',
':clock5:', ':clock530:', ':clock6:', ':clock630:', ':clock7:', ':clock730:', ':clock8:', ':clock830:', ':clock9:', ':clock930:',
':heavy_dollar_sign:', ':copyright:', ':registered:', ':tm:', ':x:', ':heavy_exclamation_mark:', ':bangbang:', ':interrobang:', ':o:',
':heavy_multiplication_x:', ':heavy_plus_sign:', ':heavy_minus_sign:', ':heavy_division_sign:', ':white_flower:', ':100:', ':heavy_check_mark:',
':ballot_box_with_check:', ':radio_button:', ':link:', ':curly_loop:', ':wavy_dash:', ':part_alternation_mark:', ':trident:',
':black_small_square:', ':white_small_square:', ':black_medium_small_square:', ':white_medium_small_square:', ':black_medium_square:',
':white_medium_square:', ':white_large_square:', ':white_check_mark:', ':black_square_button:', ':white_square_button:',
':black_circle:', ':white_circle:', ':red_circle:', ':large_blue_circle:', ':large_blue_diamond:', ':large_orange_diamond:',
':small_blue_diamond:', ':small_orange_diamond:', ':small_red_triangle:', ':small_red_triangle_down:']
class EmojiPattern(markdown.inlinepatterns.Pattern):
def handleMatch(self, m):
emoji = self.unescape(m.group(2))
if emoji not in EMOJIS:
return emoji
url = '{0}{1}.png'.format(
MARTOR_MARKDOWN_BASE_EMOJI_URL, emoji.replace(':', '')
)
if MARTOR_MARKDOWN_BASE_EMOJI_USE_STATIC is True:
url = static(url)
el = markdown.util.etree.Element('img')
el.set('src', url)
el.set('class', 'marked-emoji')
el.text = markdown.util.AtomicString(emoji)
return el
def extendMarkdown(self, md, md_globals):
# Create the del pattern
delTag = markdown.inlinepatterns.SimpleTagPattern(self.DEL_RE, 'del')
# Insert del pattern into markdown parser
md.inlinePatterns.add('del', delTag, '>not_strong')
def handle_match(m):
node = markdown.util.etree.Element('script')
node.set('type', 'math/tex; mode=display')
if '\\begin' in m.group(2):
node.text = markdown.util.AtomicString(m.group(2) + m.group(4) + m.group(5))
else:
node.text = markdown.util.AtomicString(m.group(3))
return node
inlinemathpatterns = (
markdown.inlinepatterns.Pattern(r'(?
def __init__(self):
markdown.inlinepatterns.Pattern.__init__(self, r'(?
import markdown
import cgi
class MathJaxPattern(markdown.inlinepatterns.Pattern):
def __init__(self, md):
markdown.inlinepatterns.Pattern.__init__(self, r'(?
if self.markdown.enable_attributes:
if element.text and isString(element.text):
element.text = \
inlinepatterns.handleAttributes(element.text,
element)
i = 0
for newChild in lst:
if self.markdown.enable_attributes:
# Processing attributes
if newChild.tail and isString(newChild.tail):
newChild.tail = \
inlinepatterns.handleAttributes(newChild.tail,
element)
if newChild.text and isString(newChild.text):
newChild.text = \
inlinepatterns.handleAttributes(newChild.text,
newChild)
element.insert(i, newChild)
i += 1
return tree
def extendMarkdown(self, md, md_globals):
br_tag = markdown.inlinepatterns.SubstituteTagPattern(BR_RE, 'br')
md.inlinePatterns.add('nl', br_tag, '_end')
# Override defaults with user settings
for key, value in configs:
self.setConfig(key, value)
def extendMarkdown(self, md):
self.md = md
# append to end of inline patterns
WIKI_RE = r'\[(?P<label>[^\]]+?)\]\(wiki:(?P[a-zA-Z0-9\./_-]*?)(?P#[a-zA-Z0-9\./_-]*)?\)'
wikiPathPattern = WikiPath(WIKI_RE, self.config, md=md)
wikiPathPattern.md = md
md.inlinePatterns.add('djangowikipath', wikiPathPattern, "</label>
for child in currElement.getchildren():
if child.text and not isinstance(child.text, markdown.AtomicString):
text = child.text
child.text = None
lst = self.__processPlaceholders(self.__handleInline(
text), child)
stack += lst
insertQueue.append((child, lst))
if child.getchildren():
stack.append(child)
for element, lst in insertQueue:
if element.text:
element.text = \
markdown.inlinepatterns.handleAttributes(element.text,
element)
i = 0
for newChild in lst:
# Processing attributes
if newChild.tail:
newChild.tail = \
markdown.inlinepatterns.handleAttributes(newChild.tail,
element)
if newChild.text:
newChild.text = \
markdown.inlinepatterns.handleAttributes(newChild.text,
newChild)
element.insert(i, newChild)
i += 1
return tree
node.text = AtomicString(m.group(3))
return _wrap_node(node, ''.join(m.group(2, 3, 4)), 'span')
def handle_match(m):
node = etree.Element('script')
node.set('type', 'math/tex; mode=display')
if '\\begin' in m.group(2):
node.text = AtomicString(''.join(m.group(2, 4, 5)))
return _wrap_node(node, ''.join(m.group(1, 2, 4, 5, 6)), 'div')
else:
node.text = AtomicString(m.group(3))
return _wrap_node(node, ''.join(m.group(2, 3, 4)), 'div')
inlinemathpatterns = (
markdown.inlinepatterns.Pattern(r'(?