Make fence regex stricter to only match fence-like things

(imported from commit 59d5302b7af09c669423d364d46fb0d1b6a7b080)
This commit is contained in:
Leo Franchi
2013-01-29 10:14:49 -05:00
parent c6f73f7697
commit 6130d271cf

View File

@@ -68,7 +68,7 @@ import markdown
from zephyr.lib.bugdown.codehilite import CodeHilite, CodeHiliteExtension
# Global vars
FENCE_RE = re.compile(r'(?P<fence>^(?:~{3,}))[ ]*(\{?\.?(?P<lang>[a-zA-Z0-9_+-]*)\}?)', re.MULTILINE|re.DOTALL)
FENCE_RE = re.compile(r'(?P<fence>^(?:~{3,}))[ ]*(\{?\.?(?P<lang>[a-zA-Z0-9_+-]*)\}?)$', re.MULTILINE|re.DOTALL)
FENCED_BLOCK_RE = re.compile( \
r'(?P<fence>^(?:~{3,}))[ ]*(\{?\.?(?P<lang>[a-zA-Z0-9_+-]*)\}?)?[ ]*\n(?P<code>.*?)(?<=\n)(?P=fence)[ ]*$',
re.MULTILINE|re.DOTALL