diff options
author | Waylan Limberg <waylan@gmail.com> | 2010-07-07 10:11:45 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2010-07-07 10:11:45 -0400 |
commit | a33a04439905851b5b1a5db4104ec3a11b4ab1d3 (patch) | |
tree | 3b52768f0b0d928a688c79adcd531059ec7bc005 /markdown/preprocessors.py | |
parent | 018aa73e82941288a1178ded751cf29d9bc13581 (diff) | |
download | markdown-a33a04439905851b5b1a5db4104ec3a11b4ab1d3.tar.gz markdown-a33a04439905851b5b1a5db4104ec3a11b4ab1d3.tar.bz2 markdown-a33a04439905851b5b1a5db4104ec3a11b4ab1d3.zip |
Factored out the building of the various processors and patterns into utility functions called by a build_parser method on the Markdown class. Editing of the processors and patterns now all happen in one file for each type. Additionaly, a subclass of Markdown could potentially override the build_parser method and build a parser for a completely differant markup language without first building the default and then overriding it.
Diffstat (limited to 'markdown/preprocessors.py')
-rw-r--r-- | markdown/preprocessors.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/markdown/preprocessors.py b/markdown/preprocessors.py index 567621b..a83a78a 100644 --- a/markdown/preprocessors.py +++ b/markdown/preprocessors.py @@ -1,4 +1,3 @@ - """ PRE-PROCESSORS ============================================================================= @@ -9,6 +8,15 @@ complicated. import re import util +import odict + + +def build_preprocessors(md_instance, **kwargs): + """ Build the default set of preprocessors used by Markdown. """ + preprocessors = odict.OrderedDict() + preprocessors["html_block"] = HtmlBlockPreprocessor(md_instance) + preprocessors["reference"] = ReferencePreprocessor(md_instance) + return preprocessors class Preprocessor(util.Processor): |