aboutsummaryrefslogtreecommitdiffstats
path: root/markdown_extensions/fenced_code.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2008-10-20 10:11:34 -0400
committerWaylan Limberg <waylan@gmail.com>2008-10-20 10:11:34 -0400
commit952d12302ab156cc9b289c45a96d0e3f0e7766e0 (patch)
tree6642436baa2d403ffe34f0bcc33a18a859fe5eca /markdown_extensions/fenced_code.py
parent3fc06a968ee2548254efd08d46b5a4d46ac7e3a8 (diff)
downloadmarkdown-952d12302ab156cc9b289c45a96d0e3f0e7766e0.tar.gz
markdown-952d12302ab156cc9b289c45a96d0e3f0e7766e0.tar.bz2
markdown-952d12302ab156cc9b289c45a96d0e3f0e7766e0.zip
Combined the TextPreprocessors and Preprocessors into Preprocessors. Updated extensions and docs as well.
Diffstat (limited to 'markdown_extensions/fenced_code.py')
-rw-r--r--markdown_extensions/fenced_code.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/markdown_extensions/fenced_code.py b/markdown_extensions/fenced_code.py
index 1825106..fa768c0 100644
--- a/markdown_extensions/fenced_code.py
+++ b/markdown_extensions/fenced_code.py
@@ -76,15 +76,16 @@ class FencedCodeExtension(markdown.Extension):
def extendMarkdown(self, md, md_globals):
""" Add FencedBlockPreprocessor to the Markdown instance. """
- md.textPreprocessors.add('fenced_code_block',
+ md.preprocessors.add('fenced_code_block',
FencedBlockPreprocessor(md),
"_begin")
-class FencedBlockPreprocessor(markdown.TextPreprocessor):
+class FencedBlockPreprocessor(markdown.Preprocessor):
- def run(self, text):
+ def run(self, lines):
""" Match and store Fenced Code Blocks in the HtmlStash. """
+ text = "\n".join(lines)
while 1:
m = FENCED_BLOCK_RE.search(text)
if m:
@@ -96,7 +97,7 @@ class FencedBlockPreprocessor(markdown.TextPreprocessor):
text = '%s\n%s\n%s'% (text[:m.start()], placeholder, text[m.end():])
else:
break
- return text
+ return text.split("\n")
def _escape(self, txt):
""" basic html escaping """