diff options
author | Waylan Limberg <waylan@gmail.com> | 2007-10-09 01:04:41 +0000 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2007-10-09 01:04:41 +0000 |
commit | 5d3f2f3020d6d15ef34dba5e195747c6f048d518 (patch) | |
tree | 8d4c5cbf0091b6090227f74dda621462343f6953 /markdown.py | |
parent | 493181e478838413623f99a00ab855adebb0436e (diff) | |
download | markdown-5d3f2f3020d6d15ef34dba5e195747c6f048d518.tar.gz markdown-5d3f2f3020d6d15ef34dba5e195747c6f048d518.tar.bz2 markdown-5d3f2f3020d6d15ef34dba5e195747c6f048d518.zip |
Added textPreprocessor - all missing chnages in 1.6b should now be in trunk.
Diffstat (limited to 'markdown.py')
-rw-r--r-- | markdown.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/markdown.py b/markdown.py index 1e8a56f..fbaeb84 100644 --- a/markdown.py +++ b/markdown.py @@ -505,10 +505,9 @@ class HtmlBlockPreprocessor (Preprocessor): return (tag in ['hr', 'hr/']) - def run (self, lines) : + def run (self, text) : new_blocks = [] - text = "\n".join(lines) text = text.split("\n\n") items = [] @@ -571,7 +570,7 @@ class HtmlBlockPreprocessor (Preprocessor): new_blocks.append(self.stash.store('\n\n'.join(items))) new_blocks.append('\n') - return "\n\n".join(new_blocks).split("\n") + return "\n\n".join(new_blocks) HTML_BLOCK_PREPROCESSOR = HtmlBlockPreprocessor() @@ -1072,8 +1071,9 @@ class Markdown: self.stripTopLevelTags = 1 self.docType = "" - self.preprocessors = [ HTML_BLOCK_PREPROCESSOR, - HEADER_PREPROCESSOR, + self.textPreprocessors = [ HTML_BLOCK_PREPROCESSOR] + + self.preprocessors = [ HEADER_PREPROCESSOR, LINE_PREPROCESSOR, LINE_BREAKS_PREPROCESSOR, # A footnote preprocessor will @@ -1631,7 +1631,9 @@ class Markdown: self.source = removeBOM(self.source, self.encoding) - + for pp in self.textPreprocessors : + self.source = pp.run(self.source) + doc = self._transform() xml = doc.toxml() |