aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2008-11-13 23:14:40 -0500
committerWaylan Limberg <waylan@gmail.com>2008-11-13 23:28:04 -0500
commitf2efe2782bcb92665fe99d35d7bdc80665de5e25 (patch)
tree8c93a9231cafe9bbc07a0b47fcf0d01974790ca4
parentaa32d721e797d4dd408d52a7e19a973bb4c5571f (diff)
downloadmarkdown-f2efe2782bcb92665fe99d35d7bdc80665de5e25.tar.gz
markdown-f2efe2782bcb92665fe99d35d7bdc80665de5e25.tar.bz2
markdown-f2efe2782bcb92665fe99d35d7bdc80665de5e25.zip
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.
-rw-r--r--markdown_extensions/legacy.py13
1 files 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'^(> )+')