From 7cc5ad34b065febe7536530b8cdae4602d34a080 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Thu, 28 Jun 2012 06:08:50 -0400 Subject: Fixed #109. The attr_list extension can now be loaded either before or after the headerid extension. --- markdown/extensions/attr_list.py | 8 ++++++-- 1 file 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={}): -- cgit v1.2.3