From c6ef19126cc088bf168fc64f8782eae17338029f Mon Sep 17 00:00:00 2001 From: Will Larson Date: Tue, 8 Jul 2008 15:26:13 +0900 Subject: [PATCH] Realized that changes to code highlighting regex had broken its functioning in comments, so changed how it was detecting newlines. (Now using '\r?\n') Also made the start of syntax highlighting block more flexible, allowing for more (or less) whitespace without breaking. --- markdown/mdx_code.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/markdown/mdx_code.py b/markdown/mdx_code.py index 5a84668..3f812fb 100644 --- a/markdown/mdx_code.py +++ b/markdown/mdx_code.py @@ -16,13 +16,17 @@ def extendMarkdown(self, md, md_global): md.textPreprocessors.insert(0, preprocessor) -CODE_BLOCK_REGEX = re.compile(r"^(?P[ ]*)@@ (?P[a-zA-Z0-9_+-]+)[ ]?(?P[a-zA-Z]*)$(?P.*?)@@$", re.DOTALL | re.MULTILINE) +CODE_BLOCK_REGEX = re.compile(r"\r?\n(?P[ ]*)@@[ ]*(?P[a-zA-Z0-9_+-]+)[ ]*(?P[a-zA-Z]*)[ ]*\r?\n(?P.*?)@@[ ]*\r?\n", re.DOTALL | re.MULTILINE) class CodeBlockPreprocessor : def run (self, text): + print "searching for matches" + print text + print len(text) while 1: m = CODE_BLOCK_REGEX.search(text) if not m: break; + print m spaces = len(m.group('spaces')) lexer = get_lexer_by_name(m.group('syntax')) linenos = m.group('linenos')