Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def gen_toc_id(text):
text = TAG.sub('', text)
text = '-'.join(text.split()).strip('-')
return escape_url(text.lower())
def tokenize_link(self, line, link, text, title, state):
if state.get('_in_link'):
return 'text', line
state['_in_link'] = True
text = self.render(text, state)
state['_in_link'] = False
return 'link', escape_url(link), text, title
def parse_auto_link(self, m, state):
if state.get('_in_link'):
return 'text', m.group(0)
text = m.group(1)
if '@' in text and not text.lower().startswith('mailto:'):
link = 'mailto:' + text
else:
link = text
return 'link', escape_url(link), text
def parse_url_link(self, m, state):
return 'link', escape_url(m.group(0))