From 3c69b0fb1d86f68a337bf3bd9b4a86b30a5fe6bf Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Sun, 21 Jun 2015 21:21:49 -0400 Subject: Fixed many failing tests in inline refactor. Still a ways to go. --- markdown/treeprocessors.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'markdown/treeprocessors.py') diff --git a/markdown/treeprocessors.py b/markdown/treeprocessors.py index d2036f6..c07acdc 100644 --- a/markdown/treeprocessors.py +++ b/markdown/treeprocessors.py @@ -48,7 +48,7 @@ class InlineProcessor(Treeprocessor): def __init__(self, md): super(InlineProcessor, self).__init__(md) - self.TOKEN_RE = re.compile(r'|'.join('\\{0}'.format(x) for x in md.ESCAPED_CHARS)) + self.TOKEN_RE = re.compile(r'|'.join('\\{0}'.format(x) for x in md.ESCAPED_CHARS + [' \n'])) def apply_patterns(self, text): """ @@ -61,10 +61,11 @@ class InlineProcessor(Treeprocessor): match = pattern.getCompiledRegExp().match(text) if match: node = pattern.handleMatch(match) - text = text[match.end():] + if node is not None: + text = text[match.end():] break - if not match: + if not match or node is None: # Step forward one character return text[0], None, text[1:] -- cgit v1.2.1