From a5917de7e6dd1b4c063bf328c3a2f2f689df687d Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Wed, 29 Oct 2008 22:03:03 -0400 Subject: Set footnote extension's parser to Markdown's instance of the parser rather than giving it its own. Now footnote defs will parse the same (if another extension modifies the parser). Also updated and added doc strings. --- markdown_extensions/footnotes.py | 42 +++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'markdown_extensions') diff --git a/markdown_extensions/footnotes.py b/markdown_extensions/footnotes.py index 95bd32c..d653c6e 100644 --- a/markdown_extensions/footnotes.py +++ b/markdown_extensions/footnotes.py @@ -35,13 +35,11 @@ class FootnoteExtension(markdown.Extension): """ Footnote Extension. """ def __init__ (self, configs): - + """ Setup configs. """ self.config = {'PLACE_MARKER': ["///Footnotes Go Here///", "The text string that marks where the footnotes go"]} - self.parser = markdown.MarkdownParser() - for key, value in configs: self.config[key][0] = value @@ -50,6 +48,7 @@ class FootnoteExtension(markdown.Extension): def extendMarkdown(self, md, md_globals): """ Add pieces to Markdown. """ md.registerExtension(self) + self.parser = md.parser # Insert a preprocessor before ReferencePreprocessor md.preprocessors.add("footnote", FootnotePreprocessor(self), "