Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class HTMLEntity(creoleparser.elements.InlineElement):
# Allows HTML elements to be passed through
def __init__(self):
super(HTMLEntity, self).__init__('span', ['&', ';'])
self.regexp = re.compile(self.re_string())
def re_string(self):
return '&([A-Za-z]\w{1,24}|#\d{2,7}|#[Xx][0-9a-zA-Z]{2,6});'
def _build(self, mo, element_store, environ):
content = mo.group(1)
return creoleparser.core.bldr.tag.__getattr__('span')(Markup('&' + content + ';'))
class CodeBlock(creoleparser.elements.BlockElement):
"""
A block of code that gets syntax-highlited
"""
def __init__(self):
super(CodeBlock, self).__init__('pre', ['{{{', '}}}'])
self.regexp = re.compile(self.re_string(), re.DOTALL + re.MULTILINE)
self.regexp2 = re.compile(self.re_string2(), re.MULTILINE)
def re_string(self):
start = '^\{\{\{\s*\[(' + brushre + ')\]\s*\n'
content = r'(.+?\n)'
end = r'\}\}\}\s*?$'
return start + content + end
def re_string2(self):
class HTMLEntity(creoleparser.elements.InlineElement):
# Allows HTML elements to be passed through
def __init__(self):
super(HTMLEntity, self).__init__('span', ['&',';'])
self.regexp = re.compile(self.re_string())
def re_string(self):
return '&([A-Za-z]\w{1,24}|#\d{2,7}|#[Xx][0-9a-zA-Z]{2,6});'
def _build(self,mo,element_store, environ):
content = mo.group(1)
return creoleparser.core.bldr.tag.__getattr__('span')(Markup('&' + content + ';'))
class CodeBlock(creoleparser.elements.BlockElement):
"""
A block of code that gets syntax-highlited
"""
def __init__(self):
super(CodeBlock,self).__init__('pre', ['{{{','}}}'])
self.regexp = re.compile(self.re_string(), re.DOTALL+re.MULTILINE)
self.regexp2 = re.compile(self.re_string2(), re.MULTILINE)
def re_string(self):
start = '^\{\{\{\s*\[(' + brushre + ')\]\s*\n'
content = r'(.+?\n)'
end = r'\}\}\}\s*?$'
return start + content + end
def re_string2(self):
"""Finds a closing token with a space at the start of the line."""