From a39deb26b31de97e2cf4fd867089e656e0c40a2d Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Fri, 13 Mar 2009 00:00:58 -0400 Subject: Fixed ticket 25. Added reset to HeaderID extension. Reset now resets the duplicate id counter. --- markdown/extensions/headerid.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/markdown/extensions/headerid.py b/markdown/extensions/headerid.py index dae18fd..f70a7a9 100644 --- a/markdown/extensions/headerid.py +++ b/markdown/extensions/headerid.py @@ -175,12 +175,15 @@ class HeaderIdExtension (markdown.Extension): self.setConfig(key, value) def extendMarkdown(self, md, md_globals): - - processor = HeaderIdProcessor(md.parser) - processor.md = md - processor.config = self.config + md.registerExtension(self) + self.processor = HeaderIdProcessor(md.parser) + self.processor.md = md + self.processor.config = self.config # Replace existing hasheader in place. - md.parser.blockprocessors['hashheader'] = processor + md.parser.blockprocessors['hashheader'] = self.processor + + def reset(self): + self.processor.IDs = [] def makeExtension(configs=None): -- cgit v1.2.3