From f2efe2782bcb92665fe99d35d7bdc80665de5e25 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Thu, 13 Nov 2008 23:14:40 -0500 Subject: Fixed a few bugs in the legacy extension so that it actually works. I don't expect to continue supporting this. But it's here for comparison for now. --- markdown_extensions/legacy.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/markdown_extensions/legacy.py b/markdown_extensions/legacy.py index 1320734..5b3a9c2 100644 --- a/markdown_extensions/legacy.py +++ b/markdown_extensions/legacy.py @@ -6,7 +6,8 @@ Replaces the core parser with the old one. """ -import markdown +import markdown, re +from markdown import etree """Basic and reusable regular expressions.""" @@ -335,7 +336,7 @@ class MarkdownParser: pre = etree.SubElement(parentElem, "pre") code = etree.SubElement(pre, "code") text = "\n".join(detabbed).rstrip()+"\n" - code.text = AtomicString(text) + code.text = markdown.AtomicString(text) self.parseChunk(parentElem, theRest, inList) def detectTabbed(self, lines): @@ -344,10 +345,8 @@ class MarkdownParser: Keyword arguments: * lines: an array of strings - * fn: a function that returns a substring of a string - if the string matches the necessary criteria - Returns: a list of post processes items and the unused + Returns: a list of post processed items and the unused remainder of the original list """ @@ -391,7 +390,7 @@ class MarkdownParser: return items, lines[i:] -class HeaderPreprocessor(Preprocessor): +class HeaderPreprocessor(markdown.Preprocessor): """Replace underlined headers with hashed headers. @@ -425,7 +424,7 @@ class HeaderPreprocessor(Preprocessor): return lines -class LinePreprocessor(Preprocessor): +class LinePreprocessor(markdown.Preprocessor): """Convert HR lines to "___" format.""" blockquote_re = re.compile(r'^(> )+') -- cgit v1.2.3