diff options
author | Waylan Limberg <waylan@gmail.com> | 2009-03-13 00:00:58 -0400 |
---|---|---|
committer | Waylan Limberg <waylan@gmail.com> | 2009-03-13 00:00:58 -0400 |
commit | a39deb26b31de97e2cf4fd867089e656e0c40a2d (patch) | |
tree | 186f62ae5242ee37062d711ec2df61a0db2d164f | |
parent | 07b03afa103b2baf86a2f77f2eab5aa92f81375f (diff) | |
download | markdown-a39deb26b31de97e2cf4fd867089e656e0c40a2d.tar.gz markdown-a39deb26b31de97e2cf4fd867089e656e0c40a2d.tar.bz2 markdown-a39deb26b31de97e2cf4fd867089e656e0c40a2d.zip |
Fixed ticket 25. Added reset to HeaderID extension. Reset now resets the duplicate id counter.
-rw-r--r-- | markdown/extensions/headerid.py | 13 |
1 files 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): |