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/treeprocessors.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/treeprocessors.py')
-rw-r--r-- | markdown/treeprocessors.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/markdown/treeprocessors.py b/markdown/treeprocessors.py index 6aeb142..50df486 100644 --- a/markdown/treeprocessors.py +++ b/markdown/treeprocessors.py @@ -2,6 +2,16 @@ import re import inlinepatterns import util +import odict + + +def build_treeprocessors(md_instance, **kwargs): + """ Build the default treeprocessors for Markdown. """ + treeprocessors = odict.OrderedDict() + treeprocessors["inline"] = InlineProcessor(md_instance) + treeprocessors["prettify"] = PrettifyTreeprocessor(md_instance) + return treeprocessors + def isString(s): """ Check if it's string """ |