aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2012-06-28 06:08:50 -0400
committerWaylan Limberg <waylan@gmail.com>2012-06-28 06:08:50 -0400
commit7cc5ad34b065febe7536530b8cdae4602d34a080 (patch)
treebaf8240ebde27fc4af47e210ca90309226bbf1b9
parent9adbb8e4589b19968c9d09d573db00f1d40b61db (diff)
downloadmarkdown-7cc5ad34b065febe7536530b8cdae4602d34a080.tar.gz
markdown-7cc5ad34b065febe7536530b8cdae4602d34a080.tar.bz2
markdown-7cc5ad34b065febe7536530b8cdae4602d34a080.zip
Fixed #109. The attr_list extension can now be loaded either before or after the headerid extension.
-rw-r--r--markdown/extensions/attr_list.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/markdown/extensions/attr_list.py b/markdown/extensions/attr_list.py
index 60287fe..1a1b87f 100644
--- a/markdown/extensions/attr_list.py
+++ b/markdown/extensions/attr_list.py
@@ -120,8 +120,12 @@ class AttrListTreeprocessor(markdown.treeprocessors.Treeprocessor):
class AttrListExtension(markdown.extensions.Extension):
def extendMarkdown(self, md, md_globals):
- # insert after 'inline' treeprocessor
- md.treeprocessors.add('attr_list', AttrListTreeprocessor(md), '>inline')
+ if 'headerid' in md.treeprocessors.keys():
+ # insert after 'headerid' treeprocessor
+ md.treeprocessors.add('attr_list', AttrListTreeprocessor(md), '>headerid')
+ else:
+ # insert after 'inline' treeprocessor
+ md.treeprocessors.add('attr_list', AttrListTreeprocessor(md), '>inline')
def makeExtension(configs={}):