From 9c6bf2b66f6eabadc6e9944878ca8c1142ea8e0d Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Wed, 5 Nov 2008 15:16:36 -0500 Subject: Fixed InlineProcessor to use the inlinePatterns on the Markdown instance directly rather than a copied list of values set at init. --- markdown.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'markdown.py') diff --git a/markdown.py b/markdown.py index b534f27..b534151 100755 --- a/markdown.py +++ b/markdown.py @@ -1202,6 +1202,7 @@ class InlineProcessor(Treeprocessor): self.__placeholder_length = 4 + len(self.__placeholder_prefix) \ + len(self.__placeholder_suffix) self.__placeholder_re = re.compile(INLINE_PLACEHOLDER % r'([0-9]{4})') + self.markdown = md def __makePlaceholder(self, type): """ Generate a placeholder """ @@ -1248,10 +1249,10 @@ class InlineProcessor(Treeprocessor): """ if not isinstance(data, AtomicString): startIndex = 0 - while patternIndex < len(self.patterns): + while patternIndex < len(self.markdown.inlinePatterns): data, matched, startIndex = self.__applyPattern( - self.patterns[patternIndex], - data, patternIndex, startIndex) + self.markdown.inlinePatterns.value_for_index(patternIndex), + data, patternIndex, startIndex) if not matched: patternIndex += 1 return data @@ -1830,9 +1831,6 @@ class Markdown: configs = extension_configs) self.reset() - # Sort and add patterns only after all extensions are loaded. - self.treeprocessors['inline'].patterns = self.inlinePatterns.values() - def registerExtensions(self, extensions, configs): """ Register extensions with this instance of Markdown. -- cgit v1.2.3